{VERSION 5 0 "APPLE_PPC_MAC" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Title" 0 18 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 1 0 0 0 0 0 0 1 }3 0 0 -1 12 12 0 0 0 0 0 0 19 0 }{PSTYLE "" 0 256 1 {CSTYLE "" -1 -1 "New York " 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {PARA 18 "" 0 "" {TEXT -1 25 "The Central Limit Theorem" }} {PARA 256 "" 0 "" {TEXT -1 769 "This routine generates n iid Bernoulli random variables with success probability 0.6, forms their sum S, and does this m times, plotting the resulting m numbers with a histogram. When n is large the central limit theorem tells us that S should be a pproximately normal with mean .6n and variance .24n. On the same axes \+ is plotted the corresponding theoretical normal density. You can inves tigate the effect of n on the shape of the resulting distribution by c hanging its value below ; the program only works for n \263 14 however . You can also change m, whose effect is simply the accuracy of the pi cture you get; you'd like to have m large to get an accurate represent ation of the distribution of S for a fixed n, but making m large requi res more time to see the picture. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 813 "with(stats):\n m := 250;\n \+ n := 30;\n### WARNING: persistent store makes one-argument readlib ob solete\nseed := readlib(randomize)():\n randomize(abs(seed)):\n v := \+ array(1..m):\n for k to m do\n s := 0:\n \011\011\011for j to n do\n \+ \011\011\011x := 0:\n \011\011\011y := evalf((rand())/999999999999): \n \011\011\011if ( y < 0.60) then x := 1 fi:\n \011\011\011s := s+x :\n \011\011\011od:\n v[k] := s:\n od:\n S := [seq(v[k],k=1..m)]:\n bg := floor(.6*n-3*sqrt((.24)*n)):\nnd := floor(.6*n+3*sqrt((.24)*n)): \n#dlt := floor((nd-bg)/11):#\ntld := transform[tallyinto](S,[0..bg+.5 ,seq(i-1+ bg+.5..i +bg+.5, i= 1..nd-bg),nd +.5..n]):\n### WARNING: the statplots sub-package has been completely rewritten; see the help pag es for details\nstatplots[histogram](tld,colour=yellow):plot(m*stats[s tatevalf,pdf,normald[.6*n,sqrt((.24)*n)]],0..n,colour=red,thickness=2) :plots[display](\{%,%%\});\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "1 0" 127 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 } {PAGENUMBERS 0 1 2 33 1 1 }