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.
  11. the Pinhead.
  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.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


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.


  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.

Source Code:

Examples and Tests:

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

List of Routines:

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

Last revised on 14 January 2013.