NAG C Library Function Document

nag_ode_bvp_ps_lin_cheb_eval (d02uzc)

1
Purpose

nag_ode_bvp_ps_lin_cheb_eval (d02uzc) returns the value of the kth Chebyshev polynomial evaluated at a point x-1,1. nag_ode_bvp_ps_lin_cheb_eval (d02uzc) is primarily a utility function for use by the Chebyshev boundary value problem solvers.

2
Specification

#include <nag.h>
#include <nagd02.h>
void  nag_ode_bvp_ps_lin_cheb_eval (Integer k, double x, double *t, NagError *fail)

3
Description

nag_ode_bvp_ps_lin_cheb_eval (d02uzc) returns the value, T, of the kth Chebyshev polynomial evaluated at a point x-1,1; that is, T=cosk×arccosx.

4
References

Trefethen L N (2000) Spectral Methods in MATLAB SIAM

5
Arguments

1:     k IntegerInput
On entry: the order of the Chebyshev polynomial.
Constraint: k0.
2:     x doubleInput
On entry: the point at which to evaluate the polynomial.
Constraint: -1.0x1.0.
3:     t double *Output
On exit: the value, T, of the Chebyshev polynomial order k evaluated at x.
4:     fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

6
Error 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.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, k=value.
Constraint: k0.
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_REAL
On entry, x=value.
Constraint: -1.0x1.0.

7
Accuracy

The accuracy should be close to machine precision.

8
Parallelism and Performance

nag_ode_bvp_ps_lin_cheb_eval (d02uzc) is not threaded in any implementation.

9
Further Comments

None.

10
Example

A set of Chebyshev coefficients is obtained for the function x+exp-x defined on -0.24×π,0.5×π using nag_ode_bvp_ps_lin_cgl_grid (d02ucc). At each of a set of new grid points in the domain of the function nag_ode_bvp_ps_lin_cheb_eval (d02uzc) is used to evaluate each Chebshev polynomial in the series representation. The values obtained are multiplied to the Chebyshev coefficients and summed to obtain approximations to the given function at the new grid points.

10.1
Program Text

Program Text (d02uzce.c)

10.2
Program Data

Program Data (d02uzce.d)

10.3
Program Results

Program Results (d02uzce.r)