Re: Function interpolation
- To: mathgroup at smc.vnet.net
 - Subject: [mg45355] Re: [mg45336] Function interpolation
 - From: Yasvir Tesiram <tesiramy at omrf.ouhsc.edu>
 - Date: Fri, 2 Jan 2004 04:23:44 -0500 (EST)
 - References: <200401011054.FAA17763@smc.vnet.net>
 - Sender: owner-wri-mathgroup at wolfram.com
 
Hi,
See the notes for Table in Help or evaluate ?Table in your Notebook.
Suppose you have two lists of x and y values;
In[2]:= x={0,1,2,3,4,5}
Out[2]= {0, 1, 2, 3, 4, 5}
In[3]:= y={0,2,4,8,16,32}
Out[3]= {0, 2, 4, 8, 16, 32}
Now you can make your pairs.
In[4]:= t1={x,y}//Transpose
Out[4]= {{0, 0}, {1, 2}, {2, 4}, {3, 8}, {4, 16}, {5, 32}}
Make an InterpolatingFunction
In[7]:= newfunc=Interpolation[t1]
Out[7]= InterpolatingFunction[{{0, 5}}, <>]
In[8]:= newfunc[2.3]
Out[8]= 4.899
Cheers
Yas
On Thu, 1 Jan 2004 fernandoronci at hotmail.com wrote:
> Hi,
>
> I'm new to Mathematica and need some hints on how to derive (or
> estimate) a function from a given set of discrete x/y values.
> I know Mathematica can do this but I don't know how.
> For example, I tried to create a table of x/y values, then assign the
> approximated funcion to 'newfunction' and test it by calling it with
> 2.3 as argument, but it failed as follows (I couldn't even figure out
> how to build the table):
>
> Table = [{0, 0}, {1, 2}, {2, 4}, {3, 8}, {4, 16}, {5, 32}]
> newfunction = Interpolation[%]
> newfunction[2.3]
>
> Syntax::"sntxf": "Table =" cannot be followed by "[{0, 0}, {1, 2}, {2,
> 4}, {3, 8}, {4, 16}, {5, 32}]".
> Table = [{0, 0}, {1, 2}, {2, 4}, {3, 8}, {4, 16}, {5, 32}]
>
> BTW, I'm working with Mathematica 4.
> Help appreciated.
> Thank you,
>
> Fernando Ronci
> E-mail: fernandoronci at hotmail.com
>
- References:
- Function interpolation
- From: fernandoronci@hotmail.com (Fernando Ronci)
 
 
 - Function interpolation