{VERSION 4 0 "IBM INTEL NT" "4.0" }
{USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0
1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 255 0 0 0 2 0 0 0
0 0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1
}{CSTYLE "" -1 256 "" 0 1 97 108 104 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "
" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 258 "" 0 1
226 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 0
0 0 0 0 0 0 1 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }
{CSTYLE "" -1 261 "" 0 1 99 116 105 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE ""
-1 262 "" 0 1 10 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 263 "" 0 1
0 0 2 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 0 0
0 0 0 0 0 1 }{CSTYLE "" -1 265 "" 0 1 0 0 22 0 0 1 0 0 0 0 0 0 0 1 }
{CSTYLE "" -1 266 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1
267 "" 0 1 0 0 15 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 268 "" 0 1 0 0
64 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 269 "" 0 1 0 0 22 0 0 1 0 0 0
0 0 0 0 1 }{CSTYLE "" -1 270 "" 0 1 0 0 64 0 0 1 0 0 0 0 0 0 0 1 }
{CSTYLE "" -1 271 "" 0 1 0 0 40 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1
272 "" 0 1 0 0 22 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 273 "" 0 1 0 0
28 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 274 "" 0 1 255 255 0 0 0 1 0
0 0 0 0 0 0 1 }{CSTYLE "" -1 275 "" 0 1 0 0 216 0 0 1 0 0 0 0 0 0 0 1
}{CSTYLE "" -1 276 "" 0 1 0 0 22 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1
277 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 278 "" 0 1 0 0
22 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 279 "" 0 18 0 0 0 0 0 1 0 0 0
0 0 0 0 1 }{CSTYLE "" -1 280 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }
{CSTYLE "" -1 281 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1
282 "" 1 18 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 283 "" 0 14 0
0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 284 "" 1 14 0 0 0 0 0 1 0 0
0 0 0 0 0 1 }{CSTYLE "" -1 285 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }
{CSTYLE "" -1 286 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1
287 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 288 "" 0 1 0 0
0 0 0 1 0 0 0 0 0 0 0 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 ""
0 1 111 114 115 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 "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0
0 0 0 0 0 1 }1 0 0 0 6 6 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 2" 3 4 1
{CSTYLE "" -1 -1 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }0 0 0 -1 4 4 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 "" 1 18 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1
-1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 257 1 {CSTYLE "" -1 -1 "" 1 18 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 "
" 0 258 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0
-1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 259 1 {CSTYLE "" -1 -1 "" 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE
"" 0 260 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0
-1 -1 -1 0 0 0 0 0 0 -1 0 }}
{SECT 0 {PARA 18 "" 0 "" {TEXT 283 34 "DISCOVERING MATHEMATICS WITH MA
PLE" }{TEXT 282 0 "" }}{PARA 258 "" 0 "" {TEXT 284 77 "An Interactive \+
Exploration for Mathematicians, Engineers, and Econometricians" }}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 "" {TEXT 279 33 "Chapte
r 4. Counting and Summation" }{TEXT -1 0 "" }}{PARA 257 "" 0 "" {TEXT
-1 0 "" }}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 21 "Binomial coefficients"
}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 394 "We sta
rt this Maple session with the binomial coefficient. We shall show by \+
example how Maple works with it and how we can use Maple to derive ide
ntities in which binomial coefficients appear. We shall also consider \+
Maple's random generator and use Maple for improving our perception of
the De Moivre-Laplace limit theorem. Roughly, this theorem asserts th
at for large values of the parameter " }{XPPEDIT 18 0 "n" "6#%\"nG" }
{TEXT -1 28 " the binomial distribution " }{XPPEDIT 18 0 "B(n,p)" "6#
-%\"BG6$%\"nG%\"pG" }{TEXT -1 47 " behaves like a normal distribution \+
with mean " }{XPPEDIT 18 0 "mu=n*p" "6#/%#muG*&%\"nG\"\"\"%\"pGF'" }
{TEXT -1 15 " and variance " }{XPPEDIT 18 0 "sigma^2=n*p*(1-p)" "6#/*
$%&sigmaG\"\"#*(%\"nG\"\"\"%\"pGF),&F)F)F*!\"\"F)" }{TEXT -1 3 ". " }
}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 1 {PARA 4 "" 0 "" {TEXT -1 25 "
Maple's Binomial Function" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "
" 0 "" {TEXT -1 146 "Because the binomial coefficient is the main subj
ect of this session, it is quite natural to first find out the extent \+
of Maple's knowledge of it." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "restart: help(binomial);" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT
-1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 78 "As you can see from the help wi
ndow, the first argument of the Maple function " }{TEXT 256 13 "binomi
al(n,k)" }{TEXT -1 53 " does not need to be a natural number. Moreover
, the " }{XPPEDIT 18 0 "Gamma" "6#%&GammaG" }{TEXT -1 123 "-function i
s also involved in the definition of binomial coefficients. This is no
t really surprising once you realize that " }{XPPEDIT 18 0 "Gamma(n+1)
=n!" "6#/-%&GammaG6#,&%\"nG\"\"\"F)F)-%*factorialG6#F(" }{TEXT -1 27 "
for non-negative integers " }{XPPEDIT 18 0 "n" "6#%\"nG" }{TEXT -1
30 ". Maple knows this too; indeed" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "convert(n!,GAMMA);" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT
-1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 51 "But also for some unusual combi
nations of integers " }{XPPEDIT 18 0 "n" "6#%\"nG" }{TEXT -1 5 " and \+
" }{XPPEDIT 18 0 "k" "6#%\"kG" }{TEXT -1 6 " does " }{TEXT 257 13 "bin
omial(n,k)" }{TEXT -1 89 " give unexpected answers. This is apparent f
rom the output of the following instructions:" }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 60 "binomial(5,2
),binomial(5,-2),binomial(-5,2),binomial(-5,-2);" }}{PARA 0 "> " 0 ""
{MPLTEXT 1 0 60 "binomial(2,5),binomial(2,-5),binomial(-2,5),binomial(
-2,-5);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 ""
0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 114 "Even if we stick to
the wider definition given in section 4.2 of this chapter, so that th
e binomial coefficient '" }{XPPEDIT 18 0 "x" "6#%\"xG" }{TEXT -1 6 " \+
over " }{XPPEDIT 18 0 "k" "6#%\"kG" }{TEXT -1 29 "' also makes sense \+
for real " }{XPPEDIT 18 0 "x" "6#%\"xG" }{TEXT -1 85 ", then still fou
r out of eight answers provided by Maple are surprising to a degree. \+
" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 104 "In o
rder to understand what Maple is doing, it is necessary to look at th
e Maple code for the function " }{TEXT 258 13 "binomial(n,k)" }{TEXT
-1 43 ". We indicated before how this can be done." }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "interface(ve
rboseproc=2); print(binomial):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT
1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1
179 "The complete code will now appear on the screen. Here we only sho
w the first and final lines of this code. From these lines you can rea
d off that Maple interprets the coefficient " }{TEXT 285 8 "binomial"
}{TEXT -1 1 "(" }{XPPEDIT 18 0 "-2" "6#,$\"\"#!\"\"" }{TEXT -1 1 "," }
{XPPEDIT 18 0 "-5" "6#,$\"\"&!\"\"" }{TEXT -1 6 ") as " }{TEXT 286 8
"binomial" }{TEXT -1 1 "(" }{XPPEDIT 18 0 "-2" "6#,$\"\"#!\"\"" }
{TEXT -1 1 "," }{XPPEDIT 18 0 "-2-(-5)" "6#,&\"\"#!\"\",$\"\"&F%F%" }
{TEXT -1 4 ") = " }{TEXT 287 8 "binomial" }{TEXT -1 1 "(" }{XPPEDIT
18 0 "-2" "6#,$\"\"#!\"\"" }{TEXT -1 6 ",3) = " }{XPPEDIT 18 0 "-4" "6
#,$\"\"%!\"\"" }{TEXT -1 17 ". Moreover, the " }{XPPEDIT 18 0 "Gamma
" "6#%&GammaG" }{TEXT -1 24 "-function is used when " }{XPPEDIT 18 0
"n" "6#%\"nG" }{TEXT -1 19 " is integral and " }{XPPEDIT 18 0 "k" "6
#%\"kG" }{TEXT -1 42 " is a rational number with denominator 2." }}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{SECT 1 {PARA 4 "" 0 "" {TEXT -1 23 "Two Binomial Identities" }}{PARA
0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 120 "How does Maple
handle the binomial coefficient? What we mean is, how much does Maple
know about its typical properties? " }}{PARA 0 "" 0 "" {TEXT -1 0 ""
}}{PARA 0 "" 0 "" {TEXT -1 55 "Would Maple know the following basic bi
nomial identity?" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 8 "restart:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "
binomial(n+1,k) = binomial(n,k) + binomial(n,k-1);" }}}{EXCHG {PARA 0
"> " 0 "" {MPLTEXT 1 0 9 "evalb(%);" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 ""
{TEXT -1 18 "Again we see that " }{TEXT 259 5 "evalb" }{TEXT -1 161 " \+
gives no definite answer; of course this is not surprising considering
that both expressions are not literally the same. However, some sligh
t manipulation with " }{TEXT 260 6 "expand" }{TEXT -1 5 " and " }
{TEXT 261 8 "simplify" }{TEXT -1 62 " enables Maple to identify the re
sulting expressions as equal." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "evalb(simplify(expand(%%)));
" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 57 "Let us now look at a diff
erent, less familiar expression." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "s := (m,n) -> sum(binomial(m
,k)/binomial(n,k),k=0..m):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "Sum(b
inomial(m,k)/binomial(n,k),k=0..m) = s(m,n);" }}}{EXCHG {PARA 0 "> "
0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 ""
0 "" {TEXT -1 107 "We have discovered an unusual identity. Or rather, \+
Maple has done that. Is it correct? We tacitly assumed " }{XPPEDIT
18 0 "m" "6#%\"mG" }{TEXT -1 69 " to be a non-negative integer, becau
se only then does summing over " }{XPPEDIT 18 0 "k" "6#%\"kG" }{TEXT
-1 10 " = 0,..., " }{XPPEDIT 18 0 "m" "6#%\"mG" }{TEXT -1 27 " make s
ense. Furthermore, " }{XPPEDIT 18 0 "n" "6#%\"nG" }{TEXT -1 24 " canno
t be smaller than " }{XPPEDIT 18 0 "m" "6#%\"mG" }{TEXT -1 22 " (at l
east not when " }{XPPEDIT 18 0 "n" "6#%\"nG" }{TEXT -1 89 " is integ
ral) for in that case the above summation is not defined. One has to t
ake care!" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1
4 "If " }{XPPEDIT 18 0 "n" "6#%\"nG" }{TEXT -1 5 " and " }{XPPEDIT
18 0 "m" "6#%\"mG" }{TEXT -1 34 " are integral, non-negative, and " }
{XPPEDIT 18 0 "n>=m" "6#1%\"mG%\"nG" }{TEXT -1 69 ", this identity can
be proved formally by mathematical induction on " }{XPPEDIT 18 0 "n
" "6#%\"nG" }{TEXT -1 22 ". This is so, because " }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "'s(m,n+1)' =
m/(n+1)*`s(m-1,n)`+1;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 ""
}}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 152 "which
does not take too much effort to prove. Indeed, increasing the summat
ion variable in the second finite sum by 1, gives the first one withou
t its " }{XPPEDIT 18 0 "k" "6#%\"kG" }{TEXT -1 16 " = 0 term. Thus"
}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1
0 43 "Sum(binomial(m,k)/binomial(n+1,k),k=0..m) -" }}{PARA 0 "> " 0 "
" {MPLTEXT 1 0 55 "Sum(m*binomial(m-1,k)/((n+1)*binomial(n,k)),k=0..m-
1) =" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "simplify(s(m,n+1)-m/(n+1)*s
(m-1,n));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "
" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 170 "The strong versio
n of mathematical induction can now be directly applied with the desir
ed result. By the way, the identity in question is correct for all rea
l values of " }{XPPEDIT 18 0 "n" "6#%\"nG" }{TEXT -1 43 " for which \+
all parts are properly defined." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{PARA 0 "" 0 "" {TEXT -1 158 "It is important to realize that in this \+
example Maple's output has been instrumental in convincing us of the i
dentity's correctness and in proving it as well." }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 572 "Once again, the main poi
nt of this example is this: Maple, and other CA systems just the same,
possess large amounts of mathematical knowledge, much of it hidden. I
n order to fully profit from this knowledge, one must use the system w
ith care and understanding, and most of all, one should not gratuitous
ly accept all that is shown on the screen, a warning that really appli
es to all computer output. Nevertheless, the information supplied by t
he CA system can often lead to an improved perception of the problem o
r at least to sensible directives for further exploration." }}{PARA 0
"" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 1
{PARA 4 "" 0 "" {TEXT -1 19 "The Binomial Series" }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 57 "We now take a short excur
sion into the field of Analysis." }}{PARA 0 "" 0 "" {TEXT -1 81 "The b
inomial series expansion is a direct generalization of the Binomial Th
eorem." }}{PARA 0 "" 0 "" {TEXT -1 50 "In the Taylor-Maclaurin expansi
on of the function " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0
"> " 0 "" {MPLTEXT 1 0 8 "restart:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0
20 "f := x -> sqrt(1+x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "
" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 26 "the \+
binomial coefficients " }{TEXT 288 8 "binomial" }{TEXT -1 2 "( " }
{XPPEDIT 18 0 "1/2" "6#*&\"\"\"F$\"\"#!\"\"" }{TEXT -1 2 ", " }
{XPPEDIT 18 0 "k" "6#%\"kG" }{TEXT -1 72 " ) play an important role. T
he formal power series of this function at " }{XPPEDIT 18 0 "x" "6#%
\"xG" }{TEXT -1 18 " = 0 is equal to " }}{PARA 0 "" 0 "" {TEXT -1 0 "
" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "Sum(binomial(1/2,k)*x^k,
k=0..infinity);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 26 "Let us ve
rify this answer." }}{PARA 0 "" 0 "" {TEXT -1 31 "The power series exp
ansion of " }{XPPEDIT 18 0 "f" "6#%\"fG" }{TEXT -1 1 "(" }{XPPEDIT
18 0 "x" "6#%\"xG" }{TEXT -1 6 ") at " }{XPPEDIT 18 0 "x" "6#%\"xG" }
{TEXT -1 45 " = 0 is known to Maple and with the command " }{TEXT
262 6 "taylor" }{TEXT -1 54 " we can bring to the screen as many terms
as we wish. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> "
0 "" {MPLTEXT 1 0 36 "taylorseries := taylor(f(x),x=0,12);" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }
}{PARA 0 "" 0 "" {TEXT -1 27 "The third parameter of the " }{TEXT 263
6 "taylor" }{TEXT -1 273 " procedure - here 12 - should produce as man
y terms. But by a strange bug in Maple V, initially 14 terms are produ
ced instead of 12; when the procedure is repeated the expected number \+
of terms is given. Note that the remainder term is nicely written with
Landau's O-symbol." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "
" {TEXT -1 130 "Finally we have to check that the taylor coefficients \+
and the binomial coefficients agree. For that purpose we need the proc
edure " }{TEXT 264 8 "coeftayl" }{TEXT -1 36 " which has to be loaded \+
separately. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0
"" {MPLTEXT 1 0 84 "### WARNING: persistent store makes one-argument r
eadlib obsolete\nreadlib(coeftayl):" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 22 "for j from 0 to 49 do " }}{PARA 0 "> " 0 "" {MPLTEXT
1 0 51 "if not coeftayl(f(x),x=0,j) = binomial(1/2,j) then " }}{PARA
0 "> " 0 "" {MPLTEXT 1 0 49 "ERROR(`A difference is found at index `,j
) fi od;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "`value of j` = \+
j;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 37 "We don't get any error me
ssages and " }{XPPEDIT 18 0 "j" "6#%\"jG" }{TEXT -1 66 " ran through \+
all values from 0 up to 50 since the final value of " }{XPPEDIT 18 0
"j" "6#%\"jG" }{TEXT -1 111 " is 50. This shows that the first 50 term
s of the taylor series have indeed the expected binomial coefficients.
" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{SECT 1 {PARA 4 "" 0 "" {TEXT -1 35 "The De Moivre-Laplace Limit Theor
em" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 189 "In
the next example we again have to subtly steer Maple towards our ulti
mate goal, which is an improved perception of the De Moivre-Laplace li
mit theorem. This theorem is about a sequence (" }{XPPEDIT 18 0 "X[n]
" "6#&%\"XG6#%\"nG" }{TEXT -1 66 ") of stochastic variables, binomiall
y distributed with parameter " }{XPPEDIT 18 0 "n" "6#%\"nG" }{TEXT
-1 19 " and probability " }{XPPEDIT 18 0 "p" "6#%\"pG" }{TEXT -1 7 "
, (0 < " }{XPPEDIT 18 0 "p" "6#%\"pG" }{TEXT -1 11 " < 1). Thus" }}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0
8 "restart:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "P(X[n]=k) = binomial
(n,k)*p^k*(1-p)^(n-k);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 ""
}}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 15 "Furthe
r, let (" }{XPPEDIT 18 0 "Y[n]" "6#&%\"YG6#%\"nG" }{TEXT -1 53 ") be
the associated sequence of stochastic variables" }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "Y[n] := (X[n
] - n*p)/sqrt(n*p*(1-p));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0
"" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 70 "The
n the limit theorem claims the following limit identity to be true:" }
}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1
0 34 "limit(P('Y[n]' <= x),n=infinity) =" }}{PARA 0 "> " 0 ""
{MPLTEXT 1 0 43 "1/sqrt(2*Pi)*Int(exp(-t^2),t=-infinity..x);" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT
-1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 45 "This clearly means that for lar
ge values of " }{XPPEDIT 18 0 "n" "6#%\"nG" }{TEXT -1 30 ", the binom
ial distribution B(" }{XPPEDIT 18 0 "n" "6#%\"nG" }{TEXT -1 2 ", " }
{XPPEDIT 18 0 "p" "6#%\"pG" }{TEXT -1 37 ") behaves like a normal dist
ribution " }{XPPEDIT 18 0 "N(n*p,n*p*(1-p))" "6#-%\"NG6$*&%\"nG\"\"\"%
\"pGF(*(F'F(F)F(,&F(F(F)!\"\"F(" }{TEXT -1 64 ". Can Maple help us to \+
verify the correctness of this statement?" }}{PARA 0 "" 0 "" {TEXT -1
0 "" }}{PARA 0 "" 0 "" {TEXT -1 247 "Let us first take a closer look a
t this asymptotic relation from a practical point of view. Hence the f
ollowing experiment. Tossing a coin 50 times, we count the number of t
imes 'cross' comes up. This number is counted by the stochastic variab
le " }{TEXT 266 1 "X" }{TEXT -1 27 ". Obviously, the variable " }
{XPPEDIT 18 0 "X" "6#%\"XG" }{TEXT -1 39 " is binomially distributed \+
with mean " }{XPPEDIT 18 0 "n" "6#%\"nG" }{TEXT -1 1 " " }{XPPEDIT
18 0 "p" "6#%\"pG" }{TEXT -1 30 " = 50 * 0.5 = 25 and variance " }
{XPPEDIT 18 0 "n*p*(1-p)" "6#*(%\"nG\"\"\"%\"pGF%,&F%F%F&!\"\"F%" }
{TEXT -1 317 " = 50 * 0.5^2 = 12.5. We repeat this experiment 200 tim
es and arrange the results in a histogram. We then try to match up the
density function of the corresponding normal distribution with the da
ta in our histogram. Of course, our experiment will be simulated with \+
the use of Maple's random generator. In worksheet " }{TEXT 265 12 "Co
untW4b.mws" }{TEXT -1 55 " Maple's random generator is discussed in s
ome detail." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT
-1 53 "The following procedure counts the number of crosses:" }}{PARA
0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "cr
osstoss := proc() local i;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "conve
rt([seq(rand(2)(),i=1..50)],`+`) end;" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 ""
{TEXT -1 82 "Next we repeat this process 200 times and collect the inf
ormation in the data set " }{TEXT 280 9 "crossdata" }{TEXT -1 2 ". " }
}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1
0 16 "crossdata := []:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "for j fro
m 1 to 200 do" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "crossdata := [op(c
rossdata),crosstoss()] od:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0
0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 59 "F
or the creation of a histogram, we shall use the packages " }{TEXT
267 5 "stats" }{TEXT -1 19 " (statistics) and " }{TEXT 268 5 "plots"
}{TEXT -1 20 " and the subpackage " }{TEXT 269 11 " statplots " }
{TEXT -1 5 " of " }{TEXT 270 5 "stats" }{TEXT -1 1 "." }}{PARA 0 ""
0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "with(st
ats): with(plots): with(statplots):" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 39 "data := transform[tallyinto](crossdata," }}{PARA 0 ">
" 0 "" {MPLTEXT 1 0 23 "[seq(i..i+1,i=0..49)]):" }}}{EXCHG {PARA 0 ">
" 0 "" {MPLTEXT 1 0 16 "histogram(data);" }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "
" {TEXT -1 113 "The resulting graph indeed resembles to some extent th
at of a normal distribution with mean 25 and variance 12.5." }}{PARA
0 "" 0 "" {TEXT -1 250 "It is not easy to judge how many data points a
re needed for a really convincing normal distribution likeness. Increa
sing the number to 1000 would certainly improve this appreciably. But \+
then the time factor would also increase considerably of course." }}
{PARA 0 "" 0 "" {TEXT -1 133 "The histogram is now to be compared with
the graph of the density function of a normal distribution with the s
ame mean and variance. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 ""
0 "" {TEXT -1 67 "Both graphs can be jointly displayed in a figure usi
ng the command " }{TEXT 271 7 "display" }{TEXT -1 10 " from the " }
{TEXT 272 5 "plots" }{TEXT -1 98 " package. To expose the differences \+
more clearly, the normal curve gets a different color and the " }
{TEXT 273 5 "style" }{TEXT -1 36 " value is changed from the default \+
" }{TEXT 274 5 "style" }{TEXT -1 1 " " }{TEXT 275 7 "= patch" }{TEXT
-1 6 " to " }{TEXT 276 12 "style = line" }{TEXT -1 1 "." }}{PARA 0 "
" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 59 "norma
lplot := plot(200/sqrt(Pi*25)*exp(-(x-25)^2/2/(12.5))," }}{PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 21 "x=0..50,color=black):" }}}{EXCHG {PARA 0 "> "
0 "" {MPLTEXT 1 0 49 "display(\{histogram(data),normalplot\},style=lin
e);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 202 "Finally, we may also att
empt to increase our insight into the theoretical background to the th
eorem. Let us state once more the limit identity on which the theorem \+
is based. But first we give the mean " }{XPPEDIT 18 0 "mu" "6#%#muG"
}{TEXT -1 26 " and standard deviation " }{XPPEDIT 18 0 "sigma" "6#%&
sigmaG" }{TEXT -1 6 " of (" }{XPPEDIT 18 0 "X[n]" "6#&%\"XG6#%\"nG" }
{TEXT -1 2 ")." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> "
0 "" {MPLTEXT 1 0 40 "n := 'n': mu := n/2; sigma := sqrt(n/4);" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "limit(P('Y[n]'<=y),n=infinit
y) = " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "1/sqrt(2*Pi)*Int(exp(-t^2/
2),t=-infinity..y);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 5 "If (" }
{XPPEDIT 18 0 "Y[n]" "6#&%\"YG6#%\"nG" }{TEXT -1 13 ") tends to " }
{XPPEDIT 18 0 "y" "6#%\"yG" }{TEXT -1 4 " = (" }{XPPEDIT 18 0 "x-mu" "
6#,&%\"xG\"\"\"%#muG!\"\"" }{TEXT -1 2 ")/" }{XPPEDIT 18 0 "sigma" "6#
%&sigmaG" }{TEXT -1 7 " then " }{XPPEDIT 18 0 "X[n]" "6#&%\"XG6#%\"nG
" }{TEXT -1 1 "/" }{XPPEDIT 18 0 "x" "6#%\"xG" }{TEXT -1 47 " tends to
1. Hence, in the limit, a change in " }{XPPEDIT 18 0 "Y[n]" "6#&%\"Y
G6#%\"nG" }{TEXT -1 26 ", induced by a change in " }{XPPEDIT 18 0 "X[
n]" "6#&%\"XG6#%\"nG" }{TEXT -1 16 ", is measured by" }}{PARA 0 "" 0 "
" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "Limit('sig
ma'*P(Y[n]='y'),n=infinity) = simplify(" }}{PARA 0 "> " 0 "" {MPLTEXT
1 0 52 "limit(binomial(n,mu+sigma*y)/2^n*sigma,n=infinity));" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT
-1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 125 "and this is just the density f
unction of the standard normal distribution. Apparently, Maple has no \+
problems with this limit!" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "
" 0 "" {TEXT -1 100 "Maybe it will be even more evident if we take ano
ther approach. We give the probability function P(" }{XPPEDIT 18 0 "X
[n]" "6#&%\"XG6#%\"nG" }{TEXT -1 3 " = " }{XPPEDIT 18 0 "x" "6#%\"xG"
}{TEXT -1 18 ") with parameter " }{XPPEDIT 18 0 "n" "6#%\"nG" }{TEXT
-1 12 " the name " }{XPPEDIT 18 0 "f" "6#%\"fG" }{TEXT -1 6 ". Thus
" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT
1 0 32 "f := (x,n) -> binomial(n,x)/2^n;" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 ""
{TEXT -1 41 "Next we consider the relative change in " }{XPPEDIT 18
0 "f" "6#%\"fG" }{TEXT -1 1 "(" }{XPPEDIT 18 0 "mu + sigma y" "6#,&%#m
uG\"\"\"*&%&sigmaGF%%\"yGF%F%" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "n" "6#
%\"nG" }{TEXT -1 18 ") as function of " }{XPPEDIT 18 0 "y" "6#%\"yG"
}{TEXT -1 39 " . In the resulting expression we let " }{XPPEDIT 18 0
"n" "6#%\"nG" }{TEXT -1 19 " tend to infinity." }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 63 "Limit(Diff(`
f(mu+sigma*y,n)`,y)/`f(mu+sigma*y,n)`,n=infinity) =" }}{PARA 0 "> " 0
"" {MPLTEXT 1 0 58 "limit(diff(f(mu+sigma*y,n),y)/f(mu+sigma*y,n),n=in
finity);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 ""
0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 47 "Hence, in the limit,
the probability function " }{XPPEDIT 18 0 "f" "6#%\"fG" }{TEXT -1 1
"(" }{XPPEDIT 18 0 "mu + sigma y" "6#,&%#muG\"\"\"*&%&sigmaGF%%\"yGF%F
%" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "n" "6#%\"nG" }{TEXT -1 22 ") (as \+
a function of " }{XPPEDIT 18 0 "y" "6#%\"yG" }{TEXT -1 60 ") can be f
ound as the solution to the differential equation " }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 259 "" 0 "" {TEXT -1 4 "g'( " }{XPPEDIT 18 0 "y
" "6#%\"yG" }{TEXT -1 4 ") = " }{XPPEDIT 18 0 "-y*g(y)" "6#,$*&%\"yG\"
\"\"-%\"gG6#F%F&!\"\"" }{TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 0 "
" }}{PARA 0 "" 0 "" {TEXT -1 12 "with g(0) = " }{XPPEDIT 18 0 "g[0]" "
6#&%\"gG6#\"\"!" }{TEXT -1 31 ", for an appropriate value of " }
{XPPEDIT 18 0 "g[0]" "6#&%\"gG6#\"\"!" }{TEXT -1 20 ". The Maple comma
nd " }{TEXT 277 6 "dsolve" }{TEXT -1 33 " will help us find this solut
ion." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 36 "dsolve(diff(g(y),y)/g(y) = -y,g(y));" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }
}{PARA 0 "" 0 "" {TEXT -1 4 "The " }{TEXT 281 6 "dsolve" }{TEXT -1
140 " procedure has been extensively rewritten in Release 5, many new \+
result forms have been added, and its options are slightly different \+
too. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 22 "
Finally, the constant " }{TEXT 278 3 "_C1" }{TEXT -1 18 " is obtained
from" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 49 "Int(exp(-1/2*y^2)*_C1,y=-infinity..infinity) = 1;" }}
}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT
-1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 9 "and hence" }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "_C1 := solve
(value(%),_C1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 7 "so that" }
}{PARA 260 "" 0 "" {TEXT -1 1 " " }{XPPEDIT 18 0 "g(y) = e^(- y^2/2)/s
qrt(2*Pi)" "6#/-%\"gG6#%\"yG*&)%\"eG,$*&F'\"\"#F-!\"\"F.\"\"\"-%%sqrtG
6#*&F-F/%#PiGF/F." }}{PARA 0 "" 0 "" {TEXT -1 31 " \+
" }}{PARA 0 "" 0 "" {TEXT -1 73 "is the sought after densit
y function of the standard normal distribution." }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}}{PARA 4 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 ""
{TEXT -1 41 "This concludes the present Maple session." }{MPLTEXT 1 0
0 "" }}}}{MARK "0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }
{PAGENUMBERS 0 1 2 33 1 1 }