[Numpy-discussion] addition, multiplication of a polynomial and np.{float, int}
Denis Laxalde
denis.laxalde at mcgill.ca
Tue Mar 6 16:03:15 EST 2012
Hi,
>>> np.__version__
'1.7.0.dev-7c07089'
>>> p = np.poly1d([1,1])
>>> p + 1.0
poly1d([ 1., 2.])
>>> p + np.float64(1)
poly1d([ 1., 2.])
>>> np.float64(1.0) + p
array([ 2., 2.])
>>> np.int64(1) + p
array([2, 2])
>>> np.int(1) + p
poly1d([1, 2])
>>> np.int64(1)*p
array([1, 1])
What's happening here? I'd expect operations with polynomials would
return a polynomial.
--
Denis
More information about the NumPy-Discussion
mailing list