c05axc uses a modified version of an algorithm given in
Swift and Lindfield (1978) to compute a zero
of a continuous function
. The algorithm used is based on a continuation method in which a sequence of problems
are solved, where
(the value of
is determined as the algorithm proceeds) and where
is your initial estimate for the zero of
. For each
the current problem is solved by a robust secant iteration using the solution from earlier problems to compute an initial estimate.
You must supply an error tolerance
tol.
tol is used directly to control the accuracy of solution of the final problem (
)
in the continuation method, and
is used to control the accuracy in the intermediate problems
(
).
Swift A and Lindfield G R (1978) Comparison of a continuation method for the numerical solution of a single nonlinear equation Comput. J. 21 359–362
Note: this function uses
reverse communication. Its use involves an initial entry, intermediate exits and re-entries, and a final exit, as indicated by the argument
ind. Between intermediate exits and re-entries,
all arguments other than fx must remain unchanged.
-
1:
– double *
Input/Output
-
On initial entry: an initial approximation to the zero.
On intermediate exit:
the point at which must be evaluated before re-entry to the function.
On final exit: the final approximation to the zero.
-
2:
– double
Input
-
On initial entry: if
,
fx need not be set.
If
,
fx must contain
for the initial value of
x.
On intermediate re-entry: must contain
for the current value of
x.
-
3:
– double
Input
-
On initial entry: a value that controls the accuracy to which the zero is determined.
tol is used in determining the convergence of the secant iteration used at each stage of the continuation process. It is used directly when solving the last problem (
in
Section 3), and
is used for the problem defined by
,
. Convergence to the accuracy specified by
tol is not guaranteed, and so you are recommended to find the zero using at least two values for
tol to check the accuracy obtained.
Constraint:
.
-
4:
– Nag_ErrorControl
Input
-
On initial entry: indicates the type of error test required, as follows. Solving the problem defined by
,
, involves computing a sequence of secant iterates
. This sequence will be considered to have converged only if:
for
,
for
,
for
,
for some
; here
is either
tol or
as discussed above. Note that there are other subsidiary conditions (not given here) which must also be satisfied before the secant iteration is considered to have converged.
Constraint:
, or .
-
5:
– double
Input
-
On initial entry: a factor for use in determining a significant approximation to the derivative of
at
, the initial value. A number of difference approximations to
are calculated using
where
and
has the same sign as
scal. A significance (cancellation) check is made on each difference approximation and the approximation is rejected if insignificant.
Suggested value:
, where
is the
machine precision returned by
X02AJC.
Constraint:
must be sufficiently large that on the computer.
-
6:
– double
Communication Array
-
( contains the current , this value may be useful in the event of an error exit.)
-
7:
– Integer *
Input/Output
-
On initial entry: must be set to
or
.
- fx need not be set.
- fx must contain .
On intermediate exit:
contains
,
or
. The calling program must evaluate
at
x, storing the result in
fx, and re-enter
c05axc with all other arguments unchanged.
On final exit: contains .
Constraint:
on entry , , , or .
Note: any values you return to c05axc as part of the reverse communication procedure should not include floating-point NaN (Not a Number) or infinity values, since these are not handled by c05axc. If your code inadvertently does return any NaNs or infinities, c05axc is likely to produce unexpected results.
-
8:
– NagError *
Input/Output
-
The NAG error argument (see
Section 7 in the Introduction to the NAG Library CL Interface).
The accuracy of the approximation to the zero depends on
tol and
ir. In general decreasing
tol will give more accurate results. Care must be exercised when using the relative error criterion (
).
If the zero is at
, or if the initial value of
x and the zero bracket the point
, it is likely that an error exit with
NE_CONTIN_AWAY_NOT_POSS,
NE_CONTIN_PROB_NOT_SOLVED or
NE_FINAL_PROB_NOT_SOLVED will occur.
It is possible to request too much or too little accuracy. Since it is not possible to achieve more than machine accuracy, a value of
should not be input and may lead to an error exit with
NE_CONTIN_AWAY_NOT_POSS,
NE_CONTIN_PROB_NOT_SOLVED or
NE_FINAL_PROB_NOT_SOLVED. For the reasons discussed under
NE_CONTIN_PROB_NOT_SOLVED in
Section 6,
tol should not be taken too large, say no larger than
.
For most problems, the time taken on each call to
c05axc will be negligible compared with the time spent evaluating
between calls to
c05axc. However, the initial value of
x and the choice of
tol will clearly affect the timing. The closer that
x is to the root, the less evaluations of
required. The effect of the choice of
tol will not be large, in general, unless
tol is very small, in which case the timing will increase.
None.