D03 Chapter Contents
D03 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentD03PYF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

D03PYF may be used in conjunction with either D03PDF/D03PDA or D03PJF/D03PJA. It computes the solution and its first derivative at user-specified points in the spatial coordinate.

## 2  Specification

 SUBROUTINE D03PYF ( NPDE, U, NBKPTS, XBKPTS, NPOLY, NPTS, XP, INTPTS, ITYPE, UP, RSAVE, LRSAVE, IFAIL)
 INTEGER NPDE, NBKPTS, NPOLY, NPTS, INTPTS, ITYPE, LRSAVE, IFAIL REAL (KIND=nag_wp) U(NPDE,NPTS), XBKPTS(NBKPTS), XP(INTPTS), UP(NPDE,INTPTS,ITYPE), RSAVE(LRSAVE)

## 3  Description

D03PYF is an interpolation routine for evaluating the solution of a system of partial differential equations (PDEs), or the PDE components of a system of PDEs with coupled ordinary differential equations (ODEs), at a set of user-specified points. The solution of a system of equations can be computed using D03PDF/D03PDA or D03PJF/D03PJA on a set of mesh points; D03PYF can then be employed to compute the solution at a set of points other than those originally used in D03PDF/D03PDA or D03PJF/D03PJA. It can also evaluate the first derivative of the solution. Polynomial interpolation is used between each of the break points ${\mathbf{XBKPTS}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NBKPTS}}$. When the derivative is needed (${\mathbf{ITYPE}}=2$), the array ${\mathbf{XP}}\left({\mathbf{INTPTS}}\right)$ must not contain any of the break points, as the method, and consequently the interpolation scheme, assumes that only the solution is continuous at these points.

None.

## 5  Parameters

