TEST_ZERO
Zero Finder Tests
TEST_ZERO
is a MATLAB library which
defines a number of nonlinear functions.
The nonlinear functions are intended for use in demonstrating or
testing zero finder algorithms, that is, programs that seek a
root of a scalar equation F(X)=0.
The MATLAB function TEST_ZERO evaluates one of several scalar
nonlinear test functions, and has the form:
function [ fx, fp ] = test_zero ( x )
To make use of this function while running MATLAB, you must issue
the command
global IPROB
and then set IPROB to a value between 1 and 18 to select a
particular problem.
The functions, which are accessible by number, are

f(x) = sin ( x )  x / 2.

f(x) = 2 * x  exp (  x ).

f(x) = x * exp (  x ).

f(x) = exp ( x )  1 / ( 10 * x )^2.

f(x) = ( x + 3 ) * ( x  1 )^2.

f(x) = exp ( x )  2  1 / ( 10 * x )^2 + 2 / ( 100 * x )^3.

f(x) = x^3.

f(x) = cos ( x )  x.

the Newton Baffler.

the Repeller.

the Pinhead.

Flat Stanley.

Lazy Boy.

the Camel.

a pathological function for Newton's method.

Kepler's Equation.

f(x) = x^3  2*x  5, Wallis's function.

f(x) = (x1)^7, written term by term.

f(x) = cos(100*x)4*erf(30*x10)
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
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 MATLAB library which
seeks an integer solution to the equation F(X)=0,
using bisection within a usersupplied change of sign interval [A,B].
BISECTION_RC,
a MATLAB library which
seeks a solution to the equation F(X)=0 using bisection
within a usersupplied change of sign interval [A,B].
The procedure is written using reverse communication.
BRENT,
a MATLAB 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.
ZERO_RC,
a MATLAB library which
seeks solutions of a scalar nonlinear equation f(x) = 0,
or a system of nonlinear equations,
using reverse communication.
Reference:

George Donovan, Arnold Miller, Timothy Moreland,
Pathological Functions for Newton's Method,
American Mathematical Monthly, January 1993, pages 5358.

Peter Colwell,
Solving Kepler's Equation Over Three Centuries,
WillmannBell, 1993

Arnold Krommer, Christoph Ueberhuber,
Numerical Integration on Advanced Systems,
Springer, 1994.
PNG images of the graphs of some of the functions were made using MATLAB:

p01_fx.png,
an image of P01_FX(X) over [4,+4].

p02_fx.png,
an image of P02_FX(X) over [0.5, +3.0].

p03_fx.png,
an image of P03_FX(X) over [0.1,+4].

p04_fx.png,
an image of P04_FX(X) over [4,+2].

p05_fx.png,
an image of P05_FX(X) over [4,+2].

p06_fx.png,
an image of P06_FX(X) over [4,+2].

p07_fx.png,
an image of P07_FX(X) over [1,+1].

p08_fx.png,
an image of P08_FX(X) over [4,+4].

p09_fx.png,
an image of P09_FX(X) over [5,7].

p10_fx.png,
an image of P10_FX(X) over [2,+2].

p11_fx.png,
an image of P11_FX(X) over [+1,+10].

p12_fx.png,
an image of P12_FX(X) over [0.5,+0.5].

p13_fx.png,
an image of P13_FX(X) over [0,100].

p14_fx.png,
an image of P14_FX(X) over [0.5,+2.0].

p15_fx.png,
an image of P15_FX(X) over [4,+4].

p16_fx.png,
an image of P16_FX(X) over [0,50].

p17_fx.png,
an image of P17_FX(X) over [2,+4].

p18_fx.png,
an image of P18_FX(X) over [0.988,1.012].

p19_fx.png,
an image of P19_FX(X) over [0.0,1.0].
Source Code:

bisection.m,
carries out the bisection method on any problem.

brent.m,
carries out Brent's method on any problem.

muller.m,
carries out Muller's method on any problem.

newton.m,
carries out Newton's method on any problem.

p00_fx.m,
evaluates a function for any problem.

p00_fx1.m,
first derivative of a function for any problem.

p00_fx2.m,
second derivative of a function for any problem.

p00_prob_num.m,
returns the number of problems.

p00_range.m,
returns an interval bounding the root for any problem.

p00_root.m,
returns a known root for any problem.

p00_root_num.m,
returns the number of known roots for any problem.

p00_start.m,
returns a starting point for any problem.

p00_start_num.m,
returns the number of starting points for any problem.

p00_title.m,
returns the title for any problem.

p01_fx.m,
evaluates the function for problem 1.

p01_fx1.m,
first derivative of the function for problem 1.

p01_fx2.m,
second derivative of the function for problem 1.

p01_range.m,
returns an interval bounding the root for problem 1.

p01_root.m,
returns a known root for problem 1.

p01_root_num.m,
returns the number of known roots for problem 1.

p01_start.m,
returns a starting point for problem 1.

