[SciPy-Dev] Confused about scipy.interpolate

Paul Kuin npkuin at gmail.com
Wed Aug 14 15:04:32 EDT 2013


Hi Juan, all,

Let me add some thoughts to that. I have been using interp1d, and some
other methods, but the main problem with extending a polynomial outide its
domain is that it tends to swerve off into nowhere land.  I found that a
much better method for extending the domain is rational functions. So I
would in principle be against making an extension of the solution of
polynomials outside their domain easy. Rational functions are just better
there.

I must admit that I just code up my own interpolations when I need
something else. Sorry.

Cheers,

   Paul


On Wed, Aug 14, 2013 at 7:23 PM, Juan Luis Cano <juanlu001 at gmail.com> wrote:

> Hello all, I was doing some experiments for the first time with
> scipy.interpolate today with the purpose of writing a brief
> article/tutorial on the matter and, as a user, I got a bit confused with
> the current state of the package and the "best practices". Let me explain.
>
> The most straight-forward way I found to make a polynomial interpolation
> was the funcion interp1d. It worked well, and I could even specify a
> higher polynomial order so I could replicate and explain the Runge
> phenomenon. Except for the fact that it refuses to work outside of the
> boundaries. I had imagined that interp1d would give me some sort of
> polynomial representation that could be naturally extended outside of
> the domain specified by the interpolation points. Moreover, it seems to
> use some "older" functions (see below).
>
> So I read "a more recent wrapper of the FITPACK routines", and I tried
> UnivariateSpline. Which naturally works inside of the domain, but cannot
> have a degree higher than 5, probably because it's geared to create
> splines (as the name points out). So still not valid (I wanted a 10th
> degree polynomial to show the oscillations).
>
> splmake and company are advertised as an "older" wrapping, so I felt
> like not using them (for the sake of using the newer things). For
> example, splmake was gone from docs
> (http://mail.scipy.org/pipermail/scipy-user/2010-March/024489.html) and
> besides it has an issue pending, with the word "confusing" in the title
> (https://github.com/scipy/scipy/issues/1408).
>
> And finally I found barycentric_interpolate and krogh_interpolate, which
> gave me the same results but it seems one is useful if I'm adding new
> points and the other is useful if I want the derivatives. But now I
> wonder which one is better.
>
> And this leads me to a question - what if I just want a simple,
> arbitrary degree polynomial interpolation?
>
> I thought that maybe something could be done similar to what was
> introduced in 0.11.0 with minimize and minimize_scalar, which I think it
> was a great improvement because the user usually doesn't have to worry
> about the method used, unless they want to specify a certain one (even
> if the naming was IMHO a bit unfortunate regarding the latter, but
> that's another story). So is there a way an `interpolate` function can
> be created, with a string argument specifying the method (with default
> "barycentric", for example)?
>
> Sorry for the long email, but I tried to explain in detail what was my
> "path" as a user trying to figure out what to do. Hope it is useful for
> the devs.
>
> Regards
>
> Juan Luis Cano
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>



-- 

* * * * * * * * http://www.mssl.ucl.ac.uk/~npmk/ * * * *
Dr. N.P.M. Kuin      (n.kuin at ucl.ac.uk)
phone +44-(0)1483 (prefix) -204927 (work) -276110 (home)
mobile +44(0)7806985366  skype ID: npkuin
Mullard Space Science Laboratory  – University College London  –
Holmbury St Mary – Dorking – Surrey RH5 6NT–  U.K.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20130814/bfc332dd/attachment.html>


More information about the SciPy-Dev mailing list