Brent algorithms for minimization and root solving without derivatives.
Interface to the function to be minimized. It should evaluate f(x) for any x in the interval (ax,bx)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(brent_class), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in) | :: | x |
An approximation x to the point where f attains a minimum on the interval (ax,bx) is determined.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(brent_class), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in) | :: | ax |
left endpoint of initial interval |
||
real(kind=wp), | intent(in) | :: | bx |
right endpoint of initial interval |
||
real(kind=wp), | intent(in) | :: | tol |
desired length of the interval of uncertainty of the final result (>=0) |
abcissa approximating the point where f attains a minimum
Set the function to be minimized.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(brent_class), | intent(inout) | :: | me | |||
procedure(func) | :: | f |
Find a zero of the function f(x) in the given interval [ax,bx] to within a tolerance 4ϵ|x|+tol, where ϵ is the relative machine precision defined as the smallest representable number such that 1.0+ϵ>1.0.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(brent_class), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in) | :: | ax |
left endpoint of initial interval |
||
real(kind=wp), | intent(in) | :: | bx |
right endpoint of initial interval |
||
real(kind=wp), | intent(in) | :: | tol |
desired length of the interval of uncertainty of the final result (>=0) |
||
real(kind=wp), | intent(out) | :: | xzero |
abscissa approximating a zero of |
||
real(kind=wp), | intent(out) | :: | fzero |
value of |
||
integer, | intent(out) | :: | iflag |
status flag ( |
||
real(kind=wp), | intent(in), | optional | :: | fax |
if |
|
real(kind=wp), | intent(in), | optional | :: | fbx |
if |