File r37/lisp/csl/html/r37_0431.html artifact 4365783e49 part of check-in 237b3683c0



<A NAME=num_fit>

<TITLE>num_fit</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>



<B>NUM_FIT</B> _ _ _  _ _ _  _ _ _  _ _ _ <B>operator</B><P>
<P>
 
 <P>
<P>
The operator <em>num_fit</em> finds for a set of 
points the linear combination of a given set of 
functions (function basis) which approximates the 
points best under the objective of the <em>least squares</em> 
criterion (minimum of the sum of the squares of the deviation). 
The solution is found as zero of the 
gradient vector of the sum of squared errors. 
<P>
<P>
 <P> <H3> 
syntax: </H3>
<em>num_fit</em>(&lt;vals&gt;,&lt;basis&gt;,&lt;var&gt;=&lt;pts&gt;) 
<P>
<P>
<P>
where &lt;vals&gt; is a list of numeric values, 
&lt;var&gt; is a variable used for the approximation, 
&lt;pts&gt; is a list of coordinate values which correspond to 
&lt;var&gt;, 
&lt;basis&gt; is a set of functions varying in <em>var</em> which is used 
 for the approximation. 
 <P>
<P>
The result is a list containing as first element the 
function which approximates the given values, and as 
second element a list of coefficients which were used 
to build this function from the basis. 
 <P>
<P>
 <P> <H3> 
examples: </H3>
<P><PRE><TT>
 
pts:=for i:=1 step 1 until 5 collect i$

vals:=for i:=1 step 1 until 5 collect

            for j:=1:i product j$

num_fit(vals,{1,x,x**2},x=pts);

                     2
      {14.571428571*X   - 61.428571429*X + 54.6,{54.6,
           - 61.428571429,14.571428571}}

</TT></PRE><P>

REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]