![]() |
libSUFR
a LIBrary of Some Useful Fortran Routines
|
Procedures to solve equations. More...
Functions/Subroutines | |
real(double) function | root_solver (func, x1, x2, accur, status, verbose) |
Using Brent's method, find the root of a function func that lies between x1 and x2. | |
real(double) function | minimum_solver (func, ax, bx, cx, accur, xmin, status, verbose) |
Use Brent's method and parabolic interpolation to find the minimum of function func that lies between xa and xc. | |
Procedures to solve equations.
real(double) function sufr_solvers::minimum_solver | ( | real(double), external | func, |
real(double), intent(in) | ax, | ||
real(double), intent(in) | bx, | ||
real(double), intent(in) | cx, | ||
real(double), intent(in) | accur, | ||
real(double), intent(out) | xmin, | ||
integer, intent(out), optional | status, | ||
integer, intent(in), optional | verbose ) |
Use Brent's method and parabolic interpolation to find the minimum of function func that lies between xa and xc.
func | The function of which the minimum is to be found |
ax | The lower limit for the x-value of the minimum: xa < x_min < xc |
bx | A good guess for the x-value of the minimum: xa < xb < xc and func(xb) < min(funx(xa),func(xc)) |
cx | The upper limit for the x-value of the minimum: xa < x_min < xc |
accur | Relative accuracy with which the minimum is to be found |
xmin | X-value of the minimum (output) |
status | Status: 0-ok, 1-maximum number of iterations exceeded (output, optional) |
verbose | Verbosity: 0-print nothing, 1-print errors, 2-print warnings, 3-print info (output, optional argument, default=2) |
minimum_solver | The value of the minimum of the function func, to accuracy accur |
Definition at line 183 of file solvers.f90.
References sufr_kinds::dbl, sufr_numerics::deq(), sufr_kinds::double, golden_section(), and minimum_solver().
Referenced by minimum_solver().
real(double) function sufr_solvers::root_solver | ( | real(double), external | func, |
real(double), intent(in) | x1, | ||
real(double), intent(in) | x2, | ||
real(double), intent(in) | accur, | ||
integer, intent(out), optional | status, | ||
integer, intent(in), optional | verbose ) |
Using Brent's method, find the root of a function func that lies between x1 and x2.
func | Function to find the root of |
x1 | Lower limit in x for root: x1 < root < x2; func(x1) and func(x2) must be positive and negative or vice versa |
x2 | Upper limit in x for root: x1 < root < x2; func(x1) and func(x2) must be positive and negative or vice versa |
accur | The accuracy with which the root is to be determined |
status | Status: 0-ok, 1-maximum number of iterations exceeded, 2-root not bracketed (output, optional) |
verbose | Verbosity: 0-print nothing, 1-print errors, 2-print warnings, 3-print info (output, optional, default=2) |
root_solver | The value of the root of func, between x1 and x2 and with accuracy accur. If a root was not bracketed by (output) x1 and x2, -huge is returned and status=1. |
Definition at line 45 of file solvers.f90.
References sufr_kinds::dbl, sufr_numerics::deq(), sufr_kinds::double, and root_solver().
Referenced by root_solver().