Re: Points to Funciton
- To: mathgroup at smc.vnet.net
- Subject: [mg8663] Re: Points to Funciton
- From: Daniel Lichtblau <danl>
- Date: Mon, 15 Sep 1997 02:48:51 -0400
- Organization: Wolfram Research, Inc.
- Sender: owner-wri-mathgroup at wolfram.com
MJ.Stone at solaris.cc.vt.edu wrote:
>
> If I have a series of coordinates, is it possible to use mathematica
> to find a function that will satisfy these coordinates? If so, how?
In Mathematica one can use InterpolatingPolynomial.
In[4]:= ??InterpolatingPolynomial
InterpolatingPolynomial[data, var] gives a polynomial in the variable
var
which provides an exact fit to a list of data. The data can have the
forms
{{x1, f1}, {x2, f2}, ... } or {f1, f2, ... }, where in the second
case, the
xi are taken to have values 1, 2, ... . The fi can be replaced by
{fi, dfi,
ddfi, ... }, specifying derivatives at the points xi.
Attributes[InterpolatingPolynomial] = {Protected}
For example,
In[5]:= InterpolatingPolynomial[{{-2,5}, {1,4}, {6,2}, {8,-7}, {9,1}},
x]
1 1 97 73 (-8 + x)
Out[5]= 5 + (-(-) + (-(---) + (-(----) + -----------) (-6 + x)) (-1 +
x))
3 120 1680 1232
> (2 + x)
In[6]:= Expand[%]
2 3 4
782 6103 x 13407 x 1093 x 73 x
Out[6]= -(---) + ------ + -------- - ------- + -----
385 1320 6160 1320 1232
Daniel Lichtblau
Wolfram Research
danl at wolfram.com