Thanks, Kalevi, the limit approach works well for the issue above.

But I find another interesting limit issue:
import sympy as sp
sp.init_printing()

sigma=sp.Symbol('sigma', positive=True)
mu=sp.Symbol('mu',domain=sp.S.Reals)
x=sp.Symbol('x')
C=sp.Symbol('C')
f=1/sp.sqrt(2*sp.pi*sigma**2)*sp.exp(-(x-mu)**2/(2*sigma**2))
g=sp.integrate(f,x)+C

t=sp.solve(g.subs(x,mu)-1/2,C)[0]

print("Without simplify everything looks ok:")
h=g.subs(C,t)
print(h)
print(sp.limit(h,x,sp.oo))
print(sp.limit(h,x,-sp.oo))

print("Without simplify the result looks strange:")
h=sp.simplify(g.subs(C,t))
print(h)
print(sp.limit(h,x,sp.oo))
print(sp.limit(h,x,-sp.oo))



The output I get is

rd@h370:~/Downloads$ python3 ~/Downloads/example_integrate_gauss.py
Without simplify everything looks ok:
erf(sqrt(2)*(-mu + x)/(2*sigma))/2 + 0.5
1.00000000000000
0
Without simplify the result looks strange:
-erf(sqrt(2)*(mu - x)/(2*sigma))/2 + 0.5
0
0
rd@h370:~/Downloads$ 

The simply output still looks ok for me, but the first limit output after 
applying simplify seems to be wrong (?)

Rainer

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/3c35156c-fba4-4e23-a844-821b1ab9b9e4%40googlegroups.com.

Reply via email to