On Fri, 19 Oct 2018 at 17:17, bb <[email protected]> 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/ ((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.

I think this is correct. It just looks a bit strange because sympy
hasn't written it in the form you would normally use. The normal way
to write the result of the integral would be

>>> res = y/ (x**2 * (x**2+y**2)**Rational(1/2))
>>> res
y/(x**2*sqrt(x**2 + y**2))

We can see that this also differentates back to what you started with:

>>> res.diff(y)
-y**2/(x**2*(x**2 + y**2)**(3/2)) + 1/(x**2*sqrt(x**2 + y**2))
>>> simplify(res.diff(y))
(x**2 + y**2)**(-3/2)

--
Oscar

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/CAHVvXxRgWc6KBCJaOxY_Zf%2BxfEqAtcBNErJgkHzRQKWLAJLv6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to