TEST_ZERO
Zero Finder Tests
TEST_ZERO
is a Python 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 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) = (x-1)^7, written term by term.
-
f(x) = cos(100*x)-4*erf(30*x-10)
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 FORTRAN90 version and
a MATLAB version and
a Python version.
Related Data and Programs:
BISECTION_RC,
a Python 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 (RC).
ZERO_RC,
a Python 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 53-58.
-
Peter Colwell,
Solving Kepler's Equation Over Three Centuries,
Willmann-Bell, 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:
-
p00.py,
returns information for any problem, given its index.
-
p01.py,
returns information for problem 01.
-
p02.py,
returns information for problem 02.
-
p03.py,
returns information for problem 03.
-
p04.py,
returns information for problem 04.
-
p05.py,
returns information for problem 05.
-
p06.py,
returns information for problem 06.
-
p07.py,
returns information for problem 07.
-
p08.py,
returns information for problem 08.
-
p09.py,
returns information for problem 09.
-
p10.py,
returns information for problem 10.
-
p11.py,
returns information for problem 11.
-
p12.py,
returns information for problem 12.
-
p13.py,
returns information for problem 13.
-
p14.py,
returns information for problem 14.
-
p15.py,
returns information for problem 15.
-
p16.py,
returns information for problem 16.
-
p17.py,
returns information for problem 17.
1 -
p18.py,
returns information for problem 18.
-
p19.py,
returns information for problem 19.
Methods and utility functions:
-
bisection.py,
carries out the bisection method on any problem.
-
brent.py,
carries out Brent's method on any problem.
-
muller.py,
carries out Muller's method on any problem.
-
newton.py,
carries out Newton's method on any problem.
-
r8_cube_root.py,
computes the cube root of an R8.
-
r8_sign.py,
returns the sign of an R8.
-
r8poly2_rroot.py,
returns the real parts of the roots of a quadratic polynomial.
-
regula_falsi.py,
carries out the regula falsi method on any problem.
-
secant.py,
carries out the secant method on any problem.
-
timestamp.py,
prints the YMDHMS date as a timestamp.
-
test_zero.py,
tests the library.
-
test_zero.sh,
runs all the tests.
-
test_zero.txt,
the output file.
You can go up one level to
the Python source codes.
Last revised on 02 December 2016.