naginterfaces.library.ode.ivp_​2nd_​rkn

naginterfaces.library.ode.ivp_2nd_rkn(fcn, t, tend, y, yp, ydp, comm, data=None)[source]

ivp_2nd_rkn is a function for integrating a non-stiff system of second-order ordinary differential equations using Runge–Kutta–Nystrom techniques.

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

https://www.nag.com/numeric/nl/nagdoc_28.6/flhtml/d02/d02laf.html

Parameters
fcncallable f = fcn(t, y, data=None)

must evaluate the functions (that is the second derivatives ) for given values of its arguments , .

Parameters
tfloat

, the value of the argument.

yfloat, ndarray, shape

, for , the value of the argument.

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

Returns
ffloat, array-like, shape

The value of , for .

tfloat

The initial value of the independent variable .

tendfloat

The end point of the range of integration. If on initial entry, integration will proceed in the negative direction. may be reset, in the direction of integration, before any continuation call.

yfloat, array-like, shape

The initial values of the solution .

ypfloat, array-like, shape

The initial values of the derivatives .

ydpfloat, array-like, shape

Must be unchanged from a previous call to ivp_2nd_rkn.

commdict, communication object, modified in place

Communication structure.

This argument must have been initialized by a prior call to ivp_2nd_rkn_setup().

dataarbitrary, optional

User-communication data for callback functions.

Returns
tfloat

The value of the independent variable, which is usually , unless an error has occurred or the code is operating in one-step mode. If the integration is to be continued, possibly with a new value for , must not be changed.

yfloat, ndarray, shape

The computed values of the solution at the exit value of . If the integration is to be continued, possibly with a new value for , these values must not be changed.

ypfloat, ndarray, shape

The computed values of the derivatives at the exit value of . If the integration is to be continued, possibly with a new value for , these values must not be changed.

ydpfloat, ndarray, shape

The computed values of the second derivative at the exit value of , unless illegal input is detected, in which case the elements of may not have been initialized. If the integration is to be continued, possibly with a new value for , these values must not be changed.

Raises
NagValueError
(errno )

On entry, , but in the previous call to the setup function .

(errno )

The previous call to the setup function resulted in the error exit .

(errno )

The setup function ivp_2nd_rkn_setup() has not been called.

(errno )

has been reset such that the direction of integration is reversed.

(errno )

To satisfy the accuracy requirements the step size, , at , is too small for the machine precision.

(errno )

Two successive errors detected at the current value of .

Warns
NagAlgorithmicWarning
(errno )

On entry, and .

Constraint: .

(errno )

The maximum number of steps, , has been attempted.

(errno )

Inefficiency detected in integrating exactly to values of .

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

Given the initial values ivp_2nd_rkn integrates a non-stiff system of second-order differential equations of the type

from to using a Runge–Kutta–Nystrom formula pair. The system is defined by , which evaluates in terms of and , where are supplied at .

There are two Runge–Kutta–Nystrom formula pairs implemented in this function. The lower order method is intended if you have moderate accuracy requirements and may be used in conjunction with the interpolation function ivp_2nd_rkn_interp() to produce solutions and derivatives at user-specified points. The higher order method is intended if you have high accuracy requirements.

In one-step mode the function returns approximations to the solution, derivative and at each integration point. In interval mode these values are returned at the end of the integration range. You select the order of the method, the mode of operation, the error control and various optional inputs by a prior call to ivp_2nd_rkn_setup().

For a description of the Runge–Kutta–Nystrom formula pairs see Dormand et al. (1986a) and Dormand et al. (1986b) and for a description of their practical implementation see Brankin et al. (1989).

References

Brankin, R W, Dormand, J R, Gladwell, I, Prince, P J and Seward, W L, 1989, Algorithm 670: A Runge–Kutta–Nystrom Code, ACM Trans. Math. Software (15), 31–40

Dormand, J R, El–Mikkawy, M E A and Prince, P J, 1986, Families of Runge–Kutta–Nystrom formulae, Mathematical Report TPMR 86-1, Teesside Polytechnic

Dormand, J R, El–Mikkawy, M E A and Prince, P J, 1986, High order embedded Runge–Kutta–Nystrom formulae, Mathematical Report TPMR 86-2, Teesside Polytechnic