[Numpy-discussion] why two versions of polyfit?

Travis Oliphant travis at continuum.io
Sun May 20 22:43:22 EDT 2012


Documentation helps are always welcome. 

Please make sure to advertise widely, though, that the new Polynomial class changes the ordering convention of the coefficients away from the Matlab standard.  

I think this will be a point of confusion unless it is carefully documented.  It's also why poly1d can't disappear (even though it would be nice to make it just a wrapper on top of the other Polynomial classes). 

-Travis


On May 20, 2012, at 10:53 AM, Andreas Hilboll wrote:

>> On Sun, May 20, 2012 at 9:37 AM, Charles R Harris
>> <charlesr.harris at gmail.com <mailto:charlesr.harris at gmail.com>> wrote:
>> 
>> 
>> 
>>    On Sun, May 20, 2012 at 9:09 AM, Andreas Hilboll <lists at hilboll.de
>>    <mailto:lists at hilboll.de>> wrote:
>> 
>>        Hi,
>> 
>>        I just noticed that there's two polyfit functions, one in
>>        numpy.lib.polynomial, and one in numpy.polynomial. What's the
>>        reason for
>>        this? The calling signatures aren't identical (the numpy.polynomial
>>        version supports weights), and I couldn't find a notice on why two
>>        versions exist.
>> 
>> 
>>    There are two different polynomial objects, Polynomial and poly1d.
>>    The Polynomial object is part of a newer group that also contains
>>    Lengendre, Chebyshev, etc., and doesn't have some of the problems
>>    that poly1d has. Poly1d is an older implementation.
> 
> I think it would be beneficial for the user if this fact was noted
> somewhere in the docstring of the Poly1d implementation. Especially
> since numpy.polyfit is pointing to that old implementation. When I saw
> the polyfit function in the numpy namespace, I didn't bother checking if
> there's anything more sophisticated.
> 
> I could add the appropriate links in the "see also" sections of the
> Poly1d docstrings, if you guys agree.
> 
>> Oh, and the polyfit function in polynomial.polynomial isn't meant to be
>> used directly, it is mostly there to support the fit class function of
>> Polynomial. See the documentation here <http://preview.tinyurl.com/8289gfs>.
> 
> Ah, okay. Thanks for that.
> 
> Cheers,
> Andreas.
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion




More information about the NumPy-Discussion mailing list