SymPy

SymPy http://www.sympy.org is a Python library for symbolic math.

Symbolic Math is using symbols to represent mathematical expressions. An example symbolic math expression is below:

$$ x^{2} + y^{2} = z $$

In the expression, we have the variables $x$, $y$ and $z$.

If we define a second symbolic math expression as:

$$ x = a + b $$

then we can substitue in $a + b$ for $x$.

This would result in the expression:

$$ (a + b)^{2} + y^{2} = z $$$$ a^{2} + 2ab + b^{2} + y^{2} = z $$

Now to solve for $y$ in terms of $a$,$b$ and $z$, would result in:

$$ y = \sqrt{z - a^{2} - 2ab - b^{2}} $$

If we have numerical values for $z$, $a$ and $b$, we can use Python to calculate the value of $y$. But if we don't have numberical values for $z$, $a$ and $b$ Python can also be used to rearrange terms and solve for one variable in terms of the other. Working with mathemtical symbols in a programatic way instead of working with numerical values in a programatic way is call symbolic math.

To work with symbolic math, the SymPy library needs to be installed. Using the Anaconda Prompt this can be accomplished with the command:

> conda install sympy

Sympy is included with the Anaconda distribution of Python, so if you have the full Anaconda distrobution, you will be notified that the Sympy library is already installed.


In [ ]: