D02PSF and its associated routines (D02PFF, D02PQF, D02PRF, D02PTF and D02PUF) solve the initial value problem for a first-order system of ordinary differential equations. The routines, based on Runge–Kutta methods and derived from RKSUITE (see Brankin et al. (1991)), integrate
where is the vector of solution components and is the independent variable.
D02PFF computes the solution at the end of an integration step. Using the information computed on that step D02PSF computes the solution by interpolation at any point on that step. It cannot be used if or was specified in the call to setup routine D02PQF.
Brankin R W, Gladwell I and Shampine L F (1991) RKSUITE: A suite of Runge–Kutta codes for the initial value problems for ODEs SoftReport 91-S1 Southern Methodist University
1: N – INTEGERInput
On entry: , the number of ordinary differential equations in the system to be solved by the integration routine.
2: TWANT – REAL (KIND=nag_wp)Input
On entry: , the value of the independent variable where a solution is desired.
3: IDERIV – INTEGERInput
On entry: determines whether the solution and/or its first derivative are to be computed
compute approximate solution.
compute approximate first derivative.
compute approximate solution and first derivative.
, or .
4: NWANT – INTEGERInput
On entry: the number of components of the solution to be computed. The first NWANT components are evaluated.
11: RUSER() – REAL (KIND=nag_wp) arrayUser Workspace
IUSER and RUSER are not used by D02PSF, but are passed directly to F and may be used to pass information to this routine as an alternative to using COMMON global variables.
12: IWSAV() – INTEGER arrayCommunication Array
13: RWSAV() – REAL (KIND=nag_wp) arrayCommunication Array
On entry: these must be the same arrays supplied in a previous call D02PFF. They must remain unchanged between calls.
On exit: information about the integration for use on subsequent calls to D02PFF, D02PSF or other associated routines.
14: IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to , . If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction 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, if you are not familiar with this parameter, the recommended value is . When the value is used it is essential to test the value of IFAIL on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6 Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
in setup, but interpolation is not available for this method. Either use in setup or use reset routine to force the integrator to step to particular points.
On entry, a previous call to the setup routine has not been made or the communication arrays have become corrupted, or a catastrophic error has already been detected elsewhere. You cannot continue integrating the problem.
On entry, . Constraint: , or .
On entry, , and . Constraint: for , .
On entry, . Constraint: For , .
On entry, , but the value passed to the setup routine was .
On entry, and . Constraint: .
You cannot call this routine after the integrator has returned an error.
You cannot call this routine before you have called the step integrator.
You cannot call this routine when you have specified, in the setup routine, that the range integrator will be used.
The computed values will be of a similar accuracy to that computed by D02PFF.
8 Further Comments
This example solves the equation
over the range with initial conditions and . Relative error control is used with threshold values of for each solution component. D02PFF is used to integrate the problem one step at a time and D02PSF is used to compute the first component of the solution and its derivative at intervals of length across the range whenever these points lie in one of those integration steps. A low order Runge–Kutta method () is also used with tolerances and in turn so that solutions may be compared.