CHEBEVAL Name
CHEBEVAL
Author
Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770
craigm@lheamail.gsfc.nasa.gov
UPDATED VERSIONs can be found on my WEB PAGE:
http://cow.physics.wisc.edu/~craigm/idl/idl.html
Purpose
Evaluate a Chebyshev polynomial on an interval, given the coefficients
Major Topics
Curve and Surface Fitting
Calling Sequence
y = CHEBEVAL(X, P, INTERVAL=interval, DERIVATIVE=deriv)
Description
CHEBEVAL computes the values of a Chebyshev polynomial function at
specified abcissae, over the interval [a,b]. The user must supply
the abcissae and the polynomial coefficients. The function is of
the form:
N
y(x) = Sum p_n T_n(x*) x in [a,b]
i=0
Where T_n(x*) are the orthogonal Chebyshev polynomials of the
first kind, defined on the interval [-1,1] and p_n are the
coefficients. The scaled variable x* is defined on the [-1,1]
interval such that (x*) = (2*x - a - b)/(b - a), and x is defined
on the [a,b] interval.
The derivative of the function may be computed simultaneously
using the DERIVATIVE keyword.
The is some ambiguity about the definition of the first
coefficient, p_0, namely, the use of p_0 vs. the use of p_0/2.
The p_0 definition of Luke is used in this function.
Inputs
X - a numerical scalar or vector, the abcissae at which to
evaluate the polynomial. If INTERVAL is specified, then all
values of X must lie within the interval.
P - a vector, the Chebyshev polynomial coefficients, as returned
by CHEBFIT or CHEBCOEF.
Returns
An array of function values, evaluated at the abcissae. The
numeric precision is the greater of X or P.
Keyword Parameters
DERIVATIVE - upon return, a vector containing the derivative of
the function at each abcissa is returned in this
keyword.
INTERVAL - a 2-element vector describing the interval over which
the polynomial is to be evaluated.
Default: [-1, 1] Example
x = dindgen(1000)/100 ; Range of 0 to 10
p = chebcoef('COS(x)', /expr, interval=[0d, 10d]) ;; Compute coefs
y = chebeval(x, p, interval=[0d,10d]) ;; Eval Cheby poly
plot, x, y - cos(x) ; Plot residuals
References
Abramowitz, M. & Stegun, I., 1965, *Handbook of Mathematical
Functions*, 1965, U.S. Government Printing Office, Washington,
D.C. (Applied Mathematical Series 55)
CERN, 1995, CERN Program Library, Function E407
Luke, Y. L., *The Special Functions and Their Approximations*,
1969, Academic Press, New York
Modification History
Written and documented, CM, June 2001
Copyright license terms changed, CM, 30 Dec 2001
Added usage message, CM, 20 Mar 2002
Return a vector even when P has one element, CM, 22 Nov 2004
Fix bug in evaluation of derivatives, CM, 22 Nov 2004