2008/10/3 Roger Hui <[EMAIL PROTECTED]>: > deal=: 5 ? 52 #~ ] > > Let's say you want to do 4 deals at a time: [...] > Suppose the statistics you want to calculate is "average": > > avg=: +/ % # > [EMAIL PROTECTED]"0 ] 3$4 > 18.25 39 14.75 29 23.75 > 19.5 26.75 26 27.5 42 > 24 27.75 30 19 30.5 > > 100 repetitions of one million deals at a time, calculating > of average of each repetition: > > [EMAIL PROTECTED]"0 ] 100$1e6 > 25.5006 25.5132 25.4944 25.5042 25.4847 > 25.5046 25.4968 25.4929 25.5101 25.4952 > 25.5099 25.4909 25.4984 25.5091 25.5041 > 25.5058 25.5113 25.505 25.5203 25.4969 > 25.5065 25.4932 25.499 25.492 25.4825
Ah, I see. So because [EMAIL PROTECTED]"0 has rank 0, the loop is over 100 copies of 1e6, doing one at a time and so never having 100e6 values in memory at once. (Once I understand the rank processing, it's so much easier to say via the formula than in words!) Thanks for the help, Paul. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
