TEST_ZERO Zero Finder Tests

TEST_ZERO is a FORTRAN90 library which defines nonlinear functions that may be used to test zero finders.

Zero finders are programs that seek a (scalar) root of a scalar equation F(X) = 0. Some zero finders require that an initial "change-of-sign" interval [A,B] be supplied, with the function having opposite sign at the two endpoints, thus guaranteeing that there is some value C between A and B for which F(C) = 0 (assuming that the function F is continuous). In other cases, a particular zero finder may want information about the first or second derivative of the function. And some zero finders can handle situations where the function has a multiple root, or where the function is a polynomial.

TEST_ZERO supplies a set of nonlinear functions, along with change of sign interval, first and second derivatives, suggested starting points, so that the behavior of any zero finder can be analyzed.

TEST_ZERO also includes implementations of some simple zero finders, as a demonstration of how the package might be used.

The functions, which are accessible by number, are

1. f(x) = sin ( x ) - x / 2.
2. f(x) = 2 * x - exp ( - x ).
3. f(x) = x * exp ( - x ).
4. f(x) = exp ( x ) - 1 / ( 10 * x )^2.
5. f(x) = ( x + 3 ) * ( x - 1 )^2.
6. f(x) = exp ( x ) - 2 - 1 / ( 10 * x )^2 + 2 / ( 100 * x )^3.
7. f(x) = x^3.
8. f(x) = cos ( x ) - x.
9. the Newton Baffler.
10. the Repeller.
12. Flat Stanley.
13. Lazy Boy.
14. the Camel.
15. a pathological function for Newton's method.
16. Kepler's Equation.
17. f(x) = x^3 - 2*x - 5, Wallis's function.
18. f(x) = (x-1)^7, written term by term.
19. f(x) = cos(100*x)-4*erf(30*x-10), the jumping cosine.

Languages:

TEST_ZERO is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version and a Python version.

Related Data and Programs:

BISECTION_INTEGER, a FORTRAN90 library which seeks an integer solution to the equation F(X)=0, using bisection within a user-supplied change of sign interval [A,B].

BISECTION_RC, a FORTRAN90 library which seeks a solution to the equation F(X)=0 using bisection within a user-supplied change of sign interval [A,B]. The procedure is written using reverse communication.

BRENT, a FORTRAN90 library which contains Richard Brent's routines for finding the zero, local minimizer, or global minimizer of a scalar function of a scalar argument, without the use of derivative information.

NMS, a FORTRAN90 library which includes the zero finder FZERO.

SLATEC, a FORTRAN90 library which includes the zero finder FZERO.

ZERO_RC, a FORTRAN90 library which seeks solutions of a scalar nonlinear equation f(x) = 0, or a system of nonlinear equations, using reverse communication.

ZOOMIN, a FORTRAN90 library which includes various zero finder routines.

Reference:

1. Richard Brent,
Algorithms for Minimization without Derivatives,
Dover, 2002,
ISBN: 0-486-41998-3,
LC: QA402.5.B74.
2. Peter Colwell,
Solving Kepler's Equation Over Three Centuries,
Willmann-Bell, 1993,
ISBN: 0943396409,
LC: QB355.5.C65.
3. George Donovan, Arnold Miller, Timothy Moreland,
Pathological Functions for Newton's Method,
American Mathematical Monthly, January 1993, pages 53-58.
4. Arnold Krommer, Christoph Ueberhuber,
Numerical Integration on Advanced Computer Systems,
Springer, 1994,
ISBN: 3540584102,
LC: QA299.3.K76.
5. Jean Meeus,
Astronomical Algorithms,
Second Edition,
Willman-Bell, 1998,
ISBN: 0943396611,
LC: QB51.3.E43M42.

Examples and Tests:

PNG images of the graphs of some of the functions were made using MATLAB:

List of Routines:

