On Tue, 17 Jan 2023 at 10:39, 'Tom van Woudenberg' via sympy
<sympy@googlegroups.com> wrote:
>
> Hi there,
>
> I'm trying to symbolically evaluate an integral with SymPy:
>
> import sympy as sp
> q, L, H = sp.symbols('q L H',positive=True,real=True)
> x = sp.symbols('x',real=True)
> Lexact = sp.integrate(sp.sqrt((L*q/(2*H) - q*x/H)**2 + 1),(x,0,L))
> print(Lexact)
>
> The result is:
> Integral(sqrt(4*H**2 + L**2*q**2 - 4*L*q**2*x + 4*q**2*x**2), (x, 0, L))/(2*H)
> So the integral isn't evaluated.

Which version of sympy are you using?

I just tried sympy 1.11.1 and also latest master and the integral does evaluate:

In [1]: import sympy as sp
   ...: q, L, H = sp.symbols('q L H',positive=True,real=True)
   ...: x = sp.symbols('x',real=True)
   ...: Lexact = sp.integrate(sp.sqrt((L*q/(2*H) - q*x/H)**2 + 1),(x,0,L))
   ...: print(Lexact)
-(-H**2*asinh(L*q/(2*H))/q - L*sqrt(4*H**2 + L**2*q**2)/4)/(2*H) +
(H**2*asinh(L*q/(2*H))/q + L*sqrt(4*H**2 + L**2*q**2)/4)/(2*H)


> It should evalute to 
> (4*H**2*arcsinh(q*L/(2*H))+q*L*sqrt(L882*q**2+4*H**2))/(4*q*H)

I'm guessing that L882 is supposed to be L**2 because then it matches
what I get from sympy:

In [3]: print(Lexact.factor())
(4*H**2*asinh(L*q/(2*H)) + L*q*sqrt(4*H**2 + L**2*q**2))/(4*H*q)

--
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 sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxRMM9a0hSGCJqGc2QG5vdso%2BAXM--RtpkRyBW3JfD6%3Drg%40mail.gmail.com.

Reply via email to