The code:
Expectation[1 + 1/y, {y \[Distributed] ExponentialDistribution[1]}]
outputs
1 - EulerGamma
While,
Integrate[(1 + 1/y) Exp[-y], {y, 0, \[Infinity]}]
does not compute. Presumably Expectation is using something that I am not giving to Integrate. Something like domain specifications, like in this example. Maybe whether or not it includes y=0? Any suggestions for how to make this consistent? I presume Expectation is correct, but I was very surprised to see a result since Integrate[1/y Exp[-y], {y, 0, \[Infinity]}] of course does not converge for intervals starting at 0, so why would adding 1 help?!
Integrate[(1 + 1/y) (E^(-y)), {y, 0, \[Infinity]}, GenerateConditions -> False]– ciao Jun 16 '16 at 21:54NIntegrate, it is fairly clear that the integral does not converge. I guess thatExpectationis using some formula that is outside its domain of validity. – mikado Jun 16 '16 at 22:34Mean@TransformedDistribution[ 1 + 1/y, {y \[Distributed] ExponentialDistribution[1]}]gives just that. – ciao Jun 16 '16 at 23:201 - EulerGammaanswer, but common sense concensus is that it must be wrong. – puelmato Jun 17 '16 at 07:24