Hello,
I wonder about the following behavior
In [1]: import sympy as sp
In [2]: x, y = sp.symbols('x, y', commutative = False)
In [3]: M1 = x*sp.eye(2)
In [4]: M2 = y*x*sp.eye(2)
In [5]: y*M1-M2
Out[5]:
Matrix([
[x*y - y*x, 0],
[ 0, x*y - y*x]])
I would have expected that the two matrices are equal.
However, multiplying y from the right to M1 results in products where y
is on the left side:
In [6]: y*M1
Out[6]:
Matrix([
[x*y, 0],
[ 0, x*y]])
For reference two other results:
In [7]: M2
Out[7]:
Matrix([
[y*x, 0],
[ 0, y*x]])
In [8]: M1*y
Out[8]:
Matrix([
[x*y, 0],
[ 0, x*y]])
Questions:
1. Is this behavior intended?
2. Is there any (easy) way to achieve my intended behavior, i.e.
respecting multiplication order when using matrix multiplication.
Thanks,
Carsten.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/55510F66.4060900%40gmx.de.
For more options, visit https://groups.google.com/d/optout.