# NAG Library Function Document

## 1Purpose

nag_pde_interp_1d_coll (d03pyc) may be used in conjunction with either nag_pde_parab_1d_coll (d03pdc) or nag_pde_parab_1d_coll_ode (d03pjc). It computes the solution and its first derivative at user-specified points in the spatial coordinate.

## 2Specification

 #include #include
 void nag_pde_interp_1d_coll (Integer npde, const double u[], Integer nbkpts, const double xbkpts[], Integer npoly, Integer npts, const double xp[], Integer intpts, Integer itype, double up[], double rsave[], Integer lrsave, NagError *fail)

## 3Description

nag_pde_interp_1d_coll (d03pyc) is an interpolation function 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 nag_pde_parab_1d_coll (d03pdc) or nag_pde_parab_1d_coll_ode (d03pjc) on a set of mesh points; nag_pde_interp_1d_coll (d03pyc) can then be employed to compute the solution at a set of points other than those originally used in nag_pde_parab_1d_coll (d03pdc) or nag_pde_parab_1d_coll_ode (d03pjc). 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}-1\right]$, for $\mathit{i}=1,2,\dots ,{\mathbf{nbkpts}}$. When the derivative is needed (${\mathbf{itype}}=2$), the array ${\mathbf{xp}}\left[{\mathbf{intpts}}-1\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.

## 5Arguments

Note: the arguments u, npts, npde, xbkpts, nbkpts, rsave and lrsave must be supplied unchanged from either nag_pde_parab_1d_coll (d03pdc) or nag_pde_parab_1d_coll_ode (d03pjc).
1:    $\mathbf{npde}$IntegerInput
On entry: the number of PDEs.
Constraint: ${\mathbf{npde}}\ge 1$.
2:    $\mathbf{u}\left[{\mathbf{npde}}×{\mathbf{npts}}\right]$const doubleInput
Note: the $\left(i,j\right)$th element of the matrix $U$ is stored in ${\mathbf{u}}\left[\left(j-1\right)×{\mathbf{npde}}+i-1\right]$.
On entry: the PDE part of the original solution returned in the argument u by the function nag_pde_parab_1d_coll (d03pdc) or nag_pde_parab_1d_coll_ode (d03pjc).
3:    $\mathbf{nbkpts}$IntegerInput
On entry: the number of break-points.
Constraint: ${\mathbf{nbkpts}}\ge 2$.
4:    $\mathbf{xbkpts}\left[{\mathbf{nbkpts}}\right]$const doubleInput
On entry: ${\mathbf{xbkpts}}\left[\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,{\mathbf{nbkpts}}$, must contain the break-points as used by nag_pde_parab_1d_coll (d03pdc) or nag_pde_parab_1d_coll_ode (d03pjc).
Constraint: ${\mathbf{xbkpts}}\left[0\right]<{\mathbf{xbkpts}}\left[1\right]<\cdots <{\mathbf{xbkpts}}\left[{\mathbf{nbkpts}}-1\right]$.
5:    $\mathbf{npoly}$IntegerInput
On entry: the degree of the Chebyshev polynomial used for approximation as used by nag_pde_parab_1d_coll (d03pdc) or nag_pde_parab_1d_coll_ode (d03pjc).
Constraint: $1\le {\mathbf{npoly}}\le 49$.
6:    $\mathbf{npts}$IntegerInput
On entry: the number of mesh points as used by nag_pde_parab_1d_coll (d03pdc) or nag_pde_parab_1d_coll_ode (d03pjc).
Constraint: ${\mathbf{npts}}=\left({\mathbf{nbkpts}}-1\right)×{\mathbf{npoly}}+1$.
7:    $\mathbf{xp}\left[{\mathbf{intpts}}\right]$const doubleInput
On entry: ${\mathbf{xp}}\left[\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,{\mathbf{intpts}}$, must contain the spatial interpolation points.
Constraints:
• ${\mathbf{xbkpts}}\left[0\right]\le {\mathbf{xp}}\left[0\right]<{\mathbf{xp}}\left[1\right]<\cdots <{\mathbf{xp}}\left[{\mathbf{intpts}}-1\right]\le {\mathbf{xbkpts}}\left[{\mathbf{nbkpts}}-1\right]$;
• if ${\mathbf{itype}}=2$, ${\mathbf{xp}}\left[\mathit{i}-1\right]\ne {\mathbf{xbkpts}}\left[\mathit{j}-1\right]$, for $\mathit{i}=1,2,\dots ,{\mathbf{intpts}}$ and $\mathit{j}=2,3,\dots ,{\mathbf{nbkpts}}-1$.
8:    $\mathbf{intpts}$IntegerInput
On entry: the number of interpolation points.
Constraint: ${\mathbf{intpts}}\ge 1$.
9:    $\mathbf{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:  $\mathbf{up}\left[\mathit{dim}\right]$doubleOutput
Note: the dimension, dim, of the array up must be at least ${\mathbf{npde}}×{\mathbf{intpts}}×{\mathbf{itype}}$.
The element ${\mathbf{UP}}\left(i,j,k\right)$ is stored in the array element ${\mathbf{up}}\left[\left(k-1\right)×{\mathbf{npde}}×{\mathbf{intpts}}+\left(j-1\right)×{\mathbf{npde}}+i-1\right]$.
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}-1\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:  $\mathbf{rsave}\left[{\mathbf{lrsave}}\right]$doubleCommunication Array
The array rsave contains information required by nag_pde_interp_1d_coll (d03pyc) as returned by nag_pde_parab_1d_coll (d03pdc) or nag_pde_parab_1d_coll_ode (d03pjc). The contents of rsave must not be changed from the call to nag_pde_parab_1d_coll (d03pdc) or nag_pde_parab_1d_coll_ode (d03pjc). Some elements of this array are overwritten on exit.
12:  $\mathbf{lrsave}$IntegerInput
On entry: the size of the workspace rsave, as in nag_pde_parab_1d_coll (d03pdc) or nag_pde_parab_1d_coll_ode (d03pjc).
13:  $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_EXTRAPOLATION
Extrapolation is not allowed.
NE_INCOMPAT_PARAM
On entry, ${\mathbf{itype}}=2$ and at least one interpolation point coincides with a break-point, i.e., interpolation point no $〈\mathit{\text{value}}〉$ with value $〈\mathit{\text{value}}〉$ is close to break-point $〈\mathit{\text{value}}〉$ with value $〈\mathit{\text{value}}〉$.
NE_INT
On entry, ${\mathbf{intpts}}\le 0$: ${\mathbf{intpts}}=〈\mathit{\text{value}}〉$.
On entry, ${\mathbf{itype}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{itype}}=1$ or $2$.
On entry, ${\mathbf{nbkpts}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{nbkpts}}\ge 2$.
On entry, ${\mathbf{npde}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{npde}}>0$.
On entry, ${\mathbf{npoly}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{npoly}}>0$.
NE_INT_3
On entry, ${\mathbf{npts}}=〈\mathit{\text{value}}〉$, ${\mathbf{nbkpts}}=〈\mathit{\text{value}}〉$ and ${\mathbf{npoly}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{npts}}=\left({\mathbf{nbkpts}}-1\right)×{\mathbf{npoly}}+1$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_NOT_STRICTLY_INCREASING
On entry, break-points xbkpts badly ordered: $\mathit{I}=〈\mathit{\text{value}}〉$, ${\mathbf{xbkpts}}\left[\mathit{I}-1\right]=〈\mathit{\text{value}}〉$, $\mathit{J}=〈\mathit{\text{value}}〉$ and ${\mathbf{xbkpts}}\left[\mathit{J}-1\right]=〈\mathit{\text{value}}〉$.
On entry, interpolation points xp badly ordered: $\mathit{I}=〈\mathit{\text{value}}〉$, ${\mathbf{xp}}\left[\mathit{I}-1\right]=〈\mathit{\text{value}}〉$, $\mathit{J}=〈\mathit{\text{value}}〉$ and ${\mathbf{xp}}\left[\mathit{J}-1\right]=〈\mathit{\text{value}}〉$.

## 7Accuracy

See the documents for nag_pde_parab_1d_coll (d03pdc) or nag_pde_parab_1d_coll_ode (d03pjc).

## 8Parallelism and Performance

nag_pde_interp_1d_coll (d03pyc) is not threaded in any implementation.