# Revision history [back]

You just need to convert the sympy solution back to a Sage expression:

sage: sol=solve(eq1, h)
sage: sol1=sol[0]._sage_()
sage: sol1
s*sin(phi + theta) - sqrt(2*s^2*cos(phi + theta)*sin(phi)*sin(theta) + s^2*sin(phi)^2 + s^2*sin(theta)^2 + 2*r*s*cos(phi + theta) - r^2 - s^2)


You just need to convert the sympy solution back to a Sage expression:

sage: sol=solve(eq1, h)
sage: sol1=sol[0]._sage_()
sage: sol1
s*sin(phi + theta) - sqrt(2*s^2*cos(phi + theta)*sin(phi)*sin(theta) + s^2*sin(phi)^2 + s^2*sin(theta)^2 + 2*r*s*cos(phi + theta) - r^2 - s^2)


For converting a Sage expresson to sympy use sympify:

sage: from sympy import sympify
sage: from sympy.solvers import solve
sage: solve(sympify(x^2-1),x)
[-1, 1]


You just need to convert the sympy solution back to a Sage expression:

sage: sol=solve(eq1, h)
sage: sol1=sol[0]._sage_()
sage: sol1
s*sin(phi + theta) - sqrt(2*s^2*cos(phi + theta)*sin(phi)*sin(theta) + s^2*sin(phi)^2 + s^2*sin(theta)^2 + 2*r*s*cos(phi + theta) - r^2 - s^2)


For converting a Sage expresson expression to sympy use sympify:

sage: from sympy import sympify
sage: from sympy.solvers import solve
sage: solve(sympify(x^2-1),x)
[-1, 1]