{VERSION 3 0 "IBM INTEL NT" "3.0" }
{USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0
1 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 }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 }3 0 0 -1 12
12 0 0 0 0 0 0 19 0 }}
{SECT 0 {EXCHG {PARA 18 "" 0 "" {TEXT -1 42 "Maple Intro Around a Revi
ew of Probability" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 ""
{TEXT -1 236 "This is a worksheet that should introduce you to some Ma
ple related to our review of probability in Math 608. I will assume t
hat you've taken the New User's Tour (at least the first 4 sections) w
hich can be found under the Help menu. " }}{PARA 0 "" 0 "" {TEXT -1
0 "" }}{PARA 0 "" 0 "" {TEXT -1 129 "First, let's see what happens whe
n we add two independent Cauchy random variables. Recall the density \+
function is f(x) given by:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0
25 "f := 1/ ( Pi * (1+x^2) );" }{TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "
" {TEXT -1 248 "(Recall, that to use this worksheet you should put the
cursor on the line in red (the Maple command above) and hit . \+
Then answer appears in blue and centered on the page.) Let us check \+
that its integral over the reals is what it should be:" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "int(f, x=-infinity..infinity);" }
{TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 77 "Here \"int\" stan
ds for \"integrate.\" In case you forget, you can quickly type:" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "?int;" }}}{EXCHG {PARA 0 ""
0 "" {TEXT -1 176 "The ? gives you help. To convolve f with itself (i
.e. add two independent Cauchy's), we need to substitute x=y in f, and
then x=x-y in f, and then integrate dy over the reals:" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "f1 := subs(x=y,f);" }{TEXT -1 0 ""
}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "f2 := subs(x=x-y,f);" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "int(f1 * f2, y=-infinity..in
finity);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 116 "Whoops!! Maple didn'
t simplify. Recall that \"%\" is Maple's abbreviation for the last qu
antity computed, so we type:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1
0 12 "simplify(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 157 "Notice tha
t this times dx would work out to f(x/2)d(x/2). So adding two indepen
dent Cauchys gives you a Cauchy that is twice as \"large\" as the orig
inal one." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 ""
{TEXT -1 204 "Now let's try to compare a collection of normally distri
buted random variables with a collection that are a sum of a certain n
umber of (independent) uniform random variables. First we load some s
oftware:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "with(stats): wi
th(statplots):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 114 "With this soft
ware, here is how to produce a histogram of 100 (independent) normally
distributed random variables." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT
1 0 34 "histogram([random[normald](100)]);" }{TEXT -1 0 "" }}}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 521 "Next I will write a little procedure tha
t given two positive integers, sum_size and num_of_sums, produces a hi
stogram of num_of_sums (independent) random variables, each random var
iable a sum of sum_size independent [-1,1] uniformly distributed rando
m variables; each sum of uniforms is normalized by dividing it by the \+
square root of sum_size/3, to make the sum have standard deviation 1. \+
(The procedure below is parsed as one long line-- the program, starti
ng from \"proc\" and ending with \"end:\" is one block in Maple.)" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "plot_unif_sum := proc(sum_si
ze,num_of_sums)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 47 " local sums,i,j
; with(stats): with(statplots):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "
for i from 1 to num_of_sums do" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15
" sums[i]:=0;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 " for j from \+
1 to sum_size do" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 51 " sums[i] :
= sums[i]+ random[uniform[-1,1]](1);" }}{PARA 0 "> " 0 "" {MPLTEXT 1
0 95 " od; \n od;\n for i from 1 to num_of_sums do\n sums[i] :
= sums[i]/sqrt(sum_size/3.);\n od;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0
46 " histogram( [seq(sums[i],i=1..num_of_sums)]);" }}{PARA 0 "> " 0 "
" {MPLTEXT 1 0 4 "end:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 84 "So to t
ake 100 sums of two independent uniforms (appropriately normalized), w
e type:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "plot_unif_sum(2,
100);" }{TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 487 "Now try \+
playing with the numbers (100 and 2 in this program, and 100 in the pr
evious histogram producing line), producing a number of histograms for
the same parameters. If you are looking at 100 random variables, at \+
what point do you find that the sum of uniforms histogram looks like t
he normal histogram? What if you use fewer or more than 100? How can
you tell the difference? If you like, type \"?histogram\" and change
some of the parameters of the histogram plotting function..." }}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 18 "" 0 "" {TEXT -1 16 "End of W
orksheet" }}}}{MARK "21 2 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 }