Math Help - IID sample range distribution function, numerical integral

1. IID sample range distribution function, numerical integral

Hello,

suppose we have a IID sample drawn from a standard normal distribution (although this could be extended to any pdf), then, if we define the range as usual as:

r = max(x) - min (x)

we could try to derive the pdf of this range.

The problem is that I end up with an unstable numerical integral, and it comes out from this reasoning:

Let's start by finding the cdf (cumulative distribution function): we choose at random one of the sample elements to be the minimum, and assume it comes out having the value x. Given this minimum, the probability that the range is less or equal to r* is easy to derive (see later the formulas). We multiply this probability by n because we chose the minimum at random, and we integrate over all possible values of x.

The formulas for the cdf and the pdf are available at the following link:

which could have been directly derived with the following line of reasoning:

choose a couple of elements which will be the max and the min from the sample at random. There are n(n-1)/2 such elements. The other n-2 elements are between our chosen min (which is at x) and our chosen max (which is at x+r). We multiply by 2 because we could switch the roles of max and min in our couple and integrate over all possible x's.

Now, I have to calculate the expected value of r from this formula to compare it with the d2(n) tables used in statistical quality control, which I think they calculated using monte carlo simulations.

Can you help me check if the line of reasoning is correct, and if so, how to evaluate the integral?

To evaluate the distribution mean for various n's I tried GNU Octave with the integrate package, using the quad2dg function, but it doesn't converge even for finite integration limits.

Thank you

2. I found out that it was already published in 1925.... Fail! Although the numerical integral was solvable on a faster pc and it gave me the same results of the table.