Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am referring to this example at the reference page for the extreme value distribution:

The first three commands seem to be running ok, but the last line of code just will not stop evaluating on my machine (MathematicaMark9 result > 1.5) - somthing seems to be very wrong:

Show[DiscretePlot[Mean[max\[ScriptCapitalD]], {n, 2, 100}, PlotStyle -> Orange], 
 Plot[approxMean, {n, 2, 100}, PlotRange -> All, PlotStyle -> Directive[Thick, Dashed]]]

What am I doing wrong? Or is that a mistake in the documentation or an error in Mathematica 9.0.1?

Edit: I added the bugs tag because it seems clear by now that this is really a bug in Version 9.0.1, see answer and comments below.

share|improve this question
up vote 6 down vote accepted

The problem appears to stem from evaluating Mean[max\[ScriptCapitalD]] for values of n greater than 5. For n between 2 and 5, the evaluation takes place in more-or-less constant time. For n = 6, the timing jumps to over 247 seconds (on my system).

  {#[[1]] + 1, First @ AbsoluteTiming[Mean[max\[ScriptCapitalD]] /. n -> #[[1]] + 1]} &, 
  {1, 0},
{{1, 0}, {2, 1.217399}, {3, 1.220662}, {4, 1.221624}, {5, 1.220797}, {6, 247.914156}}

I smell a bug in OrderDistribution.


I reported this problem to WRI tech support. I have received the following reply:

Thanks for reporting the issue. I've sent your message to the corresponding development team and I will keep you posted if I hear any news from them. Thanks again for bringing the problem to our attention!

This may be regarded as official WRI confirmation that the behavior by vonid is a bug.

Update 2

In V10 the bug hasn't been fixed, but the documentation has been revised to use a work-around. In the definition of max\[ScriptCapitalD] in the referenced example, NormalDistribution is passed machine precision reals as the values for its mean and standard deviation arguments. In the V9 documentation, NormalDistribution was called without arguments and used the default exact values 0 and 1.

max\[ScriptCapitalD] = OrderDistribution[{NormalDistribution[0., 1.], n}, n];
Table[val = {i, First@AbsoluteTiming[Mean[max\[ScriptCapitalD]] /. n -> i]}, {i, 6}]
{{1, 1.006853}, {2, 1.010143}, {3, 1.010674}, {4, 1.013509}, {5, 1.013680}, {6, 1.027929}}

The evaluation of Mean[max\[ScriptCapitalD]] is now done in what is essentially constant time.

share|improve this answer
I get {{1, 0}, {2, 0.797534}, {3, 0.789527}, {4, 0.793531}, {5, 0.799535}, {6, 160.987567}} on my machine which confirms the effect. – vonjd May 4 '14 at 13:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.