[SciPy-dev] Generic polynomials class (was Re: Volunteer for Scipy Project)
Charles R Harris
Tue Oct 6 17:29:32 CDT 2009
On Tue, Oct 6, 2009 at 3:57 PM, Anne Archibald <firstname.lastname@example.org>wrote:
> 2009/10/6 Fernando Perez <email@example.com>:
> > On Tue, Oct 6, 2009 at 9:03 AM, Anne Archibald
> > <firstname.lastname@example.org> 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).
I can board that train, but where should those classes go? Note that both
the polynomial and chebyshev modules come with extra functions for
manipulating series independently of the classes and Robert wants those
functions. So, should those functions be left in? I also went to some
trouble to set things up so the chebyshev functions would also work with
object coefficients, although there are a few places I haven't modified for
that yet. But perhaps that is an over general target and intrude on areas
that would be best left to other projects like sympy. Having extended
precision coefficients can be useful, though.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Scipy-dev