Expected value of index of coincidence
Script started on Thu Aug 21 14:17:56 1997
sh-2.00$ cat eic.c
/* Expected value of index of coincidence */
#include <stdio.h>
#define eic(d,n) ( (n-d)*0.066/d/(n-1) + n * 0.038 / (n-1) * (d-1)/ d)
main()
{
int d, n;
printf("Expected value of the index of coincidence for various values of \n");
printf("and d: \n");
for( n = 100; n < 2000; n *= 2)
{
printf("\n\n n = %d \n",n);
for(d = 1; d < 31; d += (d < 10 ? 1 : 5) )
printf("%2d %0.12f\n",d,eic(d,n) );
}
}
sh-2.00$ eic
Expected value of the index of coincidence for various values of
and d:
n = 100
1 0.066000000000
2 0.051858585859
3 0.047144781145
4 0.044787878788
5 0.043373737374
6 0.042430976431
7 0.041757575758
8 0.041252525253
9 0.040859708193
10 0.040545454545
15 0.039602693603
20 0.039131313131
25 0.038848484848
30 0.038659932660
n = 200
1 0.066000000000
2 0.051929648241
3 0.047239530988
4 0.044894472362
5 0.043487437186
6 0.042549413735
7 0.041879396985
8 0.041376884422
9 0.040986041318
10 0.040673366834
15 0.039735343384
20 0.039266331658
25 0.038984924623
30 0.038797319933
n = 400
1 0.066000000000
2 0.051964912281
3 0.047286549708
4 0.044947368421
5 0.043543859649
6 0.042608187135
7 0.041939849624
8 0.041438596491
9 0.041048732943
10 0.040736842105
15 0.039801169591
20 0.039333333333
25 0.039052631579
30 0.038865497076
n = 800
1 0.066000000000
2 0.051982478098
3 0.047309970797
4 0.044973717146
5 0.043571964956
6 0.042637463496
7 0.041969962453
8 0.041469336671
9 0.041079961062
10 0.040768460576
15 0.039833959116
20 0.039366708385
25 0.039086357947
30 0.038899457655
n = 1600
1 0.066000000000
2 0.051991244528
3 0.047321659370
4 0.044986866792
5 0.043585991245
6 0.042652074213
7 0.041984990619
8 0.041484677924
9 0.041095545827
10 0.040784240150
15 0.039850323119
20 0.039383364603
25 0.039103189493
30 0.038916406087
sh-2.00$ exit
exit
script done on Thu Aug 21 14:18:05 1997