>  Docs Center  >  Libraries  >  Markwardt  >  CHEBEVAL






  Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770
  UPDATED VERSIONs can be found on my WEB PAGE:


  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)


  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:
      y(x) = Sum p_n T_n(x*) x in [a,b]
  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.


  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


  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
  INTERVAL - a 2-element vector describing the interval over which
              the polynomial is to be evaluated.
              Default: [-1, 1]


  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


  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
  $Id: chebeval.pro,v 1.6 2004/11/22 07:08:00 craigm Exp $

© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us