I have a function that I want to integrate symbolically using the Sympy library. I followed the steps outlined in the website: https://docs.sympy.org/latest/modules/integrals/integrals.html
However, when I try to integrate, I just get back the integral in symbolic form: the Sympy integrate function doesn't seem to have integrated at all.
I am not sure what is wrong with my code:
s = Symbol('s')
s0 = Symbol('s0')
k = Symbol('k')
u = Symbol('u')
E = Symbol('E')
init_printing(use_unicode=False, wrap_line=False)
func = (np.pi - 2)*s/s0*(1/((1/s0**2)*(1 - k*u/E - s**2*u**2))**0.5)
integrate(func,(u,0,1/a))
I believe that I followed everything correctly, but I'm not getting the output that should show up like in the website when integrating simple functions. Was wondering if someone can help me out with this issue.
When in SymPy-land, use SymPy. Like @kikon said, no need to use a pi other than the one that SymPy provides. Since you are dividing by
s0andait would be nice to tell SymPy that you know those are not zero. The following works for me:If you use
sqrtinstead of**0.5you will get a different form: