|
◆ dfzero_r()
void dfzero_r |
( |
double * |
b, |
|
|
double * |
c, |
|
|
double |
r, |
|
|
double |
re, |
|
|
double |
ae, |
|
|
int * |
info, |
|
|
double * |
xx, |
|
|
double |
yy, |
|
|
int * |
irev |
|
) |
| |
Solution of a single general nonlinear equation (reverse communication version)
- Purpose
- dfzero_r searches for a zero of a function f(x) between the given values b and c until the width of the interval [b, c] has collapsed to within a tolerance specified by the stopping criterion, abs(b - c) <= 2*(re*abs(b) + ae).
It is designed primarily for problems where f(b) and f(c) have opposite signs. The method used is an efficient combination of bisection and the secant rule.
- Parameters
-
[in,out] | b | [in] Lower endpoint of the initial interval.
[out] Lower endpoint of the final interval (the approximation to a zero). |
[in,out] | c | [in] Upper endpoint of the initial interval.
[out] Upper endpoint of the final interval. |
[in] | r | A (better) guess of a zero of f which could help in speeding up convergence. When no better guess is known, it is recommended that r be set to b or c. |
[in] | re | Relative error used for the stopping criterion. If the requested re is less than machine precision, then it is set to approximately machine precision. |
[in] | ae | Absolute error used in the stopping criterion. If the given interval [b, c] contains the origin, then a nonzero value should be chosen for ae. |
[out] | info | = 0: Normal return
= 1: f(x) = 0, however the interval may not have collapsed to the requested tolerance
= 2: b may be near a singular point of f(x)
= 3: No change in sign of f(x) was found although the interval
= 4: Too many (> 500) function evaluations used |
[out] | xx | When returned with irev=1 to 4, xx contains the abscissa where the function value shoule be evaluated and given in the next call. |
[in] | yy | When returned with irev = 1 to 4, the function value f(xx) should be given in yy in the next call. |
[in,out] | irev | Control variable for reverse communication.
[in] Before first call, irev should be initialized to zero. On succeeding calls, irev should not be altered.
[out] If irev is not zero, complete the following process and call this routine again.
= 0: Computation finished. See return code in info.
= 1 to 4: User should set the function value at xx (f(xx)) in yy. Do not alter any variables other than yy. |
- Reference
- D. Kahaner, C. Moler, S. Nash, "Numerical Methods and Software", Prentice-Hall (1989)
|