5 ms·
As someone who does research with computer algebra systems (mainly Wolfram Mathematica) many hours a day, I think that SymPy is still far behind Mathematica. Th
by vacuumcl 4y ago
As someone who does research with computer algebra systems (mainly Wolfram Mathematica) many hours a day, I think that SymPy is still far behind Mathematica. The fundamental design of Mathematica based on replacement rules and a style of functional programming is quite difficult to beat in terms of ease of use. A few weeks ago I gave SymPy another try, and tried to implement a nested sum of the type 1 <= a_1 < ... < a_k <= n over a complicated summand f(a_1, ... ,a_k), where k and n are integer arguments, and it took me ages to figure out how to implement this in SymPy, whereas I in Mathematica I can write this in a minute.
- FPGAhacker 4y agoIs that maybe because you are familiar with Mathematica?
- auggierose 4y agoI don't have experience with SageMath, but if they are really running on Python, then they are surely giving up on some of the nice rewriting that Mathematica is based on, as I would expect then a library call is needed instead in Python.
- vacuumcl 4y agoNo. In Mathematica important operations like mapping functions over sets (arrays/tensors) at various depths have simple operators such as (/@, @, @@, @@@). You can do functional composition using @*, etc. You don't need to define your variables and functions before being able to write them in expressions. Often you want to have intermediate terms that have some temporary name, and which get substituted later on. The replacement rules in Mathematica are very powerful for this. As another example, I googled some project Euler solutions in Mathematica and (pure Python) and found this: https://www.nayuki.io/page/project-euler-solutions https://www.nayuki.io/page/project-euler-solutions. Compared to the pure Python solutions, the Mathematica code is typically much smaller. Of course this is not Sympy, but a lot of the Python syntax carries over to SymPy as well.
- nayuki 4y agoMy Mathematica solutions are a bit shorter than my Python solutions mainly because of convenient functions like PrimeQ, Binomial, ContinuedFraction.
- loa_in_ 4y agoSymPy is a great tool but there isn't a dedicated team of mathematicians and programmers working on it full time. I believe it has potential to compete with Mathematica someday.
- kalimanzaro 4y agoWouldnt the following work in basic python: for a_k in 1 to n: for a_(k-1) in 1 to a_k: .... I'm a heavy user of Mma but there are better examples. Automating the rewriting of formulas to make them more concise is a big one. (But also not as straightforward as it could be, tradeoffs between conciseness, ease of reading and speed of implementation need to be triaged, similar to Lisp/APL. Maybe sympy still has a chance to be more like math/TCS)
- texaslonghorn5 4y agono because k is an argument and you have to pre-write k nested loops
- okaleniuk 4y agoThat's true, Mathematica is more advanced. But it's not cheap and it brings in a whole new world with it. You do have to learn to use it explicitly while with SymPy, you can start after a 5 minute introduction. I would say, Mathematica a good professional instrument while SymPy is a good hobbyist tool. A note to a bypassing reader, if you want to try Mathematica, and not sure if you would stay with it, don't go for a desktop license. Get a Raspberry Pi instead. Mathematica comes free for Raspberry!
- testaccc3 4y agoDo you have some reference on how to use the rewrite rules? I've meant to use them a few times but I've never seen a good tutorial or textbook.
- kalimanzaro 4y agoI found the books by David B. Wagner and Roman Maeder (who designed the language,btw) to be incredibly helpful.
- Hendrikto 4y ago> As someone who does research […] mainly Wolfram Mathematica […] it took me ages to figure out how to implement this in SymPy, whereas I in Mathematica I can write this in a minute. Hardly surprising, is it? As someone with more experience in Python, it would likely be the opposite for me.
- phkahler 4y agoDo you have an opinion about Maxima or wxMaxima?
- doetoe 4y agoYou are replying to somebody talking about sage (rather than sympy), which in many fields (not all) is very far ahead of Mathematica. I do quite like the programming language of Mathematica, but an advantage of sage (and of sympy) is that you have the whole python standard library at your disposal. For your example you could e.g. use itertools.product.