c05qd is a comprehensive reverse communication method that finds a solution of a system of nonlinear equations by a modification of the Powell hybrid method.
Public Shared Sub c05qd ( _ ByRef irevcm As Integer, _ n As Integer, _ x As Double(), _ fvec As Double(), _ xtol As Double, _ ml As Integer, _ mu As Integer, _ epsfcn As Double, _ mode As Integer, _ diag As Double(), _ factor As Double, _ fjac As Double(,), _ r As Double(), _ qtf As Double(), _ communications As C05..::..c05qdCommunications, _ <OutAttribute> ByRef ifail As Integer _ )
public: static void c05qd( int% irevcm, int n, array<double>^ x, array<double>^ fvec, double xtol, int ml, int mu, double epsfcn, int mode, array<double>^ diag, double factor, array<double,2>^ fjac, array<double>^ r, array<double>^ qtf, C05..::..c05qdCommunications^ communications, [OutAttribute] int% ifail )
static member c05qd : irevcm : int byref * n : int * x : float * fvec : float * xtol : float * ml : int * mu : int * epsfcn : float * mode : int * diag : float * factor : float * fjac : float[,] * r : float * qtf : float * communications : C05..::..c05qdCommunications * ifail : int byref -> unit
- Type: System..::..Int32%On initial entry: must have the value .On intermediate exit: specifies what action you must take before re-entering c05qd with irevcm unchanged. The value of irevcm should be interpreted as follows:On final exit: , and the algorithm has terminated.Constraint: , or .
- Type: System..::..Int32On entry: , the number of equations.Constraint: .
- Type: array<System..::..Double>()On initial entry: an initial guess at the solution vector.On intermediate exit: contains the current point.On final exit: the final estimate of the solution vector.
- Type: array<System..::..Double>()On initial entry: need not be set.On intermediate re-entry: if , fvec must not be changed.On final exit: the function values at the final point, x.
- Type: System..::..DoubleOn initial entry: the accuracy in x to which the solution is required.Suggested value: , where is the machine precision returned by x02aj.Constraint: .
- Type: System..::..Int32On initial entry: the number of subdiagonals within the band of the Jacobian matrix. (If the Jacobian is not banded, or you are unsure, set .)Constraint: .
- Type: System..::..Int32On initial entry: the number of superdiagonals within the band of the Jacobian matrix. (If the Jacobian is not banded, or you are unsure, set .)Constraint: .
- Type: System..::..DoubleOn initial entry: the order of the largest relative error in the functions. It is used in determining a suitable step for a forward difference approximation to the Jacobian. If epsfcn is less than machine precision (returned by x02aj) then machine precision is used. Consequently a value of will often be suitable.Suggested value: .
- Type: System..::..Int32On initial entry: indicates whether or not you have provided scaling factors in diag.If the scaling must have been supplied in diag.Otherwise, if , the variables will be scaled internally.Constraint: or .
- Type: array<System..::..Double>()On entry: if , diag must contain multiplicative scale factors for the variables.If , diag need not be set.Constraint: if , , for .On exit: the scale factors actually used (computed internally if ).
- Type: System..::..DoubleOn initial entry: a quantity to be used in determining the initial step bound. In most cases, factor should lie between and . (The step bound is if this is nonzero; otherwise the bound is factor.)Suggested value: .Constraint: .
- Type: array<System..::..Double,2>[,](,)[,][,]On initial entry: need not be set.On intermediate exit: must not be changed.On final exit: the orthogonal matrix produced by the factorization of the final approximate Jacobian.
- Type: array<System..::..Double>()An array of size On initial entry: need not be set.On intermediate exit: must not be changed.On final exit: the upper triangular matrix produced by the factorization of the final approximate Jacobian, stored row-wise.
- Type: array<System..::..Double>()On initial entry: need not be set.On intermediate exit: must not be changed.On final exit: the vector .
- Type: NagLibrary..::..C05..::..c05qdCommunicationsAn Object of type C05.c05qdCommunications.
- 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]).
The system of equations is defined as:
c05qd is based on the MINPACK routine HYBRD (see Moré et al. (1980)). It chooses the correction at each step as a convex combination of the Newton and scaled gradient directions. The Jacobian is updated by the rank-1 method of Broyden. At the starting point, the Jacobian is approximated by forward differences, but these are not used again until the rank-1 method fails to produce satisfactory progress. For more details see Powell (1970).
Moré J J, Garbow B S and Hillstrom K E (1980) User guide for MINPACK-1 Technical Report ANL-80-74 Argonne National Laboratory
Powell M J D (1970) A hybrid method for nonlinear algebraic equations Numerical Methods for Nonlinear Algebraic Equations (ed P Rabinowitz) Gordon and Breach
Errors or warnings detected by the method:
On entry, .
Constraint: , or .
No further improvement in the solution is possible. xtol is too small: .
The iteration is not making good progress, as measured by the improvement from the last Jacobian evaluations.
The iteration is not making good progress, as measured by the improvement from the last iterations.
On entry, .
On entry, .
On entry, .
Constraint: or .
On entry, .
On entry, and diag contained a non-positive element.
On entry, .
On entry, .
If is the true solution and denotes the diagonal matrix whose entries are defined by the array diag, then c05qd tries to ensure that
If this condition is satisfied with , then the larger components of have significant decimal digits. There is a danger that the smaller components of may have large relative errors, but the fast rate of convergence of c05qd usually obviates this possibility.
If xtol is less than machine precision and the above test is satisfied with the machine precision in place of xtol, then the method exits with .
Note: this convergence test is based purely on relative error, and may not indicate convergence if the solution is very close to the origin.
The time required by c05qd to solve a given problem depends on , the behaviour of the functions, the accuracy requested and the starting point. The number of arithmetic operations executed by c05qd to process the evaluation of functions in the main program in each exit is approximately . The timing of c05qd is strongly influenced by the time spent evaluating the functions.
Ideally the problem should be scaled so that, at the solution, the function values are of comparable magnitude.
This example determines the values which satisfy the tridiagonal equations: