<A NAME=Chebyshev_fit>
<TITLE>Chebyshev_fit</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>
<B>CHEBYSHEV FIT</B><P>
<P>
<P>
<P>
The operator family <em>Chebyshev_...</em> implements approximation
and evaluation of functions by the Chebyshev method.
Let <em>T(n,a,b,x)</em> be the Chebyshev polynomial of order <em>n</em>
transformed to the interval <em>(a,b)</em>.
Then a function <em>f(x)</em> can be
approximated in <em>(a,b)</em> by a series
<P>
<P>
<P><PRE><TT>
for i := 0:n sum c(i)*T(i,a,b,x)
</TT></PRE><P>The operator <em>chebyshev_fit</em> computes this approximation an
d
returns a list, which has as first element the sum expressed
as a polynomial and as second element the sequence
of Chebyshev coefficients.
<em>Chebyshev_df</em> and <em>Chebyshev_int</em> 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 <em>Chebyshev_eval</em> can be used.
<em>Chebyshev_eval</em> is based on a recurrence relation which is
in general more stable than a direct evaluation of the
complete polynomial.
<P>
<P>
<P> <H3>
syntax: </H3>
<em>chebyshev_fit</em>(<fcn>,<var>=(<lo> .. <hi>),<n
>)
<P>
<P>
<em>chebyshev_eval</em>(<coeffs>,<var>=(<lo> .. <hi>),
<var>=<pt>)
<P>
<P>
<em>chebyshev_df</em>(<coeffs>,<var>=(<lo> .. <hi>))
<P>
<P>
<em>chebyshev_int</em>(<coeffs>,<var>=(<lo> .. <hi>))
<P>
<P>
<P>
where <fcn> is an algebraic expression (the target function),
<var> is the variable of <fcn>,
<lo> and <hi> are
numerical real values which describe an
<A HREF=r37_0422.html>interval</A> <lo> <<hi>,
the integer <n> is the approximation order (set to 20 if missing),
<pt> is a number in the interval and <coeffs> is
a series of Chebyshev coefficients.
<P>
<P>
<P> <H3>
examples: </H3>
<P><PRE><TT>
on rounded;
w:=chebyshev_fit(sin x/x,x=(1 .. 3),5);
3 2
w := {0.03824*x - 0.2398*x + 0.06514*x + 0.9778,
{0.8991,-0.4066,-0.005198,0.009464,-0.00009511}}
chebyshev_eval(second w, x=(1 .. 3), x=2.1);
0.4111
</TT></PRE><P>