# TEST_ZERO Zero Finder Tests

TEST_ZERO, an Octave code 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 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

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)

### Licensing:

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

### Languages:

test_zero is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and an Octave version and a Python version.

### Related Data and Programs:

fsolve_test, an Octave code which calls fsolve() which seeks the solution x of one or more nonlinear equations f(x)=0.

### Reference:

1. George Donovan, Arnold Miller, Timothy Moreland,
Pathological Functions for Newton's Method,
American Mathematical Monthly, January 1993, pages 53-58.
2. Peter Colwell,
Solving Kepler's Equation Over Three Centuries,
Willmann-Bell, 1993
3. Arnold Krommer, Christoph Ueberhuber,
Numerical Integration on Advanced Systems,
Springer, 1994.

### 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.

Last revised on 10 October 2020.