# Question:Efficiency and large arrays

## Question:Efficiency and large arrays

Maple

Is there a faster way to do the following code? This takes 6.5 hours to run for n:=10...

> with(Statistics):
n := 1:
A := Array(1..10000000):

> for k to 10000000 do
t := RandomTools:-Generate(list(float(range=0..1,digits=20,method=uniform), n)):  # chooses 6 random variables from the interval [0,1]

t := sort(t):   # sort them in ascending order

A[k] := max(seq(max(abs(i/n - t[i]), abs((i-1)/n - t[i])), i = 1..n)):   # places these in the formula i have and defines the k'th array member as the maximum of the 6 values obtained from the formula.
end do:

Note this code is thanks to Joe Riel, it works great but since I'm dealing with 10 million entries in the array I'd like to know if there is a more efficient way of doing this.

Then comes the problem of trying to find the mean, variance and standard deviation of the array entries. This usually results in the "kernel has failed" type error message so once again, is there a better way to deal with a very large collection of data. I have just been using the Mean, Variance, etc commands for now.