Hi. On Feb 7, 2011, at 4:22 AM, Franz wrote:
> Hello, > > I tried to multiply an equation by a symbol: > > In [1]: Eq(x,y)*z > Out[1]: z⋅x = y > > ...now I wonder why 'z' multiplies only the lhs of the equation, > rather than both sides. > Is there a reason for this unconventional behavior? > > Francesco It only looks like that is what it is doing because of the printer. What it is really doing is creating a Mul object with z and Eq(x, y). i.e., In [1]: a = z*Eq(x, y) In [2]: a.args Out[2]: (z, x = y) This is a known shortcoming of Eq, that it basically doesn't work with any operations. See http://code.google.com/p/sympy/issues/detail?id=1932. The work around is to either not use Eq or to tear apart and rebuild the Eq any time you want to do something to it, like In [3]: a = Eq(x, y) In [4]: b = Eq(a.lhs*z, a.rhs*z) In [5]: b Out[5]: x⋅z = y⋅z Aaron Meurer -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
