EWN variance for 50 points matches Einstein forum
19 replies. Last post: 20131118
Reply to this topic Return to forum
Carroll ★ at 20131118
@FatPhil, trying here ;)
bc..
import random
import mathITER=100000
k=s=ss=0
while k<ITER:
k+=1
p1=p2=0
while p1<50 and p2<50:
if random.randint(0,1):
p1+=1
else:
p2+=1
s+=p1
ss+=p1*p1
smean=float(s)/k
ssmean=float(ss)/k
var=math.fabs(ssmeansmean*smean)
sigma=math.sqrt(var)
print “Trials=”,k,“Mean=”,smean,“MeanSq=”,ssmean
print “Var=”,var,“SD=”,sigmabc..
Yields:Trials= 100000 Mean= 46.00294 MeanSq= 2146.6767
Var= 30.4062113564 SD= 5.51418274601<font face>

Carroll ★ at 20131118
as textile bc.. not implemented...
Yields:
import random
import mathITER=100000
k=s=ss=0
while k<ITER:
k+=1
p1=p2=0
while p1<50 and p2<50:
if random.randint(0,1):
p1+=1
else:
p2+=1
s+=p1
ss+=p1*p1
smean=float(s)/k
ssmean=float(ss)/k
var=math.fabs(ssmeansmean*smean)
sigma=math.sqrt(var)
print “Trials=”,k,“Mean=”,smean,“MeanSq=”,ssmean
print “Var=”,var,“SD=”,sigma
Trials= 100000 Mean= 46.00294 MeanSq= 2146.6767
Var= 30.4062113564 SD= 5.51418274601 
Carroll ★ at 20131118
Sorry I can not remove, first faulty post.
For everyone, the question was “what should be the typical difference in scores for a npoints game?”.
I wanted to use the famous random walk sqrt(2n/pi), or (n1)!! for small values, but this is without barriers.
Bonus question: from the real differences we see for 50points EWN, can we say it fits, or does 1st player advantage change it a lot?

MarleysGhost at 20131118
I repeated Carroll’s calculations a few times. Looks consistent.
Trials=100000 Mean=45.97526 MeanSq=2144.235
Var=30.510498 SD=5.523631Trials=100000 Mean=46.04819 MeanSq=2150.3774
Var=29.94165 SD=5.4718966Trials=100000 Mean=46.03247 MeanSq=2149.0925
Var=30.104248 SD=5.486734 
Carroll ★ at 20131118
How the hell can I put two exclam marks in a row:
(n1)doublefactorial/(n2)doublefactorial...

Carroll ★ at 20131118
If the players play 100 games,
is about 7.958923738717876149812705024217046140293154042473332135734787...

MarleysGhost at 20131118
However, I don’t think the calculations address the question “What should the typical difference in scores for a 50point game be?”. At least not if you’re taking the expected difference as 4.00=5046.00. For that, instead of s+=p1; ss+=p1*p1, you’d want s+=min(p1, p2), ss+=min(p1, p2)*min(p1, p2), right?
Trials=100000 Mean=42.04809 MeanSq=1796.6976
Var=28.65564 SD=5.3530965Trials=100000 Mean=42.05827 MeanSq=1797.4615
Var=28.563477 SD=5.344481Trials=100000 Mean=42.0588 MeanSq=1797.5511
Var=28.60852 SD=5.3486934For evenlymatched opponents, I would expect the difference in scores to be closer to 7.95=5042.05.

Carroll ★ at 20131118
Yes I agree with your value MarleysGhost (our posts crossed!)
But why not s+=math.fabs(s1s2) ?

MarleysGhost at 20131118
If 99!! means (99!)!, then 99!!/98!! should be a huge number, not 7.95. I don’t get it.
Yes, s+=abs(p1p2) looks good.
Trials=100000 Mean=7.97356 MeanSq=92.24022
Var=28.662563 SD=5.353743Trials=100000 Mean=7.97013 MeanSq=92.13587
Var=28.6129 SD=5.3491025Trials=100000 Mean=7.9426 MeanSq=91.6802
Var=28.595306 SD=5.347458 
Carroll ★ at 20131118
Equation 35 from http://mathworld.wolfram.com/RandomWalk1Dimensional.html.
Double factorial (which is used a lot in quantum mechanics) is:
n!! is n.(n2)....(2 or 1).

