## Root-Finder Utility for f(M) = a |

This page contains a routine that numerically finds roots of the equation presented above on the interval specified by the user.

**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* **a _{1}**,

**a**, and

_{2}**a**. If any of the three terms in this equation is not required, just enter

_{3}**0**'s for the appropriate

**a**constant(s).

In addition to the **a** values, the user must enter a range, [b, c], over which a zero will be sought for this function. These values represent *time* variables, from which M is calculated as M = (2πt)/T. T is the period of the motion, which must be entered by the user as well.

The user should ensure that a zero is included on this 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(M) does not change sign over the specified interval, a message box pops up stating this feature 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(M) changes sign over the interval.

Even before using this utility, some observations may be made:

If **a _{1}** and

**a**are 0, but

_{2}**a**is non-zero, the function is a straight line and does not have a root.

_{3}If

**a**is zero, but

_{3}**a**or

_{1}**a**--or both--is non-zero, the function has roots at m(π/2), where m is a non-zero integer.

_{2}
**IMPORTANT**: Note the Error Code returned.

Enter the **a** values for the function.

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.