[Numpy-discussion] poly1d left versus right multiplication with np numbers

Pierre GM pgmdevlist@gmail....
Wed Feb 4 10:19:38 CST 2009

On Feb 4, 2009, at 11:00 AM, josef.pktd@gmail.com wrote:

> I just had a hard to find bug in my program. poly1d  treats numpy
> scalars differently than python numbers when left or right
> multiplication is used.
> Essentially, if the first term is the numpy scalar, multiplied by a
> polynomial, then the result is an np.array.
> If the order is reversed, then the result is an instance of np.poly1d.
> The return types are also the same for numpy arrays, which is at least
> understandable, although a warning would be good)
> When using plain (python) numbers, then both left and right
> multiplication of the number with the polynomial returns a polynomial.
> Is this a bug or a feature? I didn't see it mentioned in the docs.

Looks like yet another example of ticket #826:
This one is getting quite a problem, and I have no idea how to fix  

More information about the Numpy-discussion mailing list