Working in the field of robotics, I often have to write big vectors ( usually computed as the result of 3D transformations ) and then compute their Jacobian ( their derivative with respect to several state-variables ), which quickly becomes very nasty equations. I use sympy to (i) compute these big vectors, expressed in a very declarative way, (ii) compute the jacobian and (iii) export the results in C-code, immediat…
SymPy: Symbolic Mathematics in Python
21–30 of 137 posts
Re: SymPy: Symbolic Mathematics in Python
#22Sympy is amazing, but i kinda fail to see whats news about it as its oldest commit is 14 years ago.
Oldest commit was from today: https://github.com/sympy/sympy Where are you getting 14 years from?
Re: SymPy: Symbolic Mathematics in Python
#23Earlier quoted context omitted.
Stephen Wolfram notwithstanding, Mathematica is still far ahead of most alternatives as a CAS. Maple is good on some integrals. Their downsides are that their languages are not very well suited as general purpose languages, many times the algebraic manipulations you have to perform aren't that complicated and you'd rather work in a "real" language. Yet another case where python isn't the best in class but still worka…
"Python isn't the best tool for anything, but it's the second best tool for most things."
Re: SymPy: Symbolic Mathematics in Python
#24https://nbviewer.org/url/canonical.org/~kragen/sw/dev3/sympy... (solving a multivariate quadratic with math pretty-printing)
https://nbviewer.org/url/canonical.org/~kragen/sw/dev3/tiny-... (my cheatsheet of quick-and-dirty numpy/pylab plots, including some sympy examples)
https://nbviewer.org/url/canonical.org/~kragen/sw/dev3/secan... (using sympy to symbolically differentiate an existing python function, which is something you can't usually do, in order to find its minimum in closed form)
https://nbviewer.org/url/canonical.org/~kragen/sw/dev3/max-p... (some basic circuit analysis with basic calculus with sympy)
https://nbviewer.org/url/canonical.org/~kragen/sw/dev3/latex... (various fiddling around with mathjax formatting and sympy, including some analysis of minsky's circle algorithm from hakmem)
Re: SymPy: Symbolic Mathematics in Python
#25Earlier quoted context omitted.
Stephen Wolfram notwithstanding, Mathematica is still far ahead of most alternatives as a CAS. Maple is good on some integrals. Their downsides are that their languages are not very well suited as general purpose languages, many times the algebraic manipulations you have to perform aren't that complicated and you'd rather work in a "real" language. Yet another case where python isn't the best in class but still worka…
Sagemath is a python library that has more capabilities than Mathematica. If you want to do real symbolic computation in python Sagemath is the only way to do it. That said sympy is quite a cool little library for learning.
Look, we all love open source, but we aren't doing anybody any favors by pretending the open source alternative is better when it isn't. I would encourage anyone whose needs are satisfied by sympy/sagemath to opt for the open alternative, but the question was whether or not Mathematica as of now, early 2024, is better. The unfortunate reality is that it is.
Re: SymPy: Symbolic Mathematics in Python
#26Working in the field of robotics, I often have to write big vectors ( usually computed as the result of 3D transformations ) and then compute their Jacobian ( their derivative with respect to several state-variables ), which quickly becomes very nasty equations. I use sympy to (i) compute these big vectors, expressed in a very declarative way, (ii) compute the jacobian and (iii) export the results in C-code, immediat…
Why are you calculating the Jacobian symbolically? AFAIK, for complex cases, the numerical Jacobian is often faster / more numerically stable.
Re: SymPy: Symbolic Mathematics in Python
#27Re: SymPy: Symbolic Mathematics in Python
#28The results were Mathematica failed to solve 1,523 problems, Sympy failed to solve 48,529.
So it has some catching up to do.
Re: SymPy: Symbolic Mathematics in Python
#29Earlier quoted context omitted.
Sagemath is a python library that has more capabilities than Mathematica. If you want to do real symbolic computation in python Sagemath is the only way to do it. That said sympy is quite a cool little library for learning.
Sagemath isn't a python library, it's a collection of packages (of which sympy is one) under a common interface. It is indeed what you would use if you wanted to do real symbolic computation in python, but it's not at the level of Mathematica or Maple. Look, we all love open source, but we aren't doing anybody any favors by pretending the open source alternative is better when it isn't. I would encourage anyone whose…
I can do an import sage as the top of any python script.
It's a library.
And since I get all of python for free it's better than Mathematica.
Re: SymPy: Symbolic Mathematics in Python
#30I checked now, and it seems that on this front a lot of development in sympy made it possible that we know how very good libraries built on top of it [1] [2]. There is even now a Jupyter notebook example on schwarzschild metric [3].
[1] https://docs.einsteinpy.org
[2]https://github.com/spacetimeengineer/spacetimeengine
[3] https://github.com/sympy/sympy/blob/master/examples/intermed...