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?!

  • 2
    Integrate[(1 + 1/y) (E^(-y)), {y, 0, \[Infinity]}, GenerateConditions -> False] – ciao Jun 16 '16 at 21:54
  • Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Jun 16 '16 at 22:18
  • 2
    Using NIntegrate, it is fairly clear that the integral does not converge. I guess that Expectation is using some formula that is outside its domain of validity. – mikado Jun 16 '16 at 22:34
  • 1
    @mikado - I'd expect and expectation of infinity... and in fact Mean@TransformedDistribution[ 1 + 1/y, {y \[Distributed] ExponentialDistribution[1]}] gives just that. – ciao Jun 16 '16 at 23:20
  • 1
    Thanks for the responses. I still don't know what the are conditions whose removal gives the 1 - EulerGamma answer, but common sense concensus is that it must be wrong. – puelmato Jun 17 '16 at 7:24

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.