|
|
SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible. SymPy is written entirely in Python and does not require any external libraries.
SymPy is easy to install and get started with. See the download instructions and tutorial for more information. It works everywhere, where Python 2.4 or newer is installed (Linux, Windows, Mac Os X, ...).
If you found a bug, please report it in Issues or the mailinglist.
wiki.sympy.org: we encourage you to edit/improve/add anything to the wiki, it's open to everyone.
News
- 26 Apr 2008 Version 0.5.14 released (changes)
- 21 Apr 2008 Results of the GSoC applications announced.
- 31 Mar 2008 Google has extended the GSoC application deadline to April 7.
- 27 Mar 2008 docs.sympy.org launched.
- 24 Mar 2008 GSoC Student application period opens. See GSoC2008 for details.
- 06 Mar 2008 Version 0.5.13 released (changes)
- 27 Jan 2008 Version 0.5.12 released (changes)
- 07 Jan 2008 Version 0.5.11 released (changes)
- 04 Jan 2008 Version 0.5.10 released (changes)
Downloads
Use "Featured Downloads" on the right hand side. For more options and information, go to the Downloads tab.
Mercurial repository (you can track current progress in there): http://hg.sympy.org/sympy/
Documentation
All documentation is at: http://docs.sympy.org/
Features
Currently, SymPy core has around 6300 lines of code (including extensive comments and docstrings) and its capabilities include:
- basic arithmetics *,/,+,-,**
- basic simplification (like a*b*b + 2*b*a*b -> 3*a*b^2)
- expansion (like (a+b)^2 -> a^2 + 2*a*b + b^2)
- functions (exp, ln, ...)
- complex numbers (like exp(I*x).expand(complex=True) -> cos(x)+I*sin(x))
- differentiation
- taylor (laurent) series
- substitution (like x -> ln(x), or sin -> cos)
- arbitrary precision integers, rationals and floats
- noncommutative symbols
- pattern matching
Then there are SymPy modules (18200 lines including documentation) for these tasks:
- more functions (sin, cos, tan, atan, asin, acos, factorial, zeta, legendre)
- limits (like limit(x*log(x), x, 0) -> 0)
- integration using extended Risch-Norman heuristic
- polynomials (division, gcd, square free decomposition, groebner bases, factorization)
- solvers (algebraic, difference and differential equations, and systems of equations)
- symbolic matrices (determinants, LU decomposition...)
- Pauli and Dirac algebra
- geometry module
- plotting (2D and 3D)
There are extensive tests (6148 lines in 58 files) for every single feature in SymPy. More...
Related projects
- Sage: an open source alternative to Mathematica, Maple, Matlab and Magma (SymPy is included in Sage)
- mpmath: a Python library for arbitrary-precision floating-point arithmetic (included in SymPy)
- pyglet: a fast cross-platform windowing and multimedia library in pure Python, that we use in SymPy for 2D and 3D stuff
- sympycore: another Python CAS (see SymPyCore for more information)
- symbide: GUI for SymPy in PyGTK
- sfepy: Full featured finite element library written in Python and C
- symfe: Lightweight symbolic finite element calculations in Python (sfepy will use symfe in the future)
- scipy.org: SciPy + NumPy
The community around all these tools is wonderful, feel free to join the respective lists of these projects and also share your code, so that we can build on each other's work.
Things we are working on
- Make SymPy very easy to use within Sage
- See also Issues
- You can also check our blogs: PlanetSympy
- Or join us at #sympy on irc.freenode.net
But generally, we are trying to polish things, fix bugs, improve documentation, make SymPy reliable and faster. It's very important for us, that you grab the tarball and it just works (if it doesn't, it's a bug and please report it). Until we reach the 1.0 version, the internal structure of SymPy can change, as we are still investigating the most efficient ways of doing symbolic manipulation in Python, but from the user point of view, the API shouldn't change much, unless there is a very good reason for it.
Some ideas for future development
- improve the integration algorithm, so that SymPy can integrate anything that can be integrated.
- improve series expansion
- asymptotic expansion
- objects with indices (tensors)
- rewrite the core to C++ or C or Cython, and use it as an optional module, if the user would like to speed things up (in any case the Python core will always be the default)
and more... Feel free to tell us your ideas in Issues or the mailinglist.
Motivation
Why another CAS? What is the SymPy's relationship to Sage?
Everything is explained in the Motivation.
Usage
Example in the python interpreter:
>>> from sympy import Symbol, cos
>>> x = Symbol('x')
>>> e = 1/cos(x)
>>> print e.series(x, 0, 10)
1 + (1/2)*x**2 + (5/24)*x**4 + (61/720)*x**6 + (277/8064)*x**8 + O(x**10)There is a nice console isympy (in the bin directory, or if you installed the deb, it will be in /usr/bin/isympy) which just imports sympy and defines symbols x,y,z for you, so the above thing can be achieved by starting isympy and typing this one line:
In [1]: (1/cos(x)).series(x, 0, 10)
Out[1]:
2 4 6 8
x 5*x 61*x 277*x
1 + ── + ──── + ───── + ────── + O(x**10)
2 24 720 8064 Read the tutorial for more examples.
Development
If you wrote anything interesting using SymPy, please donate your code back to the project, so that other people can easily use it and we can grow as the community. You are welcomed to join the development. If you find a bug or just want to say what you think, tell us on the mailinglist (or put your comment/bug report into the Issues). We are interested in your opinions if you think the SymPy's interface is not as you would expect or if you created some algorithm using SymPy and would like it to become part of SymPy (so that others can easily use your code as well).
More information can be found in SympyDevelopment.
See also the list of contributors.
