Fri, 24 Apr 2009 19:04:50 +0000, Pauli Virtanen wrote:
> Well, Numpy's poly1d will work fine with minor changes, so I see no
> reason not to make sure we're consistent with duck typing.

polyint fixed in r6883, there doesn't seem anything else to fix:

>>> import numpy as np
>>> from fractions import Fraction
>>> a = np.poly1d([Fraction(4,19), Fraction(3,19), Fraction(2,19), 0])
>>> a
poly1d([4/19, 3/19, 2/19, 0], dtype=object)
>>> a.integ()
poly1d([1/19, 1/19, 1/19, 0.0, 0], dtype=object)
>>> a.deriv()
poly1d([12/19, 6/19, 2/19], dtype=object)
>>> a / 19
poly1d([4/361, 3/361, 2/361, 0], dtype=object)
>>> a**3
poly1d([64/6859, 144/6859, 204/6859, 9/361, 102/6859, 36/6859, 8/6859, 
        0, 0, 0], dtype=object)

-- 
Pauli Virtanen

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

Reply via email to