p01_start_num.m,
returns the number of starting points for problem 1.

p01_title.m,
returns the title for problem 1.

p02_fx.m,
evaluates the function for problem 2.

p02_fx1.m,
first derivative of the function for problem 2.

p02_fx2.m,
second derivative of the function for problem 2.

p02_range.m,
returns an interval bounding the root for problem 2.

p02_root.m,
returns a known root for problem 2.

p02_root_num.m,
returns the number of known roots for problem 2.

p02_start.m,
returns a starting point for problem 2.

p02_start_num.m,
returns the number of starting points for problem 2.

p02_title.m,
returns the title for problem 2.

p03_fx.m,
evaluates the function for problem 3.

p03_fx1.m,
first derivative of the function for problem 3.

p03_fx2.m,
second derivative of the function for problem 3.

p03_range.m,
returns an interval bounding the root for problem 3.

p03_root.m,
returns a known root for problem 3.

p03_root_num.m,
returns the number of known roots for problem 3.

p03_start.m,
returns a starting point for problem 3.

p03_start_num.m,
returns the number of starting points for problem 3.

p03_title.m,
returns the title for problem 3.

p04_fx.m,
evaluates the function for problem 4.

p04_fx1.m,
first derivative of the function for problem 4.

p04_fx2.m,
second derivative of the function for problem 4.

p04_range.m,
returns an interval bounding the root for problem 4.

p04_root.m,
returns a known root for problem 4.

p04_root_num.m,
returns the number of known roots for problem 4.

p04_start.m,
returns a starting point for problem 4.

p04_start_num.m,
returns the number of starting points for problem 4.

p04_title.m,
returns the title for problem 4.

p05_fx.m,
evaluates the function for problem 5.

p05_fx1.m,
first derivative of the function for problem 5.

p05_fx2.m,
second derivative of the function for problem 5.

p05_range.m,
returns an interval bounding the root for problem 5.

p05_root.m,
returns a known root for problem 5.

p05_root_num.m,
returns the number of known roots for problem 5.

p05_start.m,
returns a starting point for problem 5.

p05_start_num.m,
returns the number of starting points for problem 5.

p05_title.m,
returns the title for problem 5.

p06_fx.m,
evaluates the function for problem 6.

p06_fx1.m,
first derivative of the function for problem 6.

p06_fx2.m,
second derivative of the function for problem 6.

p06_range.m,
returns an interval bounding the root for problem 6.

p06_root.m,
returns a known root for problem 6.

p06_root_num.m,
returns the number of known roots for problem 6.

p06_start.m,
returns a starting point for problem 6.

p06_start_num.m,
returns the number of starting points for problem 6.

p06_title.m,
returns the title for problem 6.

p07_fx.m,
evaluates the function for problem 7.

p07_fx1.m,
first derivative of the function for problem 7.

p07_fx2.m,
second derivative of the function for problem 7.

p07_range.m,
returns an interval bounding the root for problem 7.

p07_root.m,
returns a known root for problem 7.

p07_root_num.m,
returns the number of known roots for problem 7.

p07_start.m,
returns a starting point for problem 7.

p07_start_num.m,
returns the number of starting points for problem 7.

p07_title.m,
returns the title for problem 7.

p08_fx.m,
evaluates the function for problem 8.

p08_fx1.m,
first derivative of the function for problem 8.

p08_fx2.m,
second derivative of the function for problem 8.

p08_range.m,
returns an interval bounding the root for problem 8.

p08_root.m,
returns a known root for problem 8.

p08_root_num.m,
returns the number of known roots for problem 8.

p08_start.m,
returns a starting point for problem 8.

p08_start_num.m,
returns the number of starting points for problem 8.

p08_title.m,
returns the title for problem 8.

p09_fx.m,
evaluates the function for problem 9.

p09_fx1.m,
first derivative of the function for problem 9.

p09_fx2.m,
second derivative of the function for problem 9.

p09_range.m,
returns an interval bounding the root for problem 9.

p09_root.m,
returns a known root for problem 9.

p09_root_num.m,
returns the number of known roots for problem 9.

p09_start.m,
returns a starting point for problem 9.

p09_start_num.m,
returns the number of starting points for problem 9.

p09_title.m,
returns the title for problem 9.

p10_fx.m,
evaluates the function for problem 10.

p10_fx1.m,
first derivative of the function for problem 10.

p10_fx2.m,
second derivative of the function for problem 10.

p10_range.m,
returns an interval bounding the root for problem 10.

p10_root.m,
returns a known root for problem 10.

p10_root_num.m,
returns the number of known roots for problem 10.

p10_start.m,
returns a starting point for problem 10.

p10_start_num.m,
returns the number of starting points for problem 10.

p10_title.m,
returns the title for problem 10.

p11_fx.m,
evaluates the function for problem 11.

p11_fx1.m,
first derivative of the function for problem 11.

p11_fx2.m,
second derivative of the function for problem 11.

