Search code examples
pythontypeerrorsympysymbolic-integration

Error with Python Sympy computing integral for the area of a circle


I am using iSympy to computing integral of area of a circle, but keep getting "TypeError: symbolic boolean expression has no truth value."

In [2]: x, y, r = symbols('x, y, r')

In [3]: integrate(sqrt(r**2 - x**2), (x, -r, r))

the Error:

C:\Python27\lib\site-packages\sympy\core\relational.pyc in __nonzero__(self)
109
110     def __nonzero__(self):
--> 111         raise TypeError("symbolic boolean expression has no truth value.")
112
113     __bool__ = __nonzero__

TypeError: symbolic boolean expression has no truth value.

Any suggestions would be appreciated.


Solution

  • This is a bug in SymPy, which will be fixed in the next version.