Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I used Mathematica a lot during my PhD. Now, using Sage and I am disconcerted by it. The great things about the Wolfram Language is that it is functional, which is a very nice way to think about maths, and how I am now used to. Sage is not functional. You create mathematical objects and those objects have properties that have to extract using Python class functions.

My other gripe, more objective than the above, with Sage is the lack of good documentation. The documentation is certainly complete, but it is painful to read. Mathematica documentation is a treat to read. Every function has its own page with plenty of examples to show capabilities, and show relations to other functions.

With Sage I constantly have to search the web to how to do things, while in Mathematica, I rarely had to leave the inbuilt help.



The programming language of Sage is indeed imperative (Python) rather than functional. Python's approach is much better than Mathematica's for some kinds of mathematics, and much worse for others. This is more generally true of imperative versus functional programming -- each is good for some classes of problems and terrible for others.

Regarding examples, currently there are 50,283 functions defined in the Sage library, and 96.8% of these functions have documentation that is illustrated with working tested examples. Also, you can read the source code of 100% of these functions (unlike with Mathematica) in case something isn't clear. Much of the Sage reference manual (find it here: https://doc.sagemath.org/) is autogenerated from the sagemath library source code; that's why there are 1,287,666 source lines of comments in sage, versus 636,899 lines of non-comment code.


The reference site here https://doc.sagemath.org/html/en/reference/index.html is a travesty. As I said above, it is indeed complete, but it is a pain to find something in it. Pages are long, and you have to keep scrolling, hoping that the function you are looking for exists and is somewhere on this page.

One of the best features of Mathematica documentation (https://reference.wolfram.com/) is that every function has its own page, and there are helpful links to related functions. I have found so many functions via these links. I really wish Sage had something like this.


“you can read the source code of 100% of these functions (unlike with Mathematica)”

This is an important observation. The source is the ultimate documentation, and, in many cases (in my experience) the only correct documentation for a software system. If you can’t see the source, you don’t know what the program does, you only know what someone says it does (aside from exhaustive experimentation).


What stuff is functional programming bad at? You can just introduce loops and mutation with tail recursion and get all the "benefits" of imperative code.


Not OP.

First of all I wanna say that Mathematica/Wolfram Language is not just functional and certainly not purely functional.

Thus said, I feel trying to be purely functional has its drawbacks whenever you have to keep track of a lot of stuff that requires state: for example if you have to declare that some of your constants are real you end up having to use Assuming or Assumptions a lot and that can get verbose quickly. Setting the $Assumptions global makes for terser code.

If you wanna dig more into the differences of the two approaches in the same language you can look at the xAct package vs. the built-in symbolic tensors: xAct has many more features but feels less idiomatic, because you have to set they type of your symbols beforehand and expressions are not really self-contained.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: