A3 Finding the root of a function 559
instead of upwards. This is done by starting at a valueltoplying significantly higher
than the one we want the Bessel function for. We putsltop+ 1 equal to zero and
sltop equal to some small valueδ. Then, the recursion procedure is carried out
downward until one arrives at the desiredl. Notice that the normalisation of the
solution is arbitrary (since it is determined by the arbitrary small numberδ). To
normalise the solution, we continue recursion down tol=0 and then use the fact
that(j 0 −xj 1 )cosx+xj 0 sinx=1 which determines the normalisation constant.
A problem is of course with how large anltopone should start. In many cases this
can be read off from the asymptotic expression for the functions to be determined.
A3 Finding the root of a function
An important problem in numerical analysis is that of finding the root of a one-
dimensional, real functionf:
f(x)=0. (A.4)
If this problem cannot be solved analytically, numerical alternatives have to be
used, and here we shall describe three of these, the regula falsi, the secant method
and the Newton–Raphson method. Of course, the functionfmay have more than
one or perhaps no root in the interval under consideration; some knowledge offis
therefore necessary for the algorithms to arrive at the desired root. If a continuous
function has opposite signs at two pointsx 1 andx 2 , it must have at least one root
between these points. If we have two pointsx 1 andx 2 where our function has
equal signs, we can extend the interval beyond the point where the absolute value
offis smallest until the resulting interval brackets a root. Also, if the number of
roots betweenx 1 andx 2 is even, the function has the same sign on both points; if
we suspect roots to lie within this interval, we split the interval up into a number
of smaller subintervals and check all of them for sign changes. We suppose in the
following that the user roughly knows the location of the root (it might be bracketed,
for example), but that its precise location is required.
The efficiency of a root-finding method is usually expressed in terms of a con-
vergence exponentyfor the error in the location of the root. Since root-finding
methods are iterative, the expected error,δn, at some step in the iteration can be
expressed in terms of the error at the previous step,δn− 1 :
δn=Const.×|δn− 1 |y. (A.5)
Theregula falsi,orfalse positionmethod, starts with evaluating the function at
two points,x 1 andx 2 , lying on either side of a single root, withx 1 <x 2. Therefore
the signs off(x 1 )≡f 1 andf(x 2 )≡f 2 are opposite. A first guess for the root is