1>>> from sympy.solvers import solve
2>>> from sympy import Symbol
3>>> x = Symbol('x')
4>>> solve(x**2 - 1, x) #Your equation here
5[-1, 1]
6
1def express(a, b, name):
2 sym = symbols(name)
3 sol = solve(a-sym, b)
4 assert len(sol) == 1
5 return (sym, sol[0])