Integral solver. Wrong solution

29 views
Skip to first unread message

Andrea Nicoletta

unread,
May 22, 2020, 3:36:18 AM5/22/20
to sympy
I'm trying to solve an integral with sympy. But it gives me a wrong solution. Why?
```
import sympy
from sympy import Integral, exp, oo

x, y = sympy.symbols("x y", real=True)
b, u, l, t = sympy.symbols("b u l t ", real=True, positive=True)
Fortet = Integral(exp(-l * t) * (sympy.sqrt(2 * sympy.pi * t)) ** (-1) * exp(-((b - u * t - y) ** 2) / (2 * t)),
                  (t, 0, oo))
Fortet.doit()
```
Result (wrong):

    Piecewise((-(-b/2 + y)*sqrt(2*l +
    u**2)*(-sqrt(pi)*sinh(sqrt(2)*sqrt(b)*sqrt(l +
    u**2/2)*sqrt(polar_lift(1 + y**2/(b*polar_lift(b -
    2*y))))*sqrt(polar_lift(b - 2*y))) +
    sqrt(pi)*cosh(sqrt(2)*sqrt(b)*sqrt(l + u**2/2)*sqrt(polar_lift(1 +
    y**2/(b*polar_lift(b - 2*y))))*sqrt(polar_lift(b - 2*y))))*exp(b*u -
    u*y)/(sqrt(pi)*(b - 2*y)*(l + u**2/2)), Abs(arg(1 +
    y**2/(b*polar_lift(b - 2*y))) + arg(b - 2*y)) <= pi/2),
    (Integral(sqrt(2)*exp(-l*t)*exp(-(b - t*u -
    y)**2/(2*t))/(2*sqrt(pi)*sqrt(t)), (t, 0, oo)), True))

Expected (correct) solution:
``` 
Solution = (exp((-u)*(b - y)) * exp(sympy.sqrt(u**2 + 2*l)*(b-y)))/(sympy.sqrt(2*l + u**2)) #RIGHT solution
```

Chris Smith

unread,
May 23, 2020, 11:50:27 AM5/23/20
to sympy
At which values of your variables is it giving a different answer? It looks like the SymPy result is more precise but maybe not wrong.

/c
Reply all
Reply to author
Forward
0 new messages