• BISECTION carries out the bisection method to seek a root of F(X) = 0.
• BRENT implements the Brent bisection-based zero finder.
• MULLER carries out Muller's method for seeking a real root of a nonlinear function.
• NEWTON carries out Newton's method to seek a root of F(X) = 0.
• P00_FX evaluates a function specified by problem number.
• P00_FX1 evaluates the first derivative of a function specified by problem number.
• P00_FX2 evaluates the second derivative of a function specified by problem number.
• P00_INTERVAL returns an interval bounding the root for any problem.
• P00_NPROB returns the number of problems available.
• P00_ROOT returns a root for any problem.
• P00_START returns one or more starting points for any problem.
• P00_TITLE returns the title for a given problem.
• P01_FX evaluates sin ( x ) - x / 2.
• P01_FX1 evaluates the derivative of the function for problem 1.
• P01_FX2 evaluates the second derivative of the function for problem 1.
• P01_INTERVAL returns an interval bounding the root for problem 1.
• P01_ROOT returns a root for problem 1.
• P01_START returns one or more starting points for problem 1.
• P01_TITLE returns the title of problem 1.
• P02_FX evaluates 2 * x - exp ( - x ).
• P02_FX1 evaluates the derivative of the function for problem 2.
• P02_FX2 evaluates the second derivative of the function for problem 2.
• P02_INTERVAL returns an interval bounding the root for problem 2.
• P02_ROOT returns a root for problem 2.
• P02_START returns one or more starting points for problem 2.
• P02_TITLE returns the title of problem 2.
• P03_FX evaluates x * exp ( - x ).
• P03_FX1 evaluates the derivative of the function for problem 3.
• P03_FX2 evaluates the second derivative of the function for problem 3.
• P03_INTERVAL returns an interval bounding the root for problem 3.
• P03_ROOT returns a root for problem 3.
• P03_START returns one or more starting points for problem 3.
• P03_TITLE returns the title of problem 3.
• P04_FX evaluates exp ( x ) - 1 / ( 10 * x )^2.
• P04_FX1 evaluates the derivative of the function for problem 4.
• P04_FX2 evaluates the second derivative of the function for problem 4.
• P04_INTERVAL returns an interval bounding the root for problem 4.
• P04_ROOT returns a root for problem 4.
• P04_START returns one or more starting points for problem 4.
• P04_TITLE returns the title of problem 4.
• P05_FX evaluates ( x + 3 ) * ( x - 1 )^2.
• P05_FX1 evaluates the derivative of the function for problem 5.
• P05_FX2 evaluates the second derivative of the function for problem 5.
• P05_INTERVAL returns an interval bounding the root for problem 5.
• P05_ROOT returns a root for problem 5.
• P05_START returns one or more starting points for problem 5.
• P05_TITLE returns the title of problem 5.
• P06_FX evaluates exp ( x ) - 2 - 1 / ( 10 * x )^2 + 2 / ( 100 * x )^3.
• P06_FX1 evaluates the derivative of the function for problem 6.
• P06_FX2 evaluates the second derivative of the function for problem 6.
• P06_INTERVAL returns an interval bounding the root for problem 6.
• P06_ROOT returns a root for problem 6.
• P06_START returns one or more starting points for problem 6.
• P06_TITLE returns the title of problem 6.
• P07_FX evaluates x^3.
• P07_FX1 evaluates the derivative of the function for problem 7.
• P07_FX2 evaluates the second derivative of the function for problem 7.
• P07_INTERVAL returns an interval bounding the root for problem 7.
• P07_ROOT returns a root for problem 7.
• P07_START returns one or more starting points for problem 7.
• P07_TITLE returns the title of problem 7.
• P08_FX evaluates cos ( x ) - x.
• P08_FX1 evaluates the derivative of the function for problem 8.
• P08_FX2 evaluates the second derivative of the function for problem 8.
• P08_INTERVAL returns an interval bounding the root for problem 8.
• P08_ROOT returns a root for problem 8.
• P08_START returns one or more starting points for problem 8.
• P08_TITLE returns the title of problem 8.
• P09_FX evaluates the Newton Baffler.
• P09_FX1 evaluates the derivative of the function for problem 9.
• P09_FX2 evaluates the second derivative of the function for problem 9.
• P09_INTERVAL returns an interval bounding the root for problem 9.
• P09_ROOT returns a root for problem 9.
• P09_START returns one or more starting points for problem 9.
• P09_TITLE returns the title of problem 9.
• P10_FX evaluates the Repeller.
• P10_FX1 evaluates the derivative of the function for problem 10.
• P10_FX2 evaluates the second derivative of the function for problem 10.
• P10_INTERVAL returns an interval bounding the root for problem 10.
• P10_ROOT returns a root for problem 10.
• P10_START returns one or more starting points for problem 10.
• P10_TITLE returns the title of problem 10.
• P11_FX1 evaluates the derivative of the function for problem 11.
• P11_FX2 evaluates the second derivative of the function for problem 11.
• P11_INTERVAL returns an interval bounding the root for problem 11.
• P11_ROOT returns a root for problem 11.
• P11_START returns one or more starting points for problem 11.
• P11_TITLE returns the title of problem 11.
• P12_FX evaluates Flat Stanley.
• P12_FX1 evaluates the derivative of the function for problem 12.
• P12_FX2 evaluates the second derivative of the function for problem 12.
• P12_INTERVAL returns an interval bounding the root for problem 12.
• P12_ROOT returns a root for problem 12.
• P12_START returns one or more starting points for problem 12.
• P12_TITLE returns the title of problem 12.
• P13_FX evaluates Lazy Boy.
• P13_FX1 evaluates the derivative of the function for problem 13.
• P13_FX2 evaluates the second derivative of the function for problem 13.
• P13_INTERVAL returns an interval bounding the root for problem 13.
• P13_ROOT returns a root for problem 13.
• P13_START returns one or more starting points for problem 13.
• P13_TITLE returns the title of problem 13.
• P14_FX evaluates the Camel.
• P14_FX1 evaluates the derivative of the function for problem 14.
• P14_FX2 evaluates the second derivative of the function for problem 14.
• P14_INTERVAL returns an interval bounding the root for problem 14.
• P14_ROOT returns a root for problem 14.
• P14_START returns one or more starting points for problem 14.
• P14_TITLE returns the title of problem 14.
• P15_FX evaluates a pathological function for Newton's method.
• P15_FX1 evaluates the derivative of the function for problem 15.
• P15_FX2 evaluates the second derivative of the function for problem 15.
• P15_INTERVAL returns an interval bounding the root for problem 15.
• P15_ROOT returns a root for problem 15.
• P15_START returns one or more starting points for problem 15.
• P15_TITLE returns the title of problem 15.
• P16_FX evaluates Kepler's Equation.
• P16_FX1 evaluates the derivative of the function for problem 16.
• P16_FX2 evaluates the second derivative of the function for problem 16.
• P16_INTERVAL returns an interval bounding the root for problem 16.
• P16_P sets, gets, or prints the parameter values for problem 16.
• P16_P_GET gets the parameter values for problem 16.
• P16_P_PRINT prints the parameter values for problem 16.
• P16_P_SET sets the parameter values for problem 16.
• P16_ROOT returns a root for problem 16.
• P16_START returns one or more starting points for problem 16.
• P16_TITLE returns the title of problem 16.
• P17_FX evaluates the bogus function (returns random numbers).
• P17_FX1 evaluates the derivative of the function for problem 17.
• P17_FX2 evaluates the second derivative of the function for problem 17.
• P17_INTERVAL returns an interval bounding the root for problem 17.
• P17_ROOT returns a root for problem 17.
• P17_START returns one or more starting points for problem 17.
• P17_TITLE returns the title of problem 17.
• P18_FX evaluates Wallis's function, f(x) = x^3 - 2*x - 5.
• P18_FX1 evaluates the derivative of the function for problem 18.
• P18_FX2 evaluates the second derivative of the function for problem 18.
• P18_INTERVAL returns an interval bounding the root for problem 18.
• P18_ROOT returns a root for problem 18.
• P18_START returns one or more starting points for problem 18.
• P18_TITLE returns the title of problem 18.
• P19_FX evaluates the function for problem P19.
• P19_FX1 evaluates the derivative of the function for problem P19.
• P19_FX2 evaluates the second derivative of the function for problem P19.
• P19_INTERVAL returns an interval bounding the root for problem P19.
• P19_ROOT returns a root for problem P19.
• P19_START returns one or more starting points for problem P19.
• P19_TITLE returns the title of problem P19.
• R8_CUBE_ROOT returns the cube root of a real number.
• R8_SWAP switches two R8's.
• R8POLY2_RROOT returns the real parts of the roots of a quadratic polynomial.
• REGULA_FALSI carries out the Regula Falsi method to seek a root of F(X) = 0.
• SECANT carries out the secant method to seek a root of F(X) = 0.
• TIMESTAMP prints the current YMDHMS date as a time stamp.

You can go up one level to the FORTRAN90 source codes.

Last revised on 14 January 2013.