from sympy import * x, y = symbols('x y') y=(x**2-2)/3*x # solve the expression y (by default set equal to 0) result = solve(y) print(result)