Ask Your Question

Revision history [back]

For the absolute value, you should not use |, but the abs() function. By the way:

  • you should only use parentheses, not brackets that have a different meaning in Python
  • Pi is not defined in Sage. Do not use pi which is a symbolic constant, instead, use RR.pi() that is of the same kind as c, a floating-point number.

For the absolute value, you should not use |, but the abs() function. By the way:

  • you should only use parentheses, not brackets that have a different meaning in Python
  • Pi is not defined in Sage. Do not use pi which is a an (exact) symbolic constant, instead, use RR.pi() that is of the same kind as c, a floating-point number.number (or pi.n() to tell that you want a numerical approximation of pi).

For the absolute value, you should not use |, but the abs() function. By the way:

  • you should only use parentheses, not brackets that have a different meaning in Python
  • Pi is not defined in Sage. Do not use pi which is an (exact) symbolic constant, instead, use RR.pi() that is of the same kind as c, a floating-point number (or pi.n() to tell that you want a numerical approximation of pi).). Or, define Pi = RR.pi() before your computation.

For the absolute value, you should not use |, but the abs() function. By the way:

  • you should only use parentheses, not brackets that have a different meaning in Python
  • Pi is not defined in Sage. Do not use pi which is an (exact) symbolic constant, instead, use RR.pi() that is of the same kind as c, a floating-point number (or pi.n() to tell that you want a numerical approximation of pi). Or, Alternatively, define Pi = RR.pi() before your computation.