NAG FL Interface
d02qzf (ivp_​adams_​interp)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

d02qzf interpolates components of the solution of a non-stiff system of first-order differential equations from information provided by the integrator routines d02qff or d02qgf.

2 Specification

Fortran Interface
Subroutine d02qzf ( neqf, twant, nwant, ywant, ypwant, rwork, lrwork, iwork, liwork, ifail)
Integer, Intent (In) :: neqf, nwant, lrwork, iwork(liwork), liwork
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: twant, rwork(lrwork)
Real (Kind=nag_wp), Intent (Out) :: ywant(nwant), ypwant(nwant)
C Header Interface
#include <nag.h>
void  d02qzf_ (const Integer *neqf, const double *twant, const Integer *nwant, double ywant[], double ypwant[], const double rwork[], const Integer *lrwork, const Integer iwork[], const Integer *liwork, Integer *ifail)
The routine may be called by the names d02qzf or nagf_ode_ivp_adams_interp.

3 Description

d02qzf evaluates the first nwant components of the solution of a non-stiff system of first-order ordinary differential equations at any point using the method of Watts and Shampine (1986) and information generated by d02qff or d02qgf. d02qzf should not normally be used to extrapolate outside the current range of the values produced by the integration routine.

4 References

Watts H A and Shampine L F (1986) Smoother interpolants for Adams codes SIAM J. Sci. Statist. Comput. 7 334–345

5 Arguments

1: neqf Integer Input
On entry: the number of first-order ordinary differential equations being solved by the integration routine. It must contain the same value as the argument neqf in a prior call to the setup routine d02qwf.
2: twant Real (Kind=nag_wp) Input
On entry: the point at which components of the solution and derivative are to be evaluated. twant should not normally be an extrapolation point, that is twant should satisfy
  • toldtwantT,
or if integration is proceeding in the negative direction
  • toldtwantT,
where told is the previous integration point and is, to within rounding, tcurrhlast (see d02qxf). Extrapolation is permitted but not recommended and ifail=2 is returned whenever extrapolation is attempted.
3: nwant Integer Input
On entry: the number of components of the solution and derivative whose values at twant are required. The first nwant components are evaluated.
Constraint: 1nwantneqf.
4: ywant(nwant) Real (Kind=nag_wp) array Output
On exit: the calculated value of the ith component of the solution at twant, for i=1,2,,nwant.
5: ypwant(nwant) Real (Kind=nag_wp) array Output
On exit: the calculated value of the ith component of the derivative at twant, for i=1,2,,nwant.
6: rwork(lrwork) Real (Kind=nag_wp) array Communication Array
On entry: this must be the same argument rwork as supplied to d02qwf and to d02qff or d02qgf. It is used to pass information from these routines to d02qzf. Therefore, its contents must not be changed before a call to d02qzf.
7: lrwork Integer Input
On entry: the dimension of the array rwork as declared in the (sub)program from which d02qzf is called.
This must be the same argument lrwork as supplied to d02qwf.
8: iwork(liwork) Integer array Communication Array
On entry: this must be the same argument iwork as supplied to d02qwf and to d02qff or d02qgf. It is used to pass information from these routines to d02qzf. Therefore, its contents must not be changed before a call to d02qzf.
9: liwork Integer Input
On entry: the dimension of the array iwork as declared in the (sub)program from which d02qzf is called.
This must be the same argument liwork as supplied to d02qwf.
10: ifail Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or −1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
Note: these error exits may be caused by overwriting elements of rwork and iwork.
ifail=1
Neither of the appropriate two integrator routines has been called.
No successful steps had been taken, so interpolation is impossible at twant=value.
On entry, liwork=value and liwork=value in d02qwf.
Constraint: liwork=liwork in d02qwf.
On entry, lrwork=value and lrwork=value in d02qwf.
Constraint: lrwork=lrwork in d02qwf.
On entry, neqf=value and neqf=value in d02qwf.
Constraint: neqf=neqf in d02qwf.
On entry, nwant=value.
Constraint: nwant1.
On entry, nwant=value and neqf=value.
Constraint: nwantneqf.
ifail=2
Extrapolation performed at twant=value.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

The error in interpolation is of a similar order to the error arising from the integration. The same order of accuracy can be expected when extrapolating using d02qzf. However, the actual error in extrapolation will, in general, be much larger than for interpolation.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
d02qzf is not thread safe and should not be called from a multithreaded user program. Please see Section 1 in FL Interface Multithreading for more information on thread safety.
d02qzf is not threaded in any implementation.

9 Further Comments

When interpolation for only a few components is required then it is more efficient to order the components of interest so that they are numbered first.

10 Example

This example solves the equation
y=-y,  y(0)=0,  y(0)=1  
reposed as
y1=y2 y2=-y1  
over the range [0,π/2] with initial conditions y1=0 and y2=1 using vector error control (vectol=.TRUE.) and d02qff in one-step mode (onestp=.TRUE.). d02qzf is used to provide solution values at intervals of π/16.

10.1 Program Text

Program Text (d02qzfe.f90)

10.2 Program Data

Program Data (d02qzfe.d)

10.3 Program Results

Program Results (d02qzfe.r)
GnuplotProduced by GNUPLOT 4.6 patchlevel 3 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1e−06 1e−05 0.0001 0.001 0.01 0.1 1 Solution Error x Example Program A Simple Problem with Sine Solution y y' error in y gnuplot_plot_1 gnuplot_plot_2 gnuplot_plot_3