naginterfaces.library.roots.sys_func_aa¶
- naginterfaces.library.roots.sys_func_aa(fcn, x, atol=1.0536712127723509e-08, rtol=1.0536712127723509e-08, m=0, cndtol=0.0, astart=0, data=None)[source]¶
sys_func_aa
finds a solution of a system of nonlinear equations by fixed-point iteration using Anderson acceleration.For full information please refer to the NAG Library document for c05mb
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/c05/c05mbf.html
- Parameters
- fcncallable fvec = fcn(x, data=None)
must return the values of the functions at a point .
- Parameters
- xfloat, ndarray, shape
The components of the point at which the functions must be evaluated.
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- fvecfloat, array-like, shape
The function values .
- xfloat, array-like, shape
An initial guess at the solution vector, .
- atolfloat, optional
The absolute convergence criterion; see .
- rtolfloat, optional
The relative convergence criterion. At each iteration is computed. The iteration is deemed to have converged if .
- mint, optional
, the number of previous iterates to use in Anderson acceleration. If , Anderson acceleration is not used.
- cndtolfloat, optional
The maximum allowable condition number for the triangular factor generated during Anderson acceleration. At each iteration, if the condition number exceeds , columns are deleted until it is sufficiently small.
If , no condition number tests are performed.
- astartint, optional
The number of iterations by which to delay the start of Anderson acceleration.
- dataarbitrary, optional
User-communication data for callback functions.
- Returns
- xfloat, ndarray, shape
The final estimate of the solution vector.
- fvecfloat, ndarray, shape
The function values at the final point, .
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
An error occurred in evaluating the decomposition during Anderson acceleration. This may be due to slow convergence of the iteration. Try setting the value of . If condition number tests are already performed, try decreasing .
- (errno )
The iteration has diverged and subsequent iterates are too large to be computed in floating-point arithmetic.
- Warns
- NagAlgorithmicWarning
- (errno )
The iteration is not making good progress. This failure exit may indicate that the system does not have a zero, or that the solution is very close to the origin. Rerunning
sys_func_aa
from a different starting point may avoid the region of difficulty.- (errno )
There have been at least calls to . Consider restarting the calculation from the point held in .
- NagCallbackTerminateWarning
- (errno )
Termination requested in .
- Notes
The system of equations is defined as:
This homogeneous system can readily be reformulated as
A standard fixed-point iteration approach is to start with an approximate solution and repeatedly apply the function until possible convergence; i.e., , until . Anderson acceleration uses up to previous values of to obtain an improved estimate . If a standard fixed-point iteration converges, Anderson acceleration usually results in convergence in far fewer iterations (therefore, using far fewer function evaluations).
Full details of Anderson acceleration are provided in Anderson (1965). In summary, the previous iterates are combined to form a succession of least squares problems. These are solved using a decomposition, which is updated at each iteration.
You are free to choose any value for , provided . A typical choice is .
Anderson acceleration is particularly useful if evaluating is very expensive, in which case functions such as
sys_deriv_easy()
orsys_func_easy()
, which require the Jacobian or its approximation, may perform poorly.
- References
Anderson, D G, 1965, Iterative Procedures for Nonlinear Integral Equations, J. Assoc. Comput. Mach. (12), 547–560