I'm new to using Sympy, though I can do definite integrals with something like integrate(atan(x), (x, 0, pi/2))
. But how do I evaluate the integral non-numerically (symbolically)? Moreover, how do I evaluate any integral symbolically?
Sympy gives a numerical approximation even without evalf()
. However, I want a symbolic approximation that uses pi, log, etc. I know that something like nsimplify()
works.
If you use sympy's symbolic pi, then you will get a symbolic result. If you use a numerical pi value then you will get a numerical result.
import sympy as smp
x = smp.symbols("x")
smp.integrate(smp.atan(x), (x, 0, smp.pi/2))
import sympy as smp
import numpy as np
x = smp.symbols("x")
smp.integrate(smp.atan(x), (x, 0, np.pi/2))