First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The problem comes from the fact that Sage does not know that its own abs should be translated into sympy.Abs (see the upper case). This has been fixed in trac ticket 15057, and merged today in Sage 6.4.beta3. Your options are:

  • compile Sage 6.4.beta3
  • wait for Sage 6.4 official release
  • let sympy know about abs

For this, just add the following before your code:

sage: import sympy
sympy.abs = sympy.Abs

In you last line, you will get (i did not check it it the expected result though):

sage: sympy.sympify(d)
-sqrt(Abs(-h + s*sin(theta))**2 + Abs(r - s*cos(theta))**2) + sqrt(Abs(-h*sin(phi) + r*cos(phi) - s*cos(theta))**2 + Abs(-h*cos(phi) - r*sin(phi) + s*sin(theta))**2)