c05ax attempts to locate a zero of a continuous function using a continuation method based on a secant iteration. It uses reverse communication for evaluating the function.
- Type: System..::..Double%On initial entry: an initial approximation to the zero.On intermediate exit: the point at which must be evaluated before re-entry to the method.On final exit: the final approximation to the zero.
- Type: System..::..DoubleOn 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 [Description]), 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: .
- Type: System..::..Int32On 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 .
- Type: System..::..DoubleOn 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 usingwhere 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 x02aj.Constraint: must be sufficiently large that on the computer.
- Type: array<System..::..Double>()An array of size ( contains the current , this value may be useful in the event of an error exit.)
- Type: System..::..Int32%On intermediate exit: contains , or . The calling program must evaluate at x, storing the result in fx, and re-enter c05ax with all other parameters unchanged.On final exit: contains .Constraint: on entry , , , or .
- Type: System..::..Int32%On initial entry: ifail must be set to , . If you are unfamiliar with this parameter you should refer to Library Overview for details.For environments where it might be inappropriate to halt program execution when an error is detected, the value is recommended. If the output of error messages is undesirable, then the value is recommended. Otherwise, because for this method the values of the output parameters may be useful even if on exit, the recommended value is . When the value is used it is essential to test the value of ifail on exit.On final exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
c05ax 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.
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
Errors or warnings detected by the method:
On entry, , or , or .
- The parameter ind is incorrectly set on initial or intermediate entry.
- The current problem in the continuation sequence cannot be solved, see for the value of . The most likely explanation is that the current problem has no solution, either because the original problem had no solution or because the continuation path passes through a set of insoluble problems. This latter reason for failure should occur rarely, and not at all if the initial approximation to the zero is sufficiently close. Other possible explanations are that tol is too small and hence the accuracy requirement is too stringent, or that tol is too large and the initial approximation too poor, leading to successively worse intermediate solutions.
- Continuation away from the initial point is not possible. This error exit will usually occur if the problem has not been properly posed or the error requirement is extremely stringent.
- The final problem (with ) cannot be solved. It is likely that too much accuracy has been requested, or that the zero is at and .
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 , or 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 , or . For the reasons discussed under in [Error Indicators and Warnings], tol should not be taken too large, say no larger than .
For most problems, the time taken on each call to c05ax will be negligible compared with the time spent evaluating between calls to c05ax. 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.
This example calculates a zero of with initial approximation , and and .