rlchqrd
rlchqrd

Reputation: 541

Why is Numpy inconsistent in ordering polynomial coefficients by degree?

numpy.polynomial.polynomial.Polynomial stores polynomial coefficients in order of increasing degree, while numpy.poly1d stores polynomial coefficients in order of decreasing degree.

Is there a reason for this difference? Is there an advantage to either approach?

Upvotes: 5

Views: 747

Answers (1)

obataku
obataku

Reputation: 29646

According to the SciPy reference on NumPy:

Prior to NumPy 1.4, numpy.poly1d was the class of choice and it is still available in order to maintain backward compatibility. However, the newer Polynomial package is more complete than numpy.poly1d and its convenience classes are better behaved in the numpy environment. Therefore Polynomial is recommended for new coding.

Upvotes: 8

Related Questions