I would like to integrate the function :
$$ int_0^R sqrt(R^2 - x^2) dx $$
from sympy import *
x = symbols('x')
R = symbols('R', real = True, constant = True)
integrate(sqrt(R**2-x**2),(x,0,R))
But it solves me this one in complex domain. Is-it possible to force sympy to give me the result which is PI R^2 ?
If you declare both x and R to be positive then you can get a simpler result but it's pi R^2/4
:
In [4]: x, R = symbols('x, R', positive=True)
In [5]: Integral(sqrt(R**2-x**2),(x,0,R)).doit()
Out[5]:
2
π⋅R
────
4