author | Alpar Juttner <alpar@cs.elte.hu> |
Mon, 06 Dec 2010 13:09:21 +0100 | |
changeset 1 | c445c931472f |
permissions | -rw-r--r-- |
1 /*Arithmetic Mean of a large number of Integers
2 - or - solve a very large constraint matrix
3 over 1 million rows and columns
4 Nigel_Galloway@operamail.com
5 March 18th., 2008.
6 */
8 param e := 20;
9 /* set Sample := {-2**e..2**e-1}; */
10 set Sample := {1..2**e-1};
12 var Mean;
13 var E{z in Sample};
15 /* sum of variances is zero */
16 zumVariance: sum{z in Sample} E[z] = 0;
18 /* Mean + variance[n] = Sample[n] */
19 variances{z in Sample}: Mean + E[z] = z;
21 solve;
23 printf "The arithmetic mean of the integers from 1 to %d is %f\n", 2**e-1, Mean;
25 end;