nag_sum_chebyshev (c06dc) evaluates, at each point in a given set
, the sum of a Chebyshev series of one of three forms according to the value of the parameter
s:
: |
|
: |
|
: |
|
where
lies in the range
. Here
is the Chebyshev polynomial of order
in
, defined by
where
It is assumed that the independent variable
in the interval
was obtained from your original variable
, a set of real numbers in the interval
, by the linear transformation
The method used is based upon a three-term recurrence relation; for details see
Clenshaw (1962).
The coefficients
are normally generated by other functions, for example they may be those returned by the interpolation function
nag_interp_1d_cheb (e01ae) (in vector
a), by a least squares fitting function in
Chapter E02, or as the solution of a boundary value problem by
nag_ode_bvp_coll_nth (d02ja),
nag_ode_bvp_coll_sys (d02jb) or
nag_ode_bvp_ps_lin_solve (d02ue).
There may be a loss of significant figures due to cancellation between terms. However, provided that
is not too large,
nag_sum_chebyshev (c06dc) yields results which differ little from the best attainable for the available
machine precision.
nag_sum_chebyshev (c06dc) has been prepared in the present form to complement a number of integral equation solving functions which use Chebyshev series methods, e.g.,
nag_inteq_fredholm2_split (d05aa) and
nag_inteq_fredholm2_smooth (d05ab).
function c06dc_example
fprintf('c06dc example results\n\n');
x = [0.5, 1.0, -0.2];
xmin = -1;
xmax = 1;
s = int64(1);
c = [1.0, 1.0, 0.5, 0.25];
[res, ifail] = c06dc(x, xmin, xmax, c, s);
fprintf('\nSums: \n');
disp(res);