NAG CL Interface
d02uwc (bvp_​ps_​lin_​grid_​vals)

1 Purpose

d02uwc interpolates from a set of function values on a supplied grid onto a set of values for a uniform grid on the same range. The interpolation is performed using barycentric Lagrange interpolation. d02uwc is primarily a utility function to map a set of function values specified on a Chebyshev Gauss–Lobatto grid onto a uniform grid.

2 Specification

#include <nag.h>
void  d02uwc (Integer n, Integer nip, const double x[], const double f[], double xip[], double fip[], NagError *fail)
The function may be called by the names: d02uwc or nag_ode_bvp_ps_lin_grid_vals.

3 Description

d02uwc interpolates from a set of n+1 function values, fxi, on a supplied grid, xi, for i=0,1,,n, onto a set of m values, f^x^j, on a uniform grid, x^j, for j=1,2,,m. The image x^ has the same range as x, so that x^j = xmin + j-1 / m-1 × xmax - xmin , for j=1,2,,m. The interpolation is performed using barycentric Lagrange interpolation as described in Berrut and Trefethen (2004).
d02uwc is primarily a utility function to map a set of function values specified on a Chebyshev Gauss–Lobatto grid computed by d02ucc onto an evenly-spaced grid with the same range as the original grid.

4 References

Berrut J P and Trefethen L N (2004) Barycentric lagrange interpolation SIAM Rev. 46(3) 501–517

5 Arguments

1: n Integer Input
On entry: n, where the number of grid points for the input data is n+1.
Constraint: n>0 and n is even.
2: nip Integer Input
On entry: the number, m, of grid points in the uniform mesh x^ onto which function values are interpolated. If nip=1 then on successful exit from d02uwc, fip[0] will contain the value fxn.
Constraint: nip>0.
3: x[n+1] const double Input
On entry: the grid points, xi, for i=0,1,,n, at which the function is specified.
Usually this should be the array of Chebyshev Gauss–Lobatto points returned in d02ucc.
4: f[n+1] const double Input
On entry: the function values, fxi, for i=0,1,,n.
5: xip[nip] double Output
On exit: the evenly-spaced grid points, x^j, for j=1,2,,m.
6: fip[nip] double Output
On exit: the set of interpolated values f^x^j, for j=1,2,,m. Here f^x^jfx=x^j.
7: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, n=value.
Constraint: n>0.
On entry, n=value.
Constraint: n is even.
On entry, nip=value.
Constraint: nip>0.
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 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

7 Accuracy

d02uwc is intended, primarily, for use with Chebyshev Gauss–Lobatto input grids. For such input grids and for well-behaved functions (no discontinuities, peaks or cusps), the accuracy should be a small multiple of machine precision.

8 Parallelism and Performance

d02uwc is not threaded in any implementation.

9 Further Comments

None.

10 Example

This example interpolates the function x+cos5x, as specified on a 65-point Gauss–Lobatto grid on -1,1, onto a coarse uniform grid.

10.1 Program Text

Program Text (d02uwce.c)

10.2 Program Data

Program Data (d02uwce.d)

10.3 Program Results

Program Results (d02uwce.r)