Reference articles on history, science, culture and more
Encyclopedia

SymPy

Python library for symbolic computation

Image credit is listed at the end of this article.

SymPy is an open-source Python library for symbolic computation. It provides computer algebra capabilities either as a standalone application, as a library to other applications, or live on the web as SymPy Live or SymPy Gamma. SymPy is simple to install and to inspect because it is written entirely in Python with few dependencies. This ease of access combined with a simple and extensible codebase in a well-known language make SymPy a computer algebra system with a relatively low barrier to entry.

SymPy includes features ranging from basic symbolic arithmetic to calculus, algebra, discrete mathematics, and quantum physics. It is capable of formatting the result of the computations as LaTeX code.

SymPy is free software and is licensed under the 3-clause BSD. The lead developers are Ondřej Čertík and Aaron Meurer. It was started in 2005 by Ondřej Čertík.

01Features

The SymPy library is split into a core with many optional modules.

Currently, the core of SymPy has around 260,000 lines of code (it also includes a comprehensive set of self-tests: over 100,000 lines in 350 files as of version 0.7.5), and its capabilities include:

Core capabilities

Polynomials

Calculus

Solving equations

Discrete math

Matrices

Geometry

Plotting

Note, plotting requires the external Matplotlib or Pyglet module.

  • Coordinate models
  • Plotting Geometric Entities
  • 2D and 3D
  • Interactive interface
  • Colors
  • Animations

Physics

Statistics

Combinatorics

Printing

03Dependencies

Since version 1.0, SymPy has the mpmath package as a dependency.

There are several optional dependencies that can enhance its capabilities:

  • gmpy: If gmpy is installed, SymPy's polynomial module will automatically use it for faster ground types. This can provide a several times boost in performance of certain operations.
  • matplotlib: If matplotlib is installed, SymPy can use it for plotting.
  • Pyglet: Alternative plotting package.
Watch videos about SymPyExplainers and documentaries on YouTube (opens in a new tab)

Sources and credits

This article is adapted from the Wikipedia article SymPy, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.

Images, from Wikimedia Commons:

Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.