2012/2/6 Stéfan van der Walt <ste...@sun.ac.za>

> Hi all,
>
> I noticed the following docstring on ``np.polynomial.polyval``:
>
> In [116]: np.polynomial.polyval?
> File:       /home/stefan/src/numpy/numpy/lib/utils.py
> Definition: np.polynomial.polyval(*args, **kwds)
> Docstring:
> `polyval` is deprecated!
> Please import polyval from numpy.polynomial.polynomial
>
>
> I guess we don't expect users to do "from numpy.polynomial.polynomial
> import polyval, Polynomial", so what is the suggested API for getting
> hold of the polynomial functions?


You can still import Polynomial from numpy.polynomial. The other functions
were removed because 1) They are essentially duplicated for 6 polynomial
types, 2) they are mostly there to support Polynomial. You shouldn't need
them for most things if you use Polynomial.


> Also, why is
> numpy.polynomial.polynomial.polyfit different from numpy.polyfit?
>
>
Use Polynomial.fit, it tracks the domain for you. Want to use Legendre
functions? Use Legendre.fit. Want to plot the result? plot(*p.linspace()),
want to plot the derivative? plot(*p.deriv().linspace()). Want to convert a
Legendre series to a Polynomial? p.convert(kind=Polynomial). So on and so
forth. The fitting is also NA aware in the development branch.

Chuck
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to