Carroll ★ at 20131118
You should at least read the delicious conclusion:
So, suppose for example you got really interested in the space of null lines in 6d complexified compactified Minkowski spacetime: o / / ox \ \ oThe whole diagram is D4, so its qpolynomial is ^{8}?! If we remove the dots in our subset we’re left with
o o othat is, three copies of A1. I never told you how to calculate the qpolynomial for a diagram with more than one piece, but you just multiply the qpolynomials for the pieces, so you get ^{2}! x ^{2}! x ^{2}! This means the qpolynomial for our space is
^{8}?! 11 × 1111 × 111111 × 11111111 / 10001  =  ^{2}! ^{2}! ^{2}! 11 × 11 × 11 1111 111111 11111111 = — x — x  11 11 10001 = 101 × 10101 × 1111 = 1020201 × 1111 = 1133443311You’ll notice how all these numbers are palindromic; that comes from Poincare duality. We can read of all sorts of wonderful things from the final answer, as listed above. For example, the Euler characteristic of our space G/P is
1+1+3+3+4+4+3+3+1 = 24The Dynkin diagram D4 is all about triality and the octonions, which are important in superstring theory. The number 24 plays an important role in bosonic string theory. Does this “coincidence” make anything good happen? I don’t know!
That’s enough for now... I’ll leave off with a quote that reminds me of these weird base q calculations.
"What’s one and one and one and one and one and one and one and one and one and one?"
“I don't know”, said Alice, "I lost count."
“She can't do addition.”  Lewis Carroll, Through the Looking Glass.

FatPhil at 20131118
Your choice of indentation’s not obvious. Any reason why you want to calculate those last 4 things each and every k iteration, or just burning CPU cycles for the lulz?
I’m prepared to blame the choice of language, Python is terminally braindead.
What you’re calculating isn’t obvious either. A 500 victory and a 5049 victory are being tallied as exactly the same thing. This is, ..., erm, ..., unexpected.
I’d say that from a human perspective, a loss by 10 and a win by 10 are considered the same margin – namely 10. And a loss by 1 and a win by 1 are also considered the same margin – namely 1. However, the human is a wrong because of the year 0 problem. Assuming equal players, the expectation is to win 49.5 games each, so a 5049 victory is only actually half a point more in your favour, and 4950 is only half a point in the opponent’s favour. This is good, there are no gaps in the possible values, namely the halfintegers from 49.5 and +49.5.
And that I think is the more meaningful metric for the margin in an ewn game.
(Compare GWG, Amazons). 
FatPhil at 20131118
My sim:
phil@geespaz:tmp$ time python ewn50.pl
Trials=10000 Sum=1223 SumSq=857246
Mean=0.1223 Var=85.70964271 SD=9.25795024343942real 0m0.587s
user 0m0.578s
sys 0m0.007s
Your sim:
phil@geespaz:tmp$ time python ewn50.py
Trials= 10000 Mean= 45.9554 MeanSq= 2143.3278
Var= 31.42901084 SD= 5.60615829602real 0m6.266s
user 0m6.247s
sys 0m0.020sMy goodness, fragile to the point of brokenness, and slow too, Python really is selling itself well to me.

FatPhil at 20131118
#!/usr/bin/perl w
my $prob=0.5;
my $trials=10000;
my $height=60;if(@ARGV && $ARGV^{0} =~ m/(0?\.\d+)/) { $prob=$1*1.0; }
my @r=(0)x50;
my @b=(0)x50;
my $max=0;
my ($sum,$sum2)=(0,0);
for(my $t=0; $t<$trials; ++$t) {
my ($r,$b)=(0,0);
while($r<50 && $b<50) {
if(rand() < $prob) { $r++; } else { $b++; }
}
my $v=0;
my $val;
if($r==50) { $v=++$r[$b]; $val=49.5$b; } else { $v=++$b[$r]; $val=$r49.5; }
if($v>$max) { $max=$v; }
$sum+=$val; $sum2+=$val*$val;
}my $scale=int($max/$height);
do {
for(my $r=0; $r<=49; ++$r) { print($b[$r]>=$height*$scale ? “+” : “ ”); }
for(my $b=49; $b>=0; $b) { print($r[$b]>=$height*$scale ? “” : “ ”); }
print(“\n”);
} while($height>0);
my $mu=$sum/$trials;
my $var=$sum2/$trials  $mu*$mu;
print(“Trials=$trials Sum=$sum SumSq=$sum2\n”);
print(“Mean=$mu Var=$var SD=”, sqrt($var), “\n”); 
FatPhil at 20131118
$ARGV^{0} should be $ARGV with array subscript 0.
The "smart"quotes will need debraindeadifying too. Apart from that, it looks like it’s survived in tact.

FatPhil at 20131118
OK, catching up, I see Marley’s created, ignoring the .5 shift, a folded (signless) equivalent to my value. I was considering losing by X and winning by X to be different events.
If you give my script a probility as a parameter, you’ll see that you get a skewed bell curve from non0.5 probabilities. In those cases, folding the wins and the losses onto each other doesn’t really make much sense.
Oh – for multifactorials, just bother remembering baroque HTML entities – use
an obvious function name instead, e.g.multifact(99,2)/multifact(98,2)
.
That also has the benefit of making sure that people who are unfamiliar with
multifactorials don’t get so confused by misrecognising a rather dumb notation.
(I always thought that even something like N!_2 was a better notation for those
who demand compactness. I have no idea what went through the mind of whoever
coined the double! notation.)
Return to forum
Reply to this topic