[sympy] Solving Integral with Symbolic Computation (Sympy), Division and Tricky Limits

2018-10-19 Thread bb
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 +

Re: [sympy] Solving Integral with Symbolic Computation (Sympy), Division and Tricky Limits

2018-10-19 Thread Aaron Meurer
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

Re: [sympy] Solving Integral with Symbolic Computation (Sympy), Division and Tricky Limits

2018-10-19 Thread Oscar Benjamin
On Fri, 19 Oct 2018 at 22:09, Aaron Meurer wrote: > > 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

Re: [sympy] Solving Integral with Symbolic Computation (Sympy), Division and Tricky Limits

2018-10-19 Thread Oscar Benjamin
On Fri, 19 Oct 2018 at 17:17, bb wrote: > > A physics teacher on an online course [presented][1] this integral, I haven't looked at the video but... > from sympy import integrate, sqrt, Symbol, pprint > y = Symbol('y') > x = Symbol('x') > print (integrate('1/