[SciPy-user] Polynomial interpolation

Eike Welk eike.welk at gmx.net
Mon Apr 28 18:04:16 EDT 2008


On Monday 28 April 2008 23:24, Robert Kern wrote:
> On Mon, Apr 28, 2008 at 4:21 PM, Eike Welk <eike.welk at gmx.net> 
wrote:
> > On Monday 28 April 2008 22:36, Anne Archibald wrote:
> >  > 2008/4/28 Robert Kern <robert.kern at gmail.com>:
> >  > >  Well those certainly aren't useful. The only functions I
> >  > > would consider adding would be "one-shot" functions, e.g.:
> >  > >
> >  > >   def krogh(xi, yi, x):
> >  > >       return KroghInterpolator(xi,yi)(x)
> >  >
> >  > The problem here is that construction of the splines is an
> >  > order degree**2 process, so I want an interface that
> >  > encourages users to construct them once and for all. I think
> >  > such an approach also discourages people from just
> >  >
> >  > y_interp = krogh(all_my_data_x, all_my_data_y, x_interp)
> >  >
> >  > with hundreds of points, the results of which will be
> >  > meaningless and horrible.
> >
> >  You could store already constructed interpolation objects in a
> >  dictionary. (I didn't test it.):
>
> Arrays are unhashable and cannot be used as dictionary keys.
Ah, yes! 

One could however store a copy of the last x-data and y-data together 
with the interpolator. When x-data and y-data are the same at the 
next call, the interpolator could be reused.  

Kind regards,
Eike.



More information about the SciPy-User mailing list