INVERTING FUNCTIONS

To generate iterators we often need to invert functions or expressions. For
x2 = h(x)
we derive $x =\pm \sqrt{h(x)}$. The choice of signs presents a problem.  Many multiple-valued inverses present the same problem. 

The selection of multiple-valued inverses is solved as follows. When there are multiple choices for xi+1 we select the one with minimal distance to xi for convergence reasons.  I.e. select the xi+1 which makes | xi+1-xi | minimal.  This observation is a crucial one for our algorithm.

E.g. from g(xi+1)2 = h(xi)  we derive g(xi+1) = Inverse_square( h(xi), g(xi) ) where

  Inverse_square := proc( rhs, lhs )
      r := sqrt( rhs );
      if abs(r-lhs) <= abs(r+lhs) then r else -r fi
  end;

A second problem that we have with inverting functions is a domain problem, and it can be illustrated with the equation

\sqrt{ x_{i+1} } = h(x_i)
from which we isolate xi+1 = h(xi)2.  In this case there is no choice of inverse, but if h(xi) is negative the inverse cannot be computed, as we assume that $\sqrt{x}$ returns its principal value.  E.g. for $\sqrt{x} = -1$, isolation gives x=1 which is not a solution of the original equation.  Such a situation should be treated as a domain error.  In this case we use a new function to define this type of manipulation, xi+1 = Inverse_sqrt( h(xi) ) and
  Inverse_sqrt := proc( rhs )
      a := argument( rhs );
      if a <= -Pi/2 or a > Pi/2 then
           ERROR( `cannot invert sqrt` )
      else rhs^2 fi
  end;
previous next