Thanks for sharing. One thing I would suggest, to avoid mixing SymPy and NumPy functions, is to only import sympy and numpy as
import sympy as sym
import numpy as np
and then use sym.cos or np.cos. Otherwise, one cell has SymPy cos and another has NumPy cos, and it can be very confusing, since you cannot use SymPy functions on NumPy arrays or NumPy functions on SymPy expressions.
You can also use sympy.lambdify to convert a SymPy expression into a NumPy function for use with matplotlib, like
x = sympy.Symbol('x')
expr = sympy.cos(x) + 1
f = lambdify(x, expr)
t = np.linspace(-10, 10, 100)
plt.plot(t, f(t))
That way you don't have to rewrite the expression if you already have it in SymPy.
Aaron Meurer