root finding subroutines More...

Data Types

type  roots_typ
 basic type for root finding functions More...
 

Functions/Subroutines

pure subroutine, public initroots (this, x1, x2, f1, f2, dxacc, maxiter)
 
character(len=64) function, public geterrormessage (error)
 
subroutine getroot_generic (this, Stepper, func, x1, x2, dxacc, maxiter, plist, xm)
 
subroutine, public getroot_newton (funcd, x1, x2, root, error, plist, xm, iterations)
 
subroutine, public getroot_regulafalsi (func, x1, x2, root, error, plist, xm, iterations)
 
subroutine, public getroot_pegasus (func, x1, x2, root, error, plist, xm, iterations)
 
subroutine, public getroot_king (func, x1, x2, root, error, plist, xm, iterations)
 
subroutine, public getroot_andersonbjoerk (func, x1, x2, root, error, plist, xm, iterations)
 
subroutine, public getroot_ridder (func, x1, x2, root, error, plist, xm, iterations)
 
subroutine, public getroot_brentdekker (func, x1, x2, root, error, plist, xm, iterations)
 
subroutine, public getroot_bisection (func, x1, x2, root, error, plist, xm, iterations)
 
pure subroutine updatebounds_bisection (this)
 
pure subroutine step_bisection (this)
 
pure subroutine step_newton (this)
 
pure subroutine step_regulafalsi (this)
 
pure subroutine step_pegasus (this)
 
pure subroutine step_king (this)
 
pure subroutine step_andersonbjoerk (this)
 
pure subroutine step_ridder (this)
 
pure subroutine step_brentdekker (this)
 
pure subroutine step_secantmethod (this)
 
pure subroutine saveinversequadraticinterpolation (a, b, c, fa, fb, fc, db_numer, db_denom)
 
pure subroutine step_arithmeticmean (this)
 
pure real function arithmeticmean (a, b)
 
pure real function linearinterpolation (x1, x2, f1, f2)
 
pure subroutine testconvergence (this)
 

Variables

integer, parameter, public default_max_iterations = 1000
 
real, parameter, public default_accuracy = 4*EPSILON(DEFAULT_ACCURACY)
 
character(len=64), dimension(0:4), parameter error_message = (/ "unknown error ", "root not bracketed ", "iteration exceeds maximum ", "requested accuracy smaller than machine precission ", "upper limit for iterations should be larger than 1 " /)
 

Detailed Description

root finding subroutines

Author
Tobias Illenseer
  1. Newton's method combined with bisection, for ill-posed problems
  2. Regula falsi
  3. Bisection
  4. Pegasus
  5. King
  6. Anderson Bjoerk
  7. Ridder
  8. Brent Dekker (default)

The algorithms can be found in standard textbooks on numerical analysis. See e. g. [41] and [13] and references therein.

Function/Subroutine Documentation

◆ arithmeticmean()

pure real function roots::arithmeticmean ( real, intent(in)  a,
real, intent(in)  b 
)
private

Definition at line 886 of file roots.f90.

Here is the caller graph for this function:

◆ geterrormessage()

character(len=64) function, public roots::geterrormessage ( integer, intent(in)  error)

Definition at line 159 of file roots.f90.

Here is the caller graph for this function:

◆ getroot_andersonbjoerk()

subroutine, public roots::getroot_andersonbjoerk (   func,
real, intent(in)  x1,
real, intent(in)  x2,
real, intent(out)  root,
integer, intent(out)  error,
real, dimension(:), intent(in), optional  plist,
real, intent(in), optional  xm,
integer, intent(out), optional  iterations 
)

Definition at line 416 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getroot_bisection()

subroutine, public roots::getroot_bisection (   func,
real, intent(in)  x1,
real, intent(in)  x2,
real, intent(out)  root,
integer, intent(out)  error,
real, dimension(:), intent(in), optional  plist,
real, intent(in), optional  xm,
integer, intent(out), optional  iterations 
)

Definition at line 518 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getroot_brentdekker()

subroutine, public roots::getroot_brentdekker (   func,
real, intent(in)  x1,
real, intent(in)  x2,
real, intent(out)  root,
integer, intent(out)  error,
real, dimension(:), intent(in), optional  plist,
real, intent(in), optional  xm,
integer, intent(out), optional  iterations 
)

Definition at line 484 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getroot_generic()

subroutine roots::getroot_generic ( type(roots_typ), intent(inout)  this,
  Stepper,
  func,
real, intent(in)  x1,
real, intent(in)  x2,
real, intent(in), optional  dxacc,
integer, intent(in), optional  maxiter,
real, dimension(:), intent(in), optional  plist,
real, intent(in), optional  xm 
)
private

Definition at line 177 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getroot_king()

subroutine, public roots::getroot_king (   func,
real, intent(in)  x1,
real, intent(in)  x2,
real, intent(out)  root,
integer, intent(out)  error,
real, dimension(:), intent(in), optional  plist,
real, intent(in), optional  xm,
integer, intent(out), optional  iterations 
)

