Sympy and mathematical equality and equations

23 views
Skip to first unread message

schw...@gmail.com

unread,
May 2, 2019, 9:34:55 AM5/2/19
to sympy
Hello Sympy Developers and Interested People!

First off, Thank you very much for your great effort and success - Sympy is an absolutely awesome piece of software!
I am using it for the better of 2 years now and did some fun stuff, but I still haven't really decided on a coherent way of writing equations. The problem is that Eq() is not an equation in the mathematical sense as the following examples should demonstrate:

t = S('t')
f = Function('f')(t)
g = Function('g')(t)

equation = Eq(f,g+1)
equation2 = equation-1
equation3 = equation.diff(t)
equation4 = equation.subs(equation) # this I can do with subs(*equation.args)

Having a symbolic comparison of terms seems useful to me, so I totally get equation and Eq and their meaning.
However, an equation class satsifying the mathematics for the above examples seems to be absent in sympy.

What I am proposing is to think of a way that equations are made a basic building block in mathematics and imho should be likewise in a mathematics tool.
That said, I know ways to do all of the above, but it is really not intuitive to have every expression in a "x-y=0" form.
I would think that next to nobody actually thinks like that. And the code is hard to subsitute, because you need to do

eq = g+1-f
eq.subs(f,eq+f)

or even worse looking use solve.

Another big thing is printing. Printing "x-y" is very hard to read and you need to explain this unconfort to any new user.
Having "x=y" would be just as everyone learns in maths.

Programmatically I don't think that a new equation class, or the changes to Eq() would be a huge deal.
But programming it myself and then using a non-standard for something as standard as an equation seems really bad practice.
What do you guys think about that?

Thanks again
Mike

Aaron Meurer

unread,
May 2, 2019, 5:21:27 PM5/2/19
to sympy
There is a lot of discussion about this in these issues

https://github.com/sympy/sympy/issues/5031
https://github.com/sympy/sympy/issues/4986
https://github.com/sympy/sympy/issues/14741

Aaron Meurer
> --
> 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 post to this group, send email to sy...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/464c0dd6-bd2c-445f-942a-4fe75f1f91bc%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages