6 ms·
As someone who needs math software somewhat infrequently, I had assumed that SageMath was a sort of de facto standard for people using Python with math. I was s
by haberman 6y ago
As someone who needs math software somewhat infrequently, I had assumed that SageMath was a sort of de facto standard for people using Python with math. I was surprised to see that Google Colab doesn't support Sage in its notebooks.
I asked a coworker about it, someone who had previously worked on Sage. It sounds like some parts of the community are now favoring using lighter-weight libraries directly (like SymPy for symbolic math).
I discovered that Sage is not pure Python: Sage is translated to Python before running, which is how it can support syntax like "f(x) = x + 1" to define a function (whereas in pure Python you would need to use "def".
- krastanov 6y agoBe careful with your last statement: Sage is actually accessible as a python library with purely python syntax, but it also has an interface that supports weirder syntax like the one you mentioned.
- sgdpk 6y agoDo you know how to install the library in a Python environment?
- williamstein 6y agoIn one sense, what you want is possible but not currently supported, though people are working on it (https://trac.sagemath.org/ticket/29705 https://trac.sagemath.org/ticket/29705 is a good start). In another sense, the SageMath install is just a Python environment. When you install Sage (from source or a binary) you are install a Python environment, similar to Anaconda. You can then type "sage -sh" to setup the environment, then install packages (pip3 install), or run a Python interpreter (by typing "python3") and do "import sage.all" to get the full sage library as a normal Python library. You could write a Python program and use any of Sage in them by importing "sage.all" in your Python program. The reason Sage is currently distributed this way is similar to the reason Anaconda exists, which is that Python's package manager isn't (or wasn't in 2005 when I started this!) meant to build something as complicated as Sage, which has about 100 complicated dependencies. I really hope this eventually changes someday and people can type "pip install sagemath" and get something useful. Oh, I think for several Linux distributions there are SageMath packages that just build Sage into the standard system-wide Python. So if you're using Linux, the problem may already be solved for you.
- infokiller 6y agoI think it's unlikely that pip will be able to easily install something like Sage anytime soon, but one could use conda [1] which is pretty popular in the scientific community, or alternatively docker [2]. It also seems there's support in the Nix package manager [3] which is actually more powerful than any other package manager I'm aware of (GUIX notwithstanding). (I realize that this response is probably useless for the Sage author, but hopefully will benefit others who struggle with installation) [1] https://doc.sagemath.org/html/en/installation/conda.html#sec-installation-conda https://doc.sagemath.org/html/en/installation/conda.html#sec... [2] https://hub.docker.com/r/sagemath/sagemath/ https://hub.docker.com/r/sagemath/sagemath/ [3] https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/science/math/sage/sage-src.nix https://github.com/NixOS/nixpkgs/blob/master/pkgs/applicatio...
- watwatinthewat 6y agoGraduate educational background in math here and working in software engineering and machine learning. Like your coworker said, I do my work in Python and libraries like Sympy/pandas/numpy, not Sage. Sage never made more sense than Python since Python covers everything I need to do, including what Sage does that I need. I've never met anyone who uses Sage and work at large research center. If your college background is math, you used Matlab in school. If your background is in computer science, you go with Python or another programming language. Sage seems like the middle ground between those two, but who is that? The cases posted here seem to be like yours where there is occasional need for workers or students whose employer or school doesn't or won't supply a Matlab license. Matlab is in most college math departments and offers keys directly to students for like $50-100, so there are few of those cases. An employer with math researchers isn't going blink at the $2k for a perpetual license, so anyone doing the work regularly gets Matlab who wants it. I do think Sage is good software and it is important to have a free alternative to Matlab. The audience is pretty limited, though.
- williamstein 6y agoSage is primarily written and developed to support pure mathematics research, and you're describing applied/numerical mathematics. They are completely different things. Look at the chapters and sections in the Sage reference manual to begin to get a sense of what Sage is about: https://doc.sagemath.org/html/en/reference/index.html https://doc.sagemath.org/html/en/reference/index.html Sage has basically no overlap at all with Matlab in terms of new interesting code, but does have around a million lines of new code written by over 600 people: https://trac.sagemath.org/#AccountNamesMappedtoRealNames https://trac.sagemath.org/#AccountNamesMappedtoRealNames That code is mostly about the world of pure mathematics research, which has almost nothing to do with Matlab.
- watwatinthewat 6y agoMy background is pure math; sorry if that wasn't clear. Even in that environment I have not seen someone use Sage over Matlab.