hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_ode_ivp_stiff_nat_interp (d02xj)

Purpose

nag_ode_ivp_stiff_nat_interp (d02xj) interpolates components of the solution of a system of first-order ordinary differential equations from information provided by the integrators in sub-chapter D02M–N.

Syntax

[sol, ifail] = d02xj(xsol, m, ysav, neq, x, nqu, hu, h, 'sdysav', sdysav)
[sol, ifail] = nag_ode_ivp_stiff_nat_interp(xsol, m, ysav, neq, x, nqu, hu, h, 'sdysav', sdysav)

Description

nag_ode_ivp_stiff_nat_interp (d02xj) evaluates the first mm components of the solution of a system of ordinary differential equations at any point using natural polynomial interpolation based on information generated by the integrator. This information must be passed unchanged to nag_ode_ivp_stiff_nat_interp (d02xj). nag_ode_ivp_stiff_nat_interp (d02xj) should not normally be used to extrapolate outside the range of values obtained from the above functions.

References

None.

Parameters

Compulsory Input Parameters

1:     xsol – double scalar
The point at which the first mm components of the solution are to be evaluated. xsol should not be an extrapolation point, that is xsol should satisfy (xsolx) × hu0.0(xsol-x)×hu0.0. Extrapolation is permitted but not recommended.
2:     m – int64int32nag_int scalar
mm, the number of components of the solution whose values at xsol are required. The first m components are evaluated.
Constraint: 1mneq1mneq.
3:     ysav(ldysav,sdysav) – double array
ldysav, the first dimension of the array, must satisfy the constraint ldysav1ldysav1.
The values provided in the parameter ysav on return from the integrator.
4:     neq – int64int32nag_int scalar
The value used for the parameter neq when calling the integrator.
Constraint: 1neqldysav1neqldysav.
5:     x – double scalar
The latest value at which the solution has been computed, as provided in the parameter tcur on return from the optional output nag_ode_ivp_stiff_integ_diag (d02ny).
6:     nqu – int64int32nag_int scalar
The order of the method used up to the latest value at which the solution has been computed, as provided in the parameter nqu on return from the optional output nag_ode_ivp_stiff_integ_diag (d02ny).
Constraint: nqu1nqu1.
7:     hu – double scalar
The last successful step used, that is the step used in the integration to get to x, as provided in the parameter hu on return from the optional output nag_ode_ivp_stiff_integ_diag (d02ny).
8:     h – double scalar
The next step size to be attempted in the integration, as provided in the parameter h on return from the optional output nag_ode_ivp_stiff_integ_diag (d02ny).

Optional Input Parameters

1:     sdysav – int64int32nag_int scalar
Default: The second dimension of the array ysav.
The value used for the parameter sdysav when calling the integrator.
Constraint: sdysavnqu + 1sdysavnqu+1.

Input Parameters Omitted from the MATLAB Interface

ldysav

Output Parameters

1:     sol(m) – double array
The calculated value of the iith component of the solution at xsol, for i = 1,2,,mi=1,2,,m.
2:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).
If nag_ode_ivp_stiff_nat_interp (d02xj) is to be used for extrapolation, ifail must be set to 11 before entry. It is then essential to test the value of ifail on exit for ifail = 1ifail=1 or 22.

Error Indicators and Warnings

Errors or warnings detected by the function:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

  ifail = 1ifail=1
On entry,m < 1m<1,
orneq < 1neq<1,
orldysav < 1ldysav<1,
orneq > ldysavneq>ldysav,
orm > neqm>neq,
ornqu < 1nqu<1,
orsdysav < nqu + 1sdysav<nqu+1.
  ifail = 2ifail=2
On entry, hu = 0.0hu=0.0 or h = 0.0h=0.0. This error can only occur if h and hu have been changed by you or possibly if the integrator has failed before calling nag_ode_ivp_stiff_nat_interp (d02xj).
W ifail = 3ifail=3
nag_ode_ivp_stiff_nat_interp (d02xj) has been called for extrapolation. Before returning with this error exit, the value of the solution at xsol is calculated and placed in sol.

Accuracy

The solution values returned will be of a similar accuracy to those computed by the integrator.

Further Comments

nag_ode_ivp_stiff_nat_interp (d02xj) is that employed for prediction purposes internally by the integrator. It is supplied for purposes of consistency only. You are recommended to employ the C1C1 interpolant provided by nag_ode_ivp_stiff_c1_interp (d02xk) wherever possible.

Example

function nag_ode_ivp_stiff_nat_interp_example
xsol = 0.02;
m = int64(3);
ysave = [0.9992010426063869, -9.014310377562871e-06, 6.812799519478248e-10, ...
         4.431544977419294e-13, 0, 3.646603065905307e-06;
     3.637754720562377e-05, -1.43245286845343e-09, -1.690946415679345e-09, ...
     4.645881910091972e-09, -5.351301001679175e-39, -5.764408311856045e-06;
     0.0007625798464070455, 9.015742830431324e-06, 1.009666463731707e-09, ...
    -4.64632506458996e-09, -0.2374434471130371, 2.117805245939617e-06];
neq = int64(3);
x = 0.02004966865187021;
nqu = int64(1);
hu = 0.0002271142424177253;
h = 0.0002271142424177253;
[sol, ifail] = nag_ode_ivp_stiff_nat_interp(xsol, m, ysave, neq, x, nqu, hu, h)
 

sol =

    0.9992
    0.0000
    0.0008


ifail =

                    0


function d02xj_example
xsol = 0.02;
m = int64(3);
ysave = [0.9992010426063869, -9.014310377562871e-06, 6.812799519478248e-10, ...
         4.431544977419294e-13, 0, 3.646603065905307e-06;
     3.637754720562377e-05, -1.43245286845343e-09, -1.690946415679345e-09, ...
     4.645881910091972e-09, -5.351301001679175e-39, -5.764408311856045e-06;
     0.0007625798464070455, 9.015742830431324e-06, 1.009666463731707e-09, ...
    -4.64632506458996e-09, -0.2374434471130371, 2.117805245939617e-06];
neq = int64(3);
x = 0.02004966865187021;
nqu = int64(1);
hu = 0.0002271142424177253;
h = 0.0002271142424177253;
[sol, ifail] = d02xj(xsol, m, ysave, neq, x, nqu, hu, h)
 

sol =

    0.9992
    0.0000
    0.0008


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013