I would like to evaluate the following integral using SymPy:
from sympy import *
x = symbols('x')
a = symbols('a', positive=True)
expr = sqrt(a**2 - x**2)
integrate(expr, (x, 0, pi/2))
What I would expect as an outcome is the area of the quarter circle (i.e., a^2*pi/4). Unfortunately, SymPy does not provide this result. When considering
integrate(expr, x)
I obtain the correct indefinite integral but when adding the limits it does not work.
Any ideas what I am doing wrong?
The limit should be a
if that is the radius and you are working in Cartesian coordinates:
from sympy import *
x = symbols('x')
a = symbols('a', positive=True)
expr = sqrt(a**2 - x**2)
integrate(expr, (x, 0, a))
That gives:
2
π⋅a
────
4