[SciPy-dev] Generic polynomials class (was Re: Volunteer for Scipy Project)
Anne Archibald
peridot.faceted@gmail....
Tue Oct 6 16:57:40 CDT 2009
2009/10/6 Fernando Perez <fperez.net@gmail.com>:
> On Tue, Oct 6, 2009 at 9:03 AM, Anne Archibald
> <peridot.faceted@gmail.com> wrote:
>> Personally I think that the high-to-low order in poly1d is a mistake,
>> but at this point I think it may be one we're stuck with.
>
> Sometimes I wonder if we shouldn't push a new poly class with the
> other order. I can't stand that API, and I make actual mistakes
> pretty much every time I use it. I know I could make my own personal
> wrapper, but I've taught with this code and I always have to explain
> things about it, students make mistakes that puzzle them, etc.
>
> Perhaps a new one with a cleaned-up API (and obviously new names),
> leaving the old one for backwards compatibility with a Pending, then
> real, DeprecationWarning would be worthwhile?
I think poly1d needs to die. Even apart from the coefficient order, it
tempts people to write numerically disastrous code - as we see with
the orthogonal polynomials in scipy.special. Even quite ordinary
polynomial fitting tends to go very badly when applied with
power-basis polynomials.
On the other hand, it does seem valuable to have a polynomial object
of some sort, and I very much don't want my ballooning ideas for
features to impede Charles Harris' actual implementation.
> If we're the only two people unhappy about this, so be it. But if
> it's a general feeling, now that Chuck is working on the Chebyshev
> polys, it might be an opportunity to overhaul orthogonal polynomial
> support in Scipy and do it right.
I think my vote would be to remove polynomial support in numpy
entirely (deprecating along the way as usual). Scipy should definitely
have a full-featured polynomial class (exactly what features those
should be is open for debate). It is probably also worth having ufunc
versions for direct evaluation of those orthogonal polynomials for
which a special implementation is appropriate (e.g. Chebyshev
cos(n*arccos(x)), or Legendre polynomials using the cephes code).
Anne
More information about the Scipy-dev
mailing list