
<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>(&lt;fcn&gt;,&lt;var&gt;=(&lt;lo&gt; .. &lt;hi&gt;),&lt;n
&gt;) 
<P>
<P>
<em>chebyshev_eval</em>(&lt;coeffs&gt;,&lt;var&gt;=(&lt;lo&gt; .. &lt;hi&gt;), 
 &lt;var&gt;=&lt;pt&gt;) 
<P>
<P>
<em>chebyshev_df</em>(&lt;coeffs&gt;,&lt;var&gt;=(&lt;lo&gt; .. &lt;hi&gt;)) 
<P>
<P>
<em>chebyshev_int</em>(&lt;coeffs&gt;,&lt;var&gt;=(&lt;lo&gt; .. &lt;hi&gt;)) 
<P>
<P>
<P>
where &lt;fcn&gt; is an algebraic expression (the target function), 
&lt;var&gt; is the variable of &lt;fcn&gt;, 
&lt;lo&gt; and &lt;hi&gt; are 
numerical real values which describe an 
<A HREF=r37_0422.html>interval</A> &lt;lo&gt; &lt;&lt;hi&gt;, 
the integer &lt;n&gt; is the approximation order (set to 20 if missing), 
&lt;pt&gt; is a number in the interval and &lt;coeffs&gt; 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>