Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplication of PseudoPolynomial with Polynomial is not commutative #30

Closed
johnh2o2 opened this issue Apr 13, 2017 · 2 comments
Closed

Comments

@johnh2o2
Copy link
Collaborator

a = PseudoPolynomial(p=[ 0, 1, 4 ], q=[2, 3, 0], r=0)
b = Polynomial([ 1, 4, 6 ])

prod_ab = a * b
prod_ba = b * a

The a*b product is a PseudoPolynomial, however the b*a product is a Polynomial; I'm pretty sure this is because Python will attempt to evaluate b.__mul__(a) before a.__rmul__(b), and I don't see any way to work around that...

Any suggestions or is this a necessary evil? It doesn't affect the rest of the code in any way, and the "rest of the code" is the entire reason the PseudoPolynomial class exists in the first place, so this is an extremely minor problem.

@jakevdp
Copy link
Collaborator

jakevdp commented Apr 14, 2017

Hmm... I tried it out (Python 3.6, Numpy 1.12) and I get the same result either way. What versions do you see this on?

@johnh2o2
Copy link
Collaborator Author

Now irrelevant (no pseudopolynomial stuff!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants