Mean of inverse probability distribution does not agree with explicit integral

I tried to work with the inverse exponential distribution and encountered the following, which I think is an inconsistency in Mathematica (version 10.0.2):

dist = ExponentialDistribution[l];
distInv = TransformedDistribution[1/x, x\[Distributed]dist];

pdfInv[y_] = PDF[distInv, y] ;
pdfInv[y] // InputForm
(*Out: Piecewise[{{l/(E^(l/y)*y^2), y > 0}}, 0] *)

Mean@distInv
(*Out: -l (EulerGamma + Log[l]) *)

int = Assuming[yMax > 0 && l > 0, Integrate[y pdfInv[y], {y, 0, yMax}]]
(* l Gamma[0, l / yMax] *)

Limit[int, yMax->\[Infinity]]
(* l \[Infinity] *)

Basically, Mathematica claims that the mean of the inverse exponential distribution can be calculated and it gives an explicit expression for it (see above). However, I then tried to solve the integral of the expectation value explicitly and I think I showed that it diverges. Is there any flaw in my argumentation or is this a problem with Mathematica?

=================

  

 

What version are you using? In 10.1.0 I get Mean@distInv evaluates to Infinity.
– Stefan R
May 8 ’15 at 19:16

  

 

David, @StefanR I am on v.10.1.0 as well, and Mean@distInv returns Infinity for me as well. I have also noticed that you may be missing a : in your definition of pdfInv.
– MarcoB
May 8 ’15 at 19:41

  

 

I’m on v. 10.0.2, which might be the cause of the problem. I try to update and will report later.
– David Zwicker
May 8 ’15 at 20:05

=================

1 Answer
1

=================

It turns out this was a bug with version 10.0.2 of Mathematica. Upgrading to 10.1.0 resolved the issue and Mean@distInv now returns infinity.

  

 

Glad to hear that it was sorted out already.
– MarcoB
May 8 ’15 at 20:54

  

 

Yeah, thanks to you guys. I’m always surprised by the confidence with which Mathematica spits out results, which turn out to be wrong 🙂
– David Zwicker
May 8 ’15 at 21:02

1

 

It’s scary actually… Since MMA results are correct “most of the time”, it’s easy to be lulled into complacency. I try to force myself to build in some verification tests into my calculations, much as you did in this case, but it’s a lot of extra work! Nonetheless, I would be so much worse off without MMA that I can’t even begin to complain…
– MarcoB
May 8 ’15 at 21:30

  

 

I completely agree and I was joking… Although it would be funny to have Mathematica hesitate to display a result when it is not completely sure 🙂
– David Zwicker
May 8 ’15 at 21:33

2

 

@DavidZwicker: That is covered in the Experimental`Umm,Maybe context…
– ciao
May 8 ’15 at 22:17