PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_ode_bvp_ps_lin_grid_vals (d02uw)
Purpose
nag_ode_bvp_ps_lin_grid_vals (d02uw) 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. nag_ode_bvp_ps_lin_grid_vals (d02uw) is primarily a utility function to map a set of function values specified on a Chebyshev Gauss–Lobatto grid onto a uniform grid.
Syntax
Description
nag_ode_bvp_ps_lin_grid_vals (d02uw) interpolates from a set of
function values,
, on a supplied grid,
, for
, onto a set of
values,
, on a uniform grid,
, for
. The image
has the same range as
, so that
, for
. The interpolation is performed using barycentric Lagrange interpolation as described in
Berrut and Trefethen (2004).
nag_ode_bvp_ps_lin_grid_vals (d02uw) is primarily a utility function to map a set of function values specified on a Chebyshev Gauss–Lobatto grid computed by
nag_ode_bvp_ps_lin_cgl_grid (d02uc) onto an evenly-spaced grid with the same range as the original grid.
References
Berrut J P and Trefethen L N (2004) Barycentric lagrange interpolation SIAM Rev. 46(3) 501–517
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
-
, where the number of grid points for the input data is .
Constraint:
and
n is even.
- 2:
– int64int32nag_int scalar
-
The number, , of grid points in the uniform mesh onto which function values are interpolated. If then on successful exit from nag_ode_bvp_ps_lin_grid_vals (d02uw), will contain the value .
Constraint:
.
- 3:
– double array
-
The grid points,
, for
, at which the function is specified.
Usually this should be the array of Chebyshev Gauss–Lobatto points returned in
nag_ode_bvp_ps_lin_cgl_grid (d02uc).
- 4:
– double array
-
The function values,
, for .
Optional Input Parameters
None.
Output Parameters
- 1:
– double array
-
The evenly-spaced grid points,
, for .
- 2:
– double array
-
The set of interpolated values
, for . Here .
- 3:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
Constraint: .
-
-
Constraint: .
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
nag_ode_bvp_ps_lin_grid_vals (d02uw) 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.
Further Comments
None.
Example
This example interpolates the function , as specified on a -point Gauss–Lobatto grid on , onto a coarse uniform grid.
Open in the MATLAB editor:
d02uw_example
function d02uw_example
fprintf('d02uw example results\n\n');
n = int64(64);
a = -1;
b = 1;
[x, ifail] = d02uc(n, a, b);
f = x + cos(5*x);
nip = int64(17);
[xip, fip, ifail] = d02uw(n, nip, x, f);
fprintf('\nInterpolated function values\n');
fprintf(' x F\n');
fprintf('%10.4f %10.4f \n', [xip fip]');
d02uw example results
Interpolated function values
x F
-1.0000 -0.7163
-0.8750 -1.2060
-0.7500 -1.5706
-0.6250 -1.6249
-0.5000 -1.3011
-0.3750 -0.6745
-0.2500 0.0653
-0.1250 0.6860
0.0000 1.0000
0.1250 0.9360
0.2500 0.5653
0.3750 0.0755
0.5000 -0.3011
0.6250 -0.3749
0.7500 -0.0706
0.8750 0.5440
1.0000 1.2837
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015