5.6 Symbolic computation
In mathematics, we see more than numbers and numeric vectors and matrices. Polynomials are used in many disciplines, though they do not have a native Python implementation. In a polynomial, we use an “indeterminate” symbolically without requiring a numeric value. For example,
The computer science discipline that deals with these and more advanced mathematical objects is called “computer algebra” or “symbolic mathematical computation.” [AXM]
The sympy package implements symbolic computation tools, and its documentation showcases its broad functionality. It is not part of the Python Standard Library, so you must install it via a command from the operating system command line:
pip install sympy
Several examples give you an idea of what sympy can do.
We first define an indeterminate symbol x and a polynomial p.
import sympy...