Root-Finder Utility for |
f(x) = a1/ √ (1 - x 2) - (1/x2) [( (1 + a2 x2)/(1 + a2) )a3 - 1] |
This page contains a routine that numerically finds roots of the equation presented above on certain, specified, intervals.
References:
Shampine, L. F. (SNLA) and H. A. Watts (SNLA)
"FZERO, A Root-solving Code" Report SC-TM-70-631
Sandia Laboratories
September, 1970
Dekker, T.J.
"Finding a Zero by Means of Successive Linear Interpolation"
"Constructive Aspects of the Fundamental Theorem of Algebra"
edited by B. Dejon and P. Henrici
Wiley-Interscience
1969
The utility posted on this page is based on the program "FZERO.F", written by L. F. Shampine (SNLA) and H. A. Watts (SNLA), based upon a method by T. J. Dekker.
"FZERO.F" is part of the SLATEC library of programs, and its original code (written in FORTRAN) can be viewed there.
Before being posted on this page, "FZERO.F" was translated to Javascript and extensively edited, customizing the algorithm for this particular application. Although all care was taken to ensure that it was translated accurately, some errors may have crept into the translation. These errors are mine; the original FORTRAN routines have been thoroughly tested and work properly. Please contact the webmaster to report any errors.
To increase the flexibility of this utility, the user is given fields into which values must be entered for the constants a1, a2, and a3.
In addition to the a values, the user must enter a range, [b, c], over which a zero will be sought for this function.
Note some important conditions for the values of the inputs:
Depending what values for a are entered, this function is only defined over certain intervals.
1) a2 cannot be -1; the function goes to infinity for a2 = -1.
2) The interval cannot include 0; the second term of this function goes to infinity at x = 0.
3) If a1 is non-zero, the interval input is confined to the range such that the absolute value of x remains less than 1 (but non-zero).
In other words, the input interval is confined to the range 0 < x < 1 or
-1 < x < 0.
The first term becomes infinite for x = 1 or x = -1, and imaginery for x > 1 or x < -1.
If the user inputs an interval that goes beyond the appropriate range, it is truncated to these limits.
The truncation may truncate to the wrong side of 0; if this happens, simply try again, this time entering the appropriate endpoints.
Also, the user should ensure that a zero is included on the interval before entering these values. In other words, the sign of f(b) should not be the same as the sign of f(c). If f(x) does not change sign over the specified interval, a message box pops up stating this situation and then drops out of the routine--no further action is taken. The user must try again, entering b and c values such that f(x) changes sign over the interval.
IMPORTANT: Note the Error Code returned.
Error Code = 1: The zero is within the requested tolerance (on the order of Machine Epsilon), the interval has collapsed to the requested tolerance, the function changes sign over the interval, and the function decreased in magnitude as the interval collapsed.
Error Code = 2: A zero has been found, but the interval has not collapsed to the requested tolerance.
Error Code = 3: MAXIT (200) function evaluations. The solution may be meaningless. Check it.