The code:

Expectation[1 + 1/y, {y \[Distributed] ExponentialDistribution[1]}]


1 - EulerGamma


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
    $\begingroup$ Integrate[(1 + 1/y) (E^(-y)), {y, 0, \[Infinity]}, GenerateConditions -> False] $\endgroup$ – ciao Jun 16 '16 at 21:54
  • $\begingroup$ 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! $\endgroup$ – Michael E2 Jun 16 '16 at 22:18
  • 2
    $\begingroup$ 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. $\endgroup$ – mikado Jun 16 '16 at 22:34
  • 1
    $\begingroup$ @mikado - I'd expect and expectation of infinity... and in fact Mean@TransformedDistribution[ 1 + 1/y, {y \[Distributed] ExponentialDistribution[1]}] gives just that. $\endgroup$ – ciao Jun 16 '16 at 23:20
  • 1
    $\begingroup$ 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. $\endgroup$ – puelmato Jun 17 '16 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.