File: randomtest.mpi

package info (click to toggle)
mathpiper 0.0.svn2556-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 7,416 kB
  • ctags: 2,729
  • sloc: java: 21,643; xml: 751; sh: 105; makefile: 5
file content (33 lines) | stat: -rw-r--r-- 606 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* 
  Tests MathPiper's Randomnumber generator 
  Author Andrei Zorine, zoav1@uic.nnov.ru
*/

DefaultDerivtory("c:/src/ys/prob");
Load("incompletegamma.mpi");
Load("hypothesystest.mpi");


Function("DoTest",{size})
[
  Local(arr,o'f,e'f,i,j,m);
//  size:=200; // sample size
  arr := Table(Random(),i,1,size,1);
  arr := HeapSort(arr,"<"); 
  o'f := {};
  e'f :={};
  m:=1;
  For(i:=1, i<=10 And m<=size, i++) 
   [
     j:=0;
     While(arr[m]<i/10 And m<size) 
     [ 
       j:=j+1; 
       m:=m+1;
     ];
     Push(o'f,j);
     Push(e'f,0.1*size);
   ];
  Echo(o'f,e'f);
  ChiSquareTest(o'f,e'f); 
];