Note: the parameters U, NPTS, NPDE, XBKPTS, NBKPTS, RSAVE and LRSAVE must be supplied unchanged from either D03PDF/D03PDA or D03PJF/D03PJA.
1:     NPDE – INTEGERInput
On entry: the number of PDEs.
Constraint: ${\mathbf{NPDE}}\ge 1$.
2:     U(NPDE,NPTS) – REAL (KIND=nag_wp) arrayInput
On entry: the PDE part of the original solution returned in the parameter U by the routine D03PDF/D03PDA or D03PJF/D03PJA.
3:     NBKPTS – INTEGERInput
On entry: the number of break points.
Constraint: ${\mathbf{NBKPTS}}\ge 2$.
4:     XBKPTS(NBKPTS) – REAL (KIND=nag_wp) arrayInput
On entry: ${\mathbf{XBKPTS}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NBKPTS}}$, must contain the break points as used by D03PDF/D03PDA or D03PJF/D03PJA.
Constraint: ${\mathbf{XBKPTS}}\left(1\right)<{\mathbf{XBKPTS}}\left(2\right)<\cdots <{\mathbf{XBKPTS}}\left({\mathbf{NBKPTS}}\right)$.
5:     NPOLY – INTEGERInput
On entry: the degree of the Chebyshev polynomial used for approximation as used by D03PDF/D03PDA or D03PJF/D03PJA.
Constraint: $1\le {\mathbf{NPOLY}}\le 49$.
6:     NPTS – INTEGERInput
On entry: the number of mesh points as used by D03PDF/D03PDA or D03PJF/D03PJA.
Constraint: ${\mathbf{NPTS}}=\left({\mathbf{NBKPTS}}-1\right)×{\mathbf{NPOLY}}+1$.
7:     XP(INTPTS) – REAL (KIND=nag_wp) arrayInput
On entry: ${\mathbf{XP}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{INTPTS}}$, must contain the spatial interpolation points.
Constraints:
• ${\mathbf{XBKPTS}}\left(1\right)\le {\mathbf{XP}}\left(1\right)<{\mathbf{XP}}\left(2\right)<\cdots <{\mathbf{XP}}\left({\mathbf{INTPTS}}\right)\le {\mathbf{XBKPTS}}\left({\mathbf{NBKPTS}}\right)$;
• if ${\mathbf{ITYPE}}=2$, ${\mathbf{XP}}\left(\mathit{i}\right)\ne {\mathbf{XBKPTS}}\left(\mathit{j}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{INTPTS}}$ and $\mathit{j}=2,3,\dots ,{\mathbf{NBKPTS}}-1$.
8:     INTPTS – INTEGERInput
On entry: the number of interpolation points.
Constraint: ${\mathbf{INTPTS}}\ge 1$.
9:     ITYPE – INTEGERInput
On entry: specifies the interpolation to be performed.
${\mathbf{ITYPE}}=1$
The solution at the interpolation points are computed.
${\mathbf{ITYPE}}=2$
Both the solution and the first derivative at the interpolation points are computed.
Constraint: ${\mathbf{ITYPE}}=1$ or $2$.
10:   UP(NPDE,INTPTS,ITYPE) – REAL (KIND=nag_wp) arrayOutput
On exit: if ${\mathbf{ITYPE}}=1$, ${\mathbf{UP}}\left(\mathit{i},\mathit{j},1\right)$, contains the value of the solution ${U}_{\mathit{i}}\left({x}_{\mathit{j}},{t}_{\mathrm{out}}\right)$, at the interpolation points ${x}_{\mathit{j}}={\mathbf{XP}}\left(\mathit{j}\right)$, for $\mathit{j}=1,2,\dots ,{\mathbf{INTPTS}}$ and $\mathit{i}=1,2,\dots ,{\mathbf{NPDE}}$.
If ${\mathbf{ITYPE}}=2$, ${\mathbf{UP}}\left(\mathit{i},\mathit{j},1\right)$ contains ${U}_{\mathit{i}}\left({x}_{\mathit{j}},{t}_{\mathrm{out}}\right)$ and ${\mathbf{UP}}\left(\mathit{i},\mathit{j},2\right)$ contains $\frac{\partial {U}_{\mathit{i}}}{\partial x}$ at these points.
11:   RSAVE(LRSAVE) – REAL (KIND=nag_wp) arrayCommunication Array
The array RSAVE contains information required by D03PYF as returned by D03PDF/D03PDA or D03PJF/D03PJA. The contents of RSAVE must not be changed from the call to D03PDF/D03PDA or D03PJF/D03PJA. Some elements of this array are overwritten on exit.
12:   LRSAVE – INTEGERInput
On entry: the size of the workspace RSAVE, as in D03PDF/D03PDA or D03PJF/D03PJA.
13:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. 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 $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=1$
 On entry, ${\mathbf{ITYPE}}\ne 1$ or $2$, or ${\mathbf{NPOLY}}<1$, or ${\mathbf{NPDE}}<1$, or ${\mathbf{NBKPTS}}<2$, or ${\mathbf{INTPTS}}<1$, or ${\mathbf{NPTS}}\ne \left({\mathbf{NBKPTS}}-1\right)×{\mathbf{NPOLY}}+1$, or ${\mathbf{XBKPTS}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NBKPTS}}$, are not ordered.
${\mathbf{IFAIL}}=2$
On entry, the interpolation points ${\mathbf{XP}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{INTPTS}}$, are not in strictly increasing order, or when ${\mathbf{ITYPE}}=2$, at least one of the interpolation points stored in XP is equal to one of the break points stored in XBKPTS.
${\mathbf{IFAIL}}=3$
You are attempting extrapolation, that is, one of the interpolation points ${\mathbf{XP}}\left(i\right)$, for some $i$, lies outside the interval [${\mathbf{XBKPTS}}\left(1\right),{\mathbf{XBKPTS}}\left({\mathbf{NBKPTS}}\right)$]. Extrapolation is not permitted.

## 7  Accuracy

See the documents for D03PDF/D03PDA or D03PJF/D03PJA.