What is the difference between SymPy and Sage a.k.a. SageMath?
Rather than reinventing the wheel, Sage (which is written mostly in Python and Cython) integrates many specialized CAS software packages into a common interface, for which a user needs to know only Python.
SageMath Notebook In this version the user uses a web browser to access "Worksheets". A worksheet is a series of cells each of which contains some Python code. Each cell can be executed seperately with the output appearing below the cell. Worksheets can be saved, opened, downloaded, etc..
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.
(Full disclosure: I am the lead developer of SymPy)
The first thing you should understand is that SymPy and Sage are not quite the same thing. SymPy is a pure Python library, that does computer algebra. Sage is a collection of open source mathematical software. Sage tries to gather together all the major open source mathematics software, and glue it together into a useful system. In fact, Sage includes SymPy as one of its systems.
Here is a short list of (biased) facts for each (I won't call them pros or cons, just facts):
**
as it is in Python, not ^
as it is in many other systems.from sympy import init_session; init_session()
at the top (replace init_session
with init_printing
if you just want printing and not to import everything).1/2
without wrapping the integer literals, and it will return a rational. x^2
gives x squared, not Xor(x, 2)
. I'm not sure if it automatically defines variables for you by default. This means that things that you do in an interactive Sage session might not translate directly to a Python script. On the other hand, this can be useful for interactive use (btw, SymPy also has isympy -I
that does some similar things).Maybe that's not what you were looking for. You probably wanted some actual mathematical features. But as I said, Sage includes SymPy, so by definition, every feature of SymPy will be a feature of Sage. In practice, this is not necessarily the case because Sage doesn't always use SymPy by default (I'm not sure what the current status of this is actually), so you may have to call to SymPy manually if you want to use it from within Sage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With