p11_range.m,
returns an interval bounding the root for problem 11.

p11_root.m,
returns a known root for problem 11.

p11_root_num.m,
returns the number of known roots for problem 11.

p11_start.m,
returns a starting point for problem 10.

p11_start_num.m,
returns the number of starting points for problem 11.

p11_title.m,
returns the title for problem 11.

p12_fx.m,
evaluates the function for problem 12.

p12_fx1.m,
first derivative of the function for problem 12.

p12_fx2.m,
second derivative of the function for problem 12.

p12_range.m,
returns an interval bounding the root for problem 12.

p12_root.m,
returns a known root for problem 12.

p12_root_num.m,
returns the number of known roots for problem 12.

p12_start.m,
returns a starting point for problem 10.

p12_start_num.m,
returns the number of starting points for problem 12.

p12_title.m,
returns the title for problem 12.

p13_fx.m,
evaluates the function for problem 13.

p13_fx1.m,
first derivative of the function for problem 13.

p13_fx2.m,
second derivative of the function for problem 13.

p13_range.m,
returns an interval bounding the root for problem 13.

p13_root.m,
returns a known root for problem 13.

p13_root_num.m,
returns the number of known roots for problem 13.

p13_start.m,
returns a starting point for problem 10.

p13_start_num.m,
returns the number of starting points for problem 13.

p13_title.m,
returns the title for problem 13.

p14_fx.m,
evaluates the function for problem 14.

p14_fx1.m,
first derivative of the function for problem 14.

p14_fx2.m,
second derivative of the function for problem 14.

p14_range.m,
returns an interval bounding the root for problem 14.

p14_root.m,
returns a known root for problem 14.

p14_root_num.m,
returns the number of known roots for problem 14.

p14_start.m,
returns a starting point for problem 14.

p14_start_num.m,
returns the number of starting points for problem 14.

p14_title.m,
returns the title for problem 14.

p15_fx.m,
evaluates the function for problem 15.

p15_fx1.m,
first derivative of the function for problem 15.

p15_fx2.m,
second derivative of the function for problem 15.

p15_range.m,
returns an interval bounding the root for problem 15.

p15_root.m,
returns a known root for problem 15.

p15_root_num.m,
returns the number of known roots for problem 15.

p15_start.m,
returns a starting point for problem 15.

p15_start_num.m,
returns the number of starting points for problem 15.

p15_title.m,
returns the title for problem 15.

p16_fx.m,
evaluates the function for problem 16.

p16_fx1.m,
first derivative of the function for problem 16.

p16_fx2.m,
second derivative of the function for problem 16.

p16_range.m,
returns an interval bounding the root for problem 16.

p16_root.m,
returns a known root for problem 16.

p16_root_num.m,
returns the number of known roots for problem 160.

p16_start.m,
returns a starting point for problem 16.

p16_start_num.m,
returns the number of starting points for problem 16.

p16_title.m,
returns the title for problem 16.

p17_fx.m,
evaluates the function for problem 17.

p17_fx1.m,
first derivative of the function for problem 17.

p17_fx2.m,
second derivative of the function for problem 17.

p17_range.m,
returns an interval bounding the root for problem 17.

p17_root.m,
returns a known root for problem 17.

p17_root_num.m,
returns the number of known roots for problem 17.

p17_start.m,
returns a starting point for problem 17.

p17_start_num.m,
returns the number of starting points for problem 17.

p17_title.m,
returns the title for problem 17.

p18_fx.m,
evaluates the function for problem 18.

p18_fx1.m,
first derivative of the function for problem 18.

p18_fx2.m,
second derivative of the function for problem 18.

p18_range.m,
returns an interval bounding the root for problem 18.

p18_root.m,
returns a known root for problem 18.

p18_root_num.m,
returns the number of known roots for problem 18.

p18_start.m,
returns a starting point for problem 18.

p18_start_num.m,
returns the number of starting points for problem 18.

p18_title.m,
returns the title for problem 18.

p19_fx.m,
evaluates the function for problem P19.

p19_fx1.m,
first derivative of the function for problem P19.

p19_fx2.m,
second derivative of the function for problem P19.

p19_range.m,
returns an interval bounding the root for problem P19.

p19_root.m,
returns a known root for problem P19.

p19_root_num.m,
returns the number of known roots for problem P19.

p19_start.m,
returns a starting point for problem P19.

p19_start_num.m,
returns the number of starting points for problem P19.

p19_title.m,
returns the title for problem P19.

r8_cube_root.m,
computes the cube root of an R8.

r8_sign.m,
returns the sign of an R8.

r8poly2_rroot.m,
returns the real parts of the roots of a quadratic polynomial.

regula_falsi.m,
carries out the regula falsi method on any problem.

secant.m,
carries out the secant method on any problem.

timestamp.m,
prints the YMDHMS date as a timestamp.
Examples and Tests:
You can go up one level to
the MATLAB source codes.
Last revised on 15 January 2013.