Definition at line 382 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getroot_newton()

subroutine, public roots::getroot_newton (   funcd,
real, intent(in)  x1,
real, intent(in)  x2,
real, intent(out)  root,
integer, intent(out)  error,
real, dimension(:), intent(in), optional  plist,
real, intent(in), optional  xm,
integer, intent(out), optional  iterations 
)

Definition at line 246 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getroot_pegasus()

subroutine, public roots::getroot_pegasus (   func,
real, intent(in)  x1,
real, intent(in)  x2,
real, intent(out)  root,
integer, intent(out)  error,
real, dimension(:), intent(in), optional  plist,
real, intent(in), optional  xm,
integer, intent(out), optional  iterations 
)

Definition at line 348 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getroot_regulafalsi()

subroutine, public roots::getroot_regulafalsi (   func,
real, intent(in)  x1,
real, intent(in)  x2,
real, intent(out)  root,
integer, intent(out)  error,
real, dimension(:), intent(in), optional  plist,
real, intent(in), optional  xm,
integer, intent(out), optional  iterations 
)

Definition at line 314 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getroot_ridder()

subroutine, public roots::getroot_ridder (   func,
real, intent(in)  x1,
real, intent(in)  x2,
real, intent(out)  root,
integer, intent(out)  error,
real, dimension(:), intent(in), optional  plist,
real, intent(in), optional  xm,
integer, intent(out), optional  iterations 
)

Definition at line 450 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initroots()

pure subroutine, public roots::initroots ( type(roots_typ), intent(inout)  this,
real, intent(in)  x1,
real, intent(in)  x2,
real, intent(in)  f1,
real, intent(in)  f2,
real, intent(in), optional  dxacc,
integer, intent(in), optional  maxiter 
)

Definition at line 97 of file roots.f90.

Here is the caller graph for this function:

◆ linearinterpolation()

pure real function roots::linearinterpolation ( real, intent(in)  x1,
real, intent(in)  x2,
real, intent(in)  f1,
real, intent(in)  f2 
)
private

Definition at line 896 of file roots.f90.

Here is the caller graph for this function:

◆ saveinversequadraticinterpolation()

pure subroutine roots::saveinversequadraticinterpolation ( real, intent(in)  a,
real, intent(in)  b,
real, intent(in)  c,
real, intent(in)  fa,
real, intent(in)  fb,
real, intent(in)  fc,
real, intent(out)  db_numer,
real, intent(out)  db_denom 
)
private

Definition at line 841 of file roots.f90.

Here is the caller graph for this function:

◆ step_andersonbjoerk()

pure subroutine roots::step_andersonbjoerk ( type(roots_typ), intent(inout)  this)
private

Definition at line 690 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ step_arithmeticmean()

pure subroutine roots::step_arithmeticmean ( type(roots_typ), intent(inout)  this)
private

Definition at line 873 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ step_bisection()

pure subroutine roots::step_bisection ( type(roots_typ), intent(inout)  this)
private

Definition at line 567 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ step_brentdekker()

pure subroutine roots::step_brentdekker ( type(roots_typ), intent(inout)  this)
private

Definition at line 747 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ step_king()

pure subroutine roots::step_king ( type(roots_typ), intent(inout)  this)
private

Definition at line 642 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ step_newton()

pure subroutine roots::step_newton ( type(roots_typ), intent(inout)  this)
private

Definition at line 577 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ step_pegasus()

pure subroutine roots::step_pegasus ( type(roots_typ), intent(inout)  this)
private

Definition at line 617 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ step_regulafalsi()

pure subroutine roots::step_regulafalsi ( type(roots_typ), intent(inout)  this)
private

Definition at line 603 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ step_ridder()

pure subroutine roots::step_ridder ( type(roots_typ), intent(inout)  this)
private

Definition at line 716 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ step_secantmethod()

pure subroutine roots::step_secantmethod ( type(roots_typ), intent(inout)  this)
private

Definition at line 810 of file roots.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ testconvergence()

pure subroutine roots::testconvergence ( type(roots_typ), intent(inout)  this)
private

Definition at line 906 of file roots.f90.

Here is the caller graph for this function:

◆ updatebounds_bisection()

pure subroutine roots::updatebounds_bisection ( type(roots_typ), intent(inout)  this)
private

Definition at line 549 of file roots.f90.

Here is the caller graph for this function:

Variable Documentation

◆ default_accuracy

real, parameter, public roots::default_accuracy = 4*EPSILON(DEFAULT_ACCURACY)

Definition at line 67 of file roots.f90.

◆ default_max_iterations

integer, parameter, public roots::default_max_iterations = 1000

Definition at line 66 of file roots.f90.

◆ error_message

character(len=64), dimension(0:4), parameter roots::error_message = (/ "unknown error ", "root not bracketed ", "iteration exceeds maximum ", "requested accuracy smaller than machine precission ", "upper limit for iterations should be larger than 1 " /)
private

Definition at line 68 of file roots.f90.