naginterfaces.library.ode.ivp_bdf_zero_simple¶
- naginterfaces.library.ode.ivp_bdf_zero_simple(x, xend, y, fcn, tol, relabs, pederv=None, output=None, g=None, data=None, io_manager=None, spiked_sorder='C')[source]¶
ivp_bdf_zero_simple
integrates a stiff system of first-order ordinary differential equations over an interval with suitable initial conditions, using a variable-order, variable-step method implementing the Backward Differentiation Formulae (BDF), 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 d02ej
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/d02/d02ejf.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
Must be set to a positive tolerance for controlling the error in the integration. Hence affects the determination of the position where , if is supplied.
ivp_bdf_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_bdf_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_bdf_zero_simple
with and if 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’
0.0
‘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 ‘R’.
- pedervNone or callable pw = pederv(x, y, data=None), optional
Note: if this argument is None then a NAG-supplied facility will be used.
must evaluate the Jacobian of the system (that is, the partial derivatives ) for given values of the variables .
- 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
- pwfloat, array-like, shape
must contain the value of , for , for .
- 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_bdf_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_bdf_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 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 points.
- dataarbitrary, optional
User-communication data for callback functions.
- io_managerFileObjManager, optional
Manager for I/O in this routine.
- spiked_sorderstr, optional
If in is spiked (i.e., has unit extent in all but one dimension, or has size ), selects the storage order to associate with it in the NAG Engine:
- spiked_sorder =
row-major storage will be used;
- spiked_sorder =
column-major storage will be used.
- Returns
- xfloat
If is supplied by you, contains the point where , unless anywhere on the range to , in which case, will contain . If is not supplied 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 .
- tolfloat
Normally unchanged. However if the range to is so short that a small change in is unlikely to make any change in the computed solution, then, on return, has its sign changed.
- 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 )
No integration steps have been taken. has been set illegally.
- (errno )
Integration successful as far as , but an internal error has occurred during rootfinding.
- (errno )
Impossible error — internal variable .
- (errno )
Impossible error — internal variable .
- Warns
- NagAlgorithmicWarning
- (errno )
Integration successful as far as , but further progress not possible with the input value of .
- (errno )
Integration successful as far as , but has been reset illegally.
- (errno )
No change in sign of the function was detected in the integration range.
- (errno )
Integration successful as far as , but an internal error has occurred during interpolation.
- 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_bdf_zero_simple
advances the solution of a system of ordinary differential equationsfrom to using a variable-order, variable-step method implementing the BDF. The system is defined by , which evaluates in terms of and (see Parameters). The initial values of must be given at .
The solution is returned via the 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 . The Jacobian of the system may be supplied in , if it is available.
For a description of BDF 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