You can pass the limits to integrate directly: >>> integrate(1/(x**2+y**2)**Rational(3,2), (y, -L/2, L/2)) L/(x**3*sqrt(L**2/(4*x**2) + 1))
It's generally recommended to do this as it isn't always correct to substitute the upper and lower values directly. However, this result is equivalent to yours in this case, after pulling a 4 out of the square root. Aaron Meurer On Fri, Oct 19, 2018 at 10:17 AM bb <burakbayra...@gmail.com> wrote: > > A physics teacher on an online course [presented][1] this integral, > > $$ > = \frac{1}{4\pi\epsilon_0} \frac{Q x}{L} > \int _{-L/2}^{L/2} \left(\frac{dy}{(x^2+y^2)^{3/2}} \right) \hat{x} > $$ > > and said she solved it with Wolfram Alpha, which gave > > $$ > = \frac{1}{4\pi\epsilon_0} \frac{Q}{x \sqrt{x^2 + (L/2)^2}}\hat{x} > $$ > > I was wondering how to solve this using any other symbolic software like > Sympy. I tried this for the indefinite integral, > > from sympy import integrate, sqrt, Symbol, pprint > y = Symbol('y') > x = Symbol('x') > print (integrate('1/ ((x**2+y**2)**(3/2))',y)) > > Result is > > y/(x**3*sqrt(1 + y**2/x**2)) > > I plugged in the limits, > > from sympy import simplify > L = Symbol('L') > x = Symbol('x') > simplify((L/2)/(x**3*sqrt(1 + (L/2)**2/x**2)) - \ > (-L/2)/(x**3*sqrt(1 + (-L/2)**2/x**2))) > > I get > > 2*L/(x**3*sqrt(L**2/x**2 + 4)) > > which does not look right. Does anyone have any experience solving integrals > such as the one above using symbolic software? > > [1]: https://youtu.be/pJwg2Bk0BDE?t=1286 > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sympy+unsubscr...@googlegroups.com. > To post to this group, send email to sympy@googlegroups.com. > Visit this group at https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/16ad42e1-4972-46e2-8860-2bb96137f265%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2BjxGY_Ts2TkQ7rpxA3D_xkYCbhUGg38yaHHKYsze0TBg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.