A Python library for symbolic mathematics. Among others things, it provides:
In [3]:
try:
from sympy import init_session
except:
!pip3 install sympy
from sympy import init_session
init_session(use_latex='matplotlib')
In [4]:
# https://github.com/AeroPython/Taller-Aeropython-PyConEs16
expr = cos(x)**2 + sin(x)**2
expr
Out[4]:
In [5]:
simplify(expr)
Out[5]:
In [6]:
expr.subs(x, y**2)
Out[6]:
In [7]:
expr = (x + y) ** 2
expr
Out[7]:
In [8]:
expr = expr.expand()
expr
Out[8]:
In [9]:
expr = expr.factor()
expr
Out[9]:
In [10]:
expr = expr.integrate(x)
expr
Out[10]:
In [11]:
expr = expr.diff(x)
expr
Out[11]: