[SciPy-user] Polynomial interpolation
Robert Kern
robert.kern@gmail....
Sun Apr 20 19:10:14 CDT 2008
On Sat, Apr 19, 2008 at 4:27 PM, Anne Archibald
<peridot.faceted@gmail.com> wrote:
> They all need work, in particular, efficiency would be improved by
> making the y values vectors, error checking needs to be more robust,
> and documentation is not in reST form. Ultimately, too, the evaluation
> functions at least should be written in a compiled language (cython?).
> But I thought I'd solicit comments on the code first - is the
> object-oriented design cumbersome?
It looks fine although Gabriel's suggestions would be good
improvements. Some people may want single-function interfaces (e.g.
krogh(xi, yi, x)); they can be written on top of the OO implementation
rather more easily than otherwise.
> Is including the algorithm in the
> name confusing to users?
I doubt it.
> Is the calling convention for Hermite
> polynomials too confusing or error-prone?
It looks fine to me. For PiecewisePolynomial, I might transpose the yi
input such that yi[0] is the function value, yi[1] is the first
derivative, etc. A nitpick: the code
pos[pos==-1] = 0
pos[pos==self.n-1] = self.n-2
can be replaced with
pos.clip(0, self.n-2, out=pos)
But this all looks good, and I want it in scipy.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the SciPy-user
mailing list