Processing math: 100%
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 7 years ago

dan_fulea gravatar image

First: The probability for X>40, where X is binomially distributed as in the problem, is given by

p = sum( [ binomial(64,k) for k in [41..64] ] ) / 2^64

which is exactly:

sage: p
302210786238405829/18446744073709551616
sage: p.n()
0.0163828795494116

which is also the number from the posted code:

sage: pSupKmax
0.0163828795494116

It is also excluded, that the "more than 40 heads" in the text translates as X40, since the "other number" is

sage: ( sum( [ binomial(64,k) for k in [40..64] ] ) / 2^64 ).n()
0.0299705947834996

Second: I do not know which is the "rule of thumb", so i try to guess. The random variable X is binomially distributed, its mean is 6412=32, its variance is 6412(112)=16=42, so the variable that can be approximated with a standard normally distributed variable Y is (X32)/4, Y14(X32) . Let Φ be the distribution of Y. Then in the statistics one "knows" the following values for Φ, corresponding to "confidence intervals" of often usage: 68-95-99 rule P( |X32|14 )P(|Y|<1)0.6827 ,P( |X32|24 )P(|Y|<2)0.9545 ,P( |X32|34 )P(|Y|<3)0.9974 . In our case, the problem wants "by coincidence" the number that we can easily extract from the second line. We have quickly P(Y>2)=12(P(Y<2)+P(Y>2))=12(1P(|Y|<2))120.0455=0.02275 . This last value correpsonds well to the value 1-Phi(2) = 0.0227501319482 in the following sage dialog:

sage: T = RealDistribution( 'gaussian', 1 )
sage: for k in [0..3]:
....:     print "Phi(%s) = %s" % ( k, T.cum_distribution_function(k) )
....:     
Phi(0) = 0.5
Phi(1) = 0.841344746069
Phi(2) = 0.977249868052
Phi(3) = 0.998650101968
sage: for k in [0..3]:
....:     print "1-Phi(%s) = %s" % ( k, 1-T.cum_distribution_function(k) )
....:     
1-Phi(0) = 0.5
1-Phi(1) = 0.158655253931
1-Phi(2) = 0.0227501319482
1-Phi(3) = 0.00134989803163

Note: In statistics, there is one more trick used when approximating some "binomial X" by some "standard normal Y" as in our case. The random variable X is discrete, so "more than 40" is both X>40 and X41. When we translate this in terms of Y it is better to translate using the middle point 40.5. And we get:

sage: 1 - T.cum_distribution_function( (40.5-32)/4 )
0.016793306448448786

which fits nicely in the "reality", which is 0.0163828795494116. This important experience can be done only by using something like sage, so they should introduce it in the school, since is the only free "thing" doing the job (without pain)... !

Third Sorry, i could not reproduce the error, at any rate, the following works for me...

sage: show( 'Using  normal law integration 1-normalCDFnum :'
....:       , 1 - T.cum_distribution_function( (40.5-32)/4 ) )
\newcommand{\Bold}[1]{\mathbf{#1}}\verb|Using|\phantom{\verb!xx!}\verb|normal|\phantom{\verb!x!}\verb|law|\phantom{\verb!x!}\verb|integration|\phantom{\verb!x!}\verb|1-normalCDFnum|\phantom{\verb!x!}\verb|:| 0.0167933064484

sage: show( 'Using  normal law integration 1-normalCDFnum :'
....:       , ( 1 - T.cum_distribution_function( (40.5-32)/4 ) ).n() )
\newcommand{\Bold}[1]{\mathbf{#1}}\verb|Using|\phantom{\verb!xx!}\verb|normal|\phantom{\verb!x!}\verb|law|\phantom{\verb!x!}\verb|integration|\phantom{\verb!x!}\verb|1-normalCDFnum|\phantom{\verb!x!}\verb|:| 0.0167933064484488