Saturday, February 11, 2023

Impressed with sympy

I know this doesn't even come close to scratching the surface of what's possible with it, but I was impressed with this little interaction with sympy already:
import sympy
from sympy import Rational

a = sympy.symbols('a')
e = Rational(13, 4) * (5 - 6 * a) - Rational(1, 4) * (Rational(1, 3) * a - 3)
print(sympy.latex(e))
$$22 - \frac{307 a}{12}$$