Sympy

Posted : admin On 1/25/2022
  • SymPy Tutorial
  • SymPy Useful Resources
  1. Sympy Subs
  2. Sympy Python
  • Selected Reading

SymPy is a Python library for symbolic mathematics. It aims to be an alternative to systems such as Mathematica or Maple while keeping the code as simple as possible and easily extensible. SymPy is written entirely in Python and does not require any external libraries. Jul 06, 2020 SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system. SymPy includes features ranging from basic symbolic arithmetic to calculus, algebra, discrete mathematics and quantum physics. It is capable of showing results in LaTeX.


SymPy has one important prerequisite library named mpmath. It is a Python library for real and complex floating-point arithmetic with arbitrary precision. However, Python's package installer PIP installs it automatically when SymPy is installed as follows −

Other Python distributions such as Anaconda, Enthought Canopy, etc., may have SymPy already bundled in it. To verify, you can type the following in the Python prompt −

And you get the below output as the current version of sympy −

'1.5.1'

Source code of SymPy package is available at https://github.com/sympy/sympy.

Mpmath

For Math courses using Python, Sympy, Numpy, Matplotlib, and Jupyter, the Calclabsystems will have these installed for use during your weekly lab. To start aJupyter notebook, simply click the Jupyter icon on the bottom panel of your desktopor open a Terminal window and type:

Sympy symbols

Installing Python/SymPy/NumPy/Matplotlib/Jupyter on your computer

Outside of the lab, you will want to install these on your own computer. Sound expensive? Relax, they're all free!You will need Python 3 from the Anaconda distribution. This is afree Python distribution that includes SymPy, NumPy, Matplotlib, and Jupyter,making the installation quite simple.It can be downloaded for Windows, MacOS, and Linux fromhttps://www.anaconda.com. Be sure to selectversion 3 for your download.

Alternative installation for Linux

If you're confident with your Linux administration skills, your Linux distribution may already include python3, python3-sympy, and python3-numpy.You may need to manually install jupyter using pip.For example on Linux Mint18 (based on Ubuntu 16.04), all of the packages may be installedwith the following commands:

Running the Notebook

The Jupyter notebook can be launched from the command line in a Terminal window(Linux/MacOS) or Command Prompt (Windows):

This will start a browser window and connect to the local jupyter server thatyou just started.

Example

Sympy
  • Notebook (right-click and Save Link As) showcasing capabilitiesof SymPy, NumPy, and Matplotlib. Launch jupyter and open this notebook.

References

  • SymPy - Symbolic Mathematics for Python
  • NumPy - Large Arrays, Matrices, and High Level Math Functions for Python
  • Jupyter - Web applicaton notebook for creating and sharing documents

Sympy Subs

SympyTutorial

Sympy Python


Copyright © 2019, Texas A&M University, All Rights Reserved.