REDUCE

17.7 Chebyshev Curve Fitting

The operator family \(Chebyshev\_\ldots \) implements approximation and evaluation of functions by the Chebyshev method. Let \(T_n^{(a,b)}(x)\) be the Chebyshev polynomial of order \(n\) transformed to the interval \((a,b)\). Then a function \(f(x)\) can be approximated in \((a,b)\) by a series

\[ f(x) \approx \sum _{i=0}^N c_i T_i^{(a,b)}(x) \]
The operator chebyshev_fit computes this approximation and returns a list, which has as first element the sum expressed as a polynomial and as second element the sequence of Chebyshev coefficients \(c_{i}\). chebyshev_df and chebyshev_int transform a Chebyshev coefficient list into the coefficients of the corresponding derivative or integral respectively. For evaluating a Chebyshev approximation at a given point in the basic interval the operator chebyshev_eval can be used. Note that Chebyshev_eval is based on a recurrence relation which is in general more stable than a direct evaluation of the complete polynomial.
chebyshev_fit

\((fcn,var=(lo .. hi),n)\)

chebyshev_eval

\((coeffs,var=(lo .. hi),var=pt)\)

chebyshev_df

\((coeffs,var=(lo .. hi))\)

chebyshev_int

\((coeffs,var=(lo .. hi))\)

where fcnis an algebraic expression (the function to be fitted), var is the variable of fcn, loand hiare numerical real values which describe an interval (\(lo < hi\)), nis the approximation order, a positive integer, set to 20 if missing, ptis a numerical value in the interval and coeffs is a series of Chebyshev coefficients, computed by one of the operators chebyshev_coeff, chebyshev_df, or chebyshev_int.

Example:

on rounded;

w:=chebyshev_fit(sin x/x,x=(1 .. 3),5);

w := {0.0382345446975*x  - 0.239802588672*x

       + 0.0651206939005*x + 0.977836217464,

      {0.899091895826,-0.406599215895,

       -0.00519766024352,0.00946374143079,

       -0.0000948947435876}}

chebyshev_eval(second w, x=(1 .. 3), x=2.1);

0.411091086819


Hosted by Download REDUCE Powered by MathJax