

A computer algebra system written in Python - rbanffy
https://github.com/sympy/sympy

======
ivan_ah
Sympy is AWESOME! In particular,
[http://live.sympy.org](http://live.sympy.org) is a great way to learn and
teach math... I often send links to my students with an entire sequence of
steps to find the solution. Can you factor x^2-5x+6 ? (find numbers a,b such
that (x-a)(x-b)=x^2-5x+6)
[http://live.sympy.org/?evaluate=solve(%20x**2-5*x%2B6%2C%20x...](http://live.sympy.org/?evaluate=solve\(%20x**2-5*x%2B6%2C%20x%20\)%0A%23--%0A)
(it's like an entire iPython notebook in a URL)

On the topic of sympy, I'm working on this short tutorial---an introduction to
sympy based around topics from the standard high school and first-year
university curriculum:
[http://minireference.com/static/sympy_tutorial.pdf](http://minireference.com/static/sympy_tutorial.pdf)

Please don't post the tutorial on HN yet---I'm working out some last typos and
I want to time the "official" announcement on HN with the beginning of the
school year.

~~~
Cyph0n
SymPy Gamma is also very interesting. Yes, it's no real competitor to
WolframAlpha, but it still has quite a few useful features.

[http://www.sympygamma.com/input/?i=integrate+log%28x^2%29](http://www.sympygamma.com/input/?i=integrate+log%28x^2%29)

For instance, as you can see in the link above, it can provide steps for
derivatives and integrals. WA has the same feature, but you need to subscribe
to actually use it without limits.

------
Tyr42
How is it different from Sage[1]?

(Quickstart here [http://www.sagemath.org/tour-
quickstart.html](http://www.sagemath.org/tour-quickstart.html), and really
awesome cloud version (that requires an account, but is very worth it here:
[https://cloud.sagemath.com/](https://cloud.sagemath.com/))

[1]: [http://www.sagemath.org/](http://www.sagemath.org/)

~~~
cgrubb
The Sympy guys have a good comparison:

[https://github.com/sympy/sympy/wiki/SymPy-
vs.-Sage](https://github.com/sympy/sympy/wiki/SymPy-vs.-Sage)

------
ubasu
If you use sympy, I would strongly recommend using ipython qtconsole:

[http://ipython.org/ipython-
doc/2/interactive/qtconsole.html](http://ipython.org/ipython-
doc/2/interactive/qtconsole.html)

One of the big advantages is that you can print your expressions using LaTeX:

[http://docs.sympy.org/dev/tutorial/printing.html](http://docs.sympy.org/dev/tutorial/printing.html)

~~~
CatMtKing
Why not the ipython notebook, in that case?

~~~
skierscott
I went through this same thought process about two years ago.

IPython's notebook allows you to easily _publish_ results. They include all
you want and need: latex, imshow and nice code with many languages. But it's
not good for _generating_ results.

Perhaps the area it lacks most in is querying variables. In QtConsole, you
just type `plot(x)` and see a plot with no side effects. In the notebook on
the other hand, you have to type `plot(x)` into a new cell unless you want to
rerun your code again and you have to delete that cell later (otherwise you
have an unreadable notebook). Plus, the default keybindings (while easy to
see) are not intuitive; I don't instinctively know how to jump back a cell.

~~~
aldanor
I don't agree. In the notebook, you can use "%pylab inline" or "%matplotlib
inline" magic to have plots inline, but you can also not use it and have plots
output to a separate window without any side effects in the notebook itself.
Or use any other backend of your choice.

To select a previous cell just press UP in command mode (or press Esc-UP in
any mode). Ref:
[http://nbviewer.ipython.org/github/ipython/ipython/blob/2.x/...](http://nbviewer.ipython.org/github/ipython/ipython/blob/2.x/examples/Notebook/User%20Interface.ipynb)

------
teddyh
Why would you link to the Github page instead of the project’s home page
([http://sympy.org/](http://sympy.org/))? Is this a thing now?

~~~
Trombone5
Yeah, upon seeing the github link I was thinking some poor sod had implemented
some polynomial expansion algorithm, and had never heard of sympy. The it
turned out to be sympy.

Soon people will post links to the gnome repos with the title "A open source
desktop environment for linux" ... now I'm tempted to do it myself.

------
juliangamble
When looking at Computer Algebra, you can't go past the original example of
MacSyma (written in LISP).

You can see an explanation of the MacSyma system in Peter Norvig's (head of
Google researcyh) Paradigms of Artificial Intelligence (PAIP).

[http://norvig.com/paip/README.html](http://norvig.com/paip/README.html)

[http://norvig.com/paip/macsyma.lisp](http://norvig.com/paip/macsyma.lisp)

[http://norvig.com/paip/macsymar.lisp](http://norvig.com/paip/macsymar.lisp)

[http://norvig.com/paip/cmacsyma.lisp](http://norvig.com/paip/cmacsyma.lisp)

The original development of the MacSyma system influenced Mathematica:
[http://en.wikipedia.org/wiki/Macsyma](http://en.wikipedia.org/wiki/Macsyma)

~~~
sparkie
Another good algebra system written in lisp is Axiom
([http://en.wikipedia.org/wiki/Axiom_%28computer_algebra_syste...](http://en.wikipedia.org/wiki/Axiom_%28computer_algebra_system%29)),
which is interesting for another reason too - it's probably the best example
of literate programming around.

------
innguest
I just read some of the tutorial and I must say this is some incredible work.
Very powerful tool, and what a great choice of license (BSD). This benefits
everyone; I'm very curious to read the source.

------
S4M
How does it compare to Maxima?
[http://maxima.sourceforge.net/](http://maxima.sourceforge.net/)

~~~
quotemstr
GNU Calc (M-x calc in Emacs) is also a fairly capable CAS, and I love its RPN
interface.

~~~
S4M
Thanks for that! I didn't know it had some algebra integrated. However, it
wouldn't simplify (x+1)/(-x-1) (it does simplify -x/x though).

~~~
quotemstr
Try the "a n" command.

------
misingnoglic
How does this compare with SAGE? I want to show this to my old math teacher
who taught using that instead.

~~~
exDM69
Sympy is included in Sage. Sage is just a collection of math tools in nice
packaging.

~~~
jasongrout
Sage also has its own 1.5 million line python/cython library that is part of
Sage
([https://github.com/sagemath/sage/tree/master/src/sage](https://github.com/sagemath/sage/tree/master/src/sage))

