naginterfaces.library.ode.ivp_​adams_​zero_​simple

naginterfaces.library.ode.ivp_adams_zero_simple(x, xend, y, fcn, tol, relabs, output=None, g=None, data=None)[source]

ivp_adams_zero_simple integrates a system of first-order ordinary differential equations over a range with suitable initial conditions, using a variable-order, variable-step Adams’ method until a user-specified function, if supplied, of the solution is zero, and returns the solution at points specified by you, if desired.

For full information please refer to the NAG Library document for d02cj

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/d02/d02cjf.html

Parameters
xfloat

The initial value of the independent variable .

xendfloat

The final value of the independent variable. If , integration will proceed in the negative direction.

yfloat, array-like, shape

The initial values of the solution at .

fcncallable f = fcn(x, y, data=None)

must evaluate the functions (i.e., the derivatives ) for given values of its arguments .

Parameters
xfloat

, the value of the independent variable.

yfloat, ndarray, shape

, for , the value of the variable.

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

Returns
ffloat, array-like, shape

The value of , for .

tolfloat

A positive tolerance for controlling the error in the integration. Hence affects the determination of the position where , if is supplied.

ivp_adams_zero_simple has been designed so that, for most problems, a reduction in leads to an approximately proportional reduction in the error in the solution.

However, the actual relation between and the accuracy achieved cannot be guaranteed.

You are strongly recommended to call ivp_adams_zero_simple with more than one value for and to compare the results obtained to estimate their accuracy.

In the absence of any prior knowledge, you might compare the results obtained by calling ivp_adams_zero_simple with and where correct decimal digits are required in the solution.

relabsstr, length 1

The type of error control. At each step in the numerical solution an estimate of the local error, , is made. For the current step to be accepted the following condition must be satisfied:

where and are defined by

‘M’

‘A’

‘R’

‘D’

where is a small machine-dependent number and is an estimate of the local error at , computed internally. If the appropriate condition is not satisfied, the step size is reduced and the solution is recomputed on the current step. If you wish to measure the error in the computed solution in terms of the number of correct decimal places, should be set to ‘A’ on entry, whereas if the error requirement is in terms of the number of correct significant digits, should be set to ‘R’. If you prefer a mixed error test, should be set to ‘M’, otherwise if you have no preference, should be set to the default ‘D’. Note that in this case ‘D’ is taken to be ‘M’.

outputNone or callable xsol = output(xsol, y, data=None), optional

Note: if this argument is None then a NAG-supplied facility will be used.

permits access to intermediate values of the computed solution (for example to print or plot them), at successive user-specified points.

It is initially called by ivp_adams_zero_simple with (the initial value of ).

You must reset to the next point (between the current and ) where is to be called, and so on at each call to .

If, after a call to , the reset point is beyond , ivp_adams_zero_simple will integrate to with no further calls to ; if a call to is required at the point , must be given precisely the value .

Parameters
xsolfloat

The output value of the independent variable .

yfloat, ndarray, shape

The computed solution at the point .

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

Returns
xsolfloat

You must set to the next value of at which is to be called.

gNone or callable retval = g(x, y, data=None), optional

Note: if this argument is None then a NAG-supplied facility will be used.

must evaluate the function for specified values .

It specifies the function for which the first position where is to be found.

Parameters
xfloat

, the value of the independent variable.

yfloat, ndarray, shape

, for , the value of the variable.

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

Returns
retvalfloat

The value of at the specified point.

dataarbitrary, optional

User-communication data for callback functions.

Returns
xfloat

If is supplied by you, it contains the point where , unless anywhere on the range to , in which case, will contain . If is not supplied by you it contains , unless an error has occurred, when it contains the value of at the error.

yfloat, ndarray, shape

The computed values of the solution at the final point .

Raises
NagValueError
(errno )

On entry, .

Constraint: , , or .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

No integration steps have been taken. Progress not possible with the input value of .

(errno )

On the first call to , was returned as , which is inconsistent with .

(errno )

On the first call to , remained unchanged.

(errno )

On a call to , remained unchanged.

.

(errno )

Impossible error — internal variable .

Warns
NagAlgorithmicWarning
(errno )

Integration successful as far as , but further progress not possible with the input value of .

(errno )

On a call to , was returned as , which is inconsistent with previous and .

(errno )

No change in sign of the function was detected in the integration range.

Notes

In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.

ivp_adams_zero_simple advances the solution of a system of ordinary differential equations

from to using a variable-order, variable-step Adams’ method. The system is defined by , which evaluates in terms of and . The initial values of must be given at .

The solution is returned via at points specified by you, if desired: this solution is obtained by interpolation on solution values produced by the method. As the integration proceeds a check can be made on the user-specified function to determine an interval where it changes sign. The position of this sign change is then determined accurately by interpolation to the solution. It is assumed that is a continuous function of the variables, so that a solution of can be determined by searching for a change in sign in . The accuracy of the integration, the interpolation and, indirectly, of the determination of the position where , is controlled by the arguments and .

For a description of Adams’ methods and their practical implementation see Hall and Watt (1976).

References

Hall, G and Watt, J M (ed.), 1976, Modern Numerical Methods for Ordinary Differential Equations, Clarendon Press, Oxford