a simple code :
import sympy as sp
sp.var('a b c',nonzero=True)
eq = Eq(a*b,a*c)
display(eq)
display(eq.simplify())
Both display exhibit : ab = ac
I would have liked sympy to simply remove 'a', which is possible because I mentioned 'a' is nonzero.
What's wrong ?
Best regards, Mike
--
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 sympy+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/23535fa8-2842-4259-96aa-4862292c8ae1o%40googlegroups.com.
Hello Mike,sadly, what you are trying to do is not easily possible! You are thinking of Eq as an equation, instead in Sympy it is an alias for the class Equality. They are conceptually different and the behaviour you are trying to represent is not possible: you can not apply the same mathematical operation to both sides simultaneously. If you happen to have objects of type Equality, it is better to convert them to an expression and perform a manipulation, for example:eq.rewrite(sp.Add).collect(a) / aAlternatively:sp.Eq(*[arg / a for arg in eq.args])If you absolutely need an object to represent an equation, take a look at the source code of this pull-request [1]. It's not perfect, but it is a starting point; with that class Equation, you can apply the same mathematical operation to both sides simultaneously.Davide.
Il giorno dom 26 lug 2020 alle ore 19:39 Mikhael Myara <mikhae...@umontpellier.fr> ha scritto:
--a simple code :
import sympy as sp
sp.var('a b c',nonzero=True)
eq = Eq(a*b,a*c)
display(eq)
display(eq.simplify())Both display exhibit : ab = ac
I would have liked sympy to simply remove 'a', which is possible because I mentioned 'a' is nonzero.
What's wrong ?
Best regards, Mike
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 sy...@googlegroups.com.