News for hackers. Stuff that matters.
Re:SymPy - a Python library for symbolic mathematics by smabie on Wednesday July 08, 2020 @01:47AM (#23767233)
How does it compare to sage math? I used sage math today and was pleasantly surprised. Even has a latex option. If you name your variables correctly, it even outputs Greek symbols and subscript correctly!
Re:SymPy - a Python library for symbolic mathematics by magv on Wednesday July 08, 2020 @04:52AM (#23768121)
As one point of comparison, SymPy is comically slow compared to Sage. This is mostly because SymPy is purely Python; Sage on the other hand uses its own derivative of GiNaC [1], Pynac [2], for its internal symbolic expression representation, and then multiple external libraries for non-trivial operations. Symbolic transformations are mostly Maxima [3], for example. Sage literally converts expressions to strings, pipes them through a Maxima process, and then parses the result back. This is still much faster than the pure Python SymPy.

There is an effort to speed up SymPy core, SymEngine [4], but it's been in development for years now, and still isn't integrated into SymPy. Not sure why.

Case in point: 'expand("(2 + 3 * x + 4 * x * y)^60")' takes 5 seconds with SymPy; Sage (Pynac) does the same in 0.02 seconds.

[1] https://www.ginac.de/

[2] http://pynac.org/

[3] http://maxima.sourceforge.net/

[4] https://github.com/symengine/symengine

Re:SymPy - a Python library for symbolic mathematics by Naac on Wednesday July 08, 2020 @02:13AM (#23767348)
As per the Sage FAQ[0], Sage uses Maxima for its symbolic and numerical computation: http://maxima.sourceforge.net/

[0] https://doc.sagemath.org/html/en/faq/faq-general.html#why-di...

Re:SymPy - a Python library for symbolic mathematics by ducttapecrown on Wednesday July 08, 2020 @02:23AM (#23767398)
I have Sympy set up to do latex printing in my Jupyter notebooks with Greek symbols and subscripts etc.
Re:SymPy - a Python library for symbolic mathematics by sundarurfriend on Wednesday July 08, 2020 @02:12AM (#23767342)
User 29athrowaway mentions in another comment that they use Sympy through Sagemath, so they probably could answer your question best. It sounds like Sympy is a subset of what Sage offers, but I'm not familiar enough with either tool to know.
Re:SymPy - a Python library for symbolic mathematics by westurner on Wednesday July 08, 2020 @02:40AM (#23767496)
There's a lot of overlap and there are syntactical differences. SymPy is included in the CoCalc image. SageMath is now conda-installable.

Things that the SageMath CAS can do that SymPy cannot yet:

- solve multivariate systems of inequalities

Re:SymPy - a Python library for symbolic mathematics by jbay808 on Wednesday July 08, 2020 @03:16AM (#23767668)
Try sympy.latex(expr). You can output latex using Sympy too!