| Up | Next | Prev | PrevTail | Tail |
The operator family Chebyshev_… implements approximation and evaluation of functions by the Chebyshev method. Let Tn(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

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 ci. 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.
(fcn,var = (lo..hi),n)
(coeffs,var = (lo..hi),var = pt)
(coeffs,var = (lo..hi))
(coeffs,var = (lo..hi))
where ⟨fcn⟩ is an algebraic expression (the function to be fitted), ⟨var⟩ is the variable of ⟨fcn⟩, ⟨lo⟩ and ⟨hi⟩ are numerical real values which describe an interval (lo < hi), ⟨n⟩ is the approximation order, a positive integer, set to 20 if missing, ⟨pt⟩ is 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
| Up | Next | Prev | PrevTail | Front |