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) / a

Alternatively:

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.

[1] https://github.com/sympy/sympy/pull/19479

Davide.


Il giorno dom 26 lug 2020 alle ore 19:39 Mikhael Myara <
[email protected]> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/23535fa8-2842-4259-96aa-4862292c8ae1o%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/23535fa8-2842-4259-96aa-4862292c8ae1o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAO%3D1Z0_rshYv9im6jSSLwCmCYDbSoe-h2E3obNNY%2BR48h05J%3Dg%40mail.gmail.com.

Reply via email to