MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Interpolation function objects


  • To: mathgroup@smc.vnet.net
  • Subject: [mg11736] Re: Interpolation function objects
  • From: Paul Abbott <paul@physics.uwa.edu.au>
  • Date: Thu, 26 Mar 1998 03:09:04 -0500
  • Organization: University of Western Australia
  • References: <6f1mph$fb6@smc.vnet.net>

Sean Ross wrote:

> If I define
> 
> f= Interpolation[data]
> 
> Then I can Plot[f[x],{x,xmin,xmax}] etc and f behaves like a regular
> function.
> 
> If I try and specify the argument in the definition of f as in
> 
> f[x_,n_Integer]:=Interpolation[data,InterpolationOrder->n]  or
> 
> f[#,n_Integer]:=Interpolation[data,InterpolationOrder->n]  or
> 
> f[x_]=Evaluate[Interpolation[data]][a]/.a->x  or
> 
> f[n_Integer]:=Interpolation[data,InterpolationOrder->n]

The last one, which is the one I'd use (modified to includ dynmaic
programming), works fine:

  In[1]:= data = Table[N[{x, Sin[x]}], {x, 0, 2*Pi, Pi/6}]; 
  In[2]:= f[n_Integer] :=  f[n] = Interpolation[data, InterpolationOrder
-> n]
  In[3]:= Plot[f[4][x], {x, 0, 2*Pi}]; 

Cheers,
	Paul 

____________________________________________________________________ 
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia            Nedlands WA  6907       
mailto:paul@physics.uwa.edu.au  AUSTRALIA                            
http://www.pd.uwa.edu.au/~paul

            God IS a weakly left-handed dice player
____________________________________________________________________



  • Prev by Date: Re: Extracting polynomial coefficient?
  • Next by Date: Re: Mathematica frustrations...
  • Prev by thread: Re: Interpolation function objects
  • Next by thread: A problem with CDF