<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>(<vals>,<basis>,<var>=<pts>)
<P>
<P>
<P>
where <vals> is a list of numeric values,
<var> is a variable used for the approximation,
<pts> is a list of coordinate values which correspond to
<var>,
<basis> 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>