Apparently, Sympy fails to find the closed form solution of this integral.
You can, however, help Sympy perform the integration. One approach is to perform a transformation of the integration variable with the hope that it will result in a simpler integrand expression that Sympy can handle. Sympy offers a convenient transform()
method for this purpose.
import sympy as sp
import sympy.stats
mu, sigma = 0, 1
z = sp.Symbol('z', nonnegative=True)
X = sympy.stats.LogNormal('x', mu, sigma)
f = sympy.stats.density(X)(z)
I = sp.Integral(f, (z, 0, sp.oo))
print(I)

This is the original integral form, which Sympy fails to evaluate. (Note the use of sympy.Integral
which returns an unevaluated integral.) One (obvious?) transformation of the integration variable is z -> exp(z)
, which results in a new integral as follows
I2 = I.transform(z,sp.exp(z))
print(I2)

Now, we may call the doit()
method to evaluate the transformed integral:
I2.doit()
1