Creating and Manipulating Symbolic Expressions in Python

Author: David Manuel
In this video, it is shown how to create a symbolic expression in Python with a variable, and then how to factor, expand, and simplify the expression. It is also shown how to evaluate the expression by substituting a value for the variable.

Transcript 03

Exercises

Python Code: 
from sympy import *

x=symbols('x')
f=x**4+5*x**3+8*x**2+x-15
print(f.factor())
f_factor=f.factor()
print(f_factor.expand())
g=f/(x**2-1)
print(g.simplify())
print(g.subs(x,1))
print(g.simplify().subs(x,1))

Open Python Notebook File