{VERSION 6 0 "IBM INTEL NT" "6.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 0 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 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{PSTYLE "Normal
" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1
1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Heading 1" -1 3 1 {CSTYLE "" -1
-1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 4 1 0 1 0 2 2
0 1 }{PSTYLE "Heading 2" -1 4 1 {CSTYLE "" -1 -1 "Times" 1 14 0 0 0 1
2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 2 1 0 1 0 2 2 0 1 }{PSTYLE "Title" -1
18 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 1 2 2 2 1 1 1 1 }3 1 0
0 12 12 1 0 1 0 2 2 19 1 }}
{SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 56 "bob jantzen 10-mar-2000 ->
29-mar-2004 example worksheet" }}}{EXCHG {PARA 18 "" 0 "" {TEXT -1
51 "Triplet of random numbers form sides of a triangle?" }}}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 382 "Let (X,Y,Z) be a triad of uniformly dist
ributed random numbers in [0,1]. What is the probability that these n
umbers represent the lengths of the sides of a triangle? Generate 100
0 random trials to estimate this probability. Note that the three pos
itive numbers represent the lengths of the sides of a triangle if and \+
only if the sum of each pair is larger than the third number." }}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 256 8 "R
ESPONSE" }}{PARA 0 "" 0 "" {TEXT -1 285 "We need to make a loop which \+
produces 3 random numbers in [0,1] for each trial and then test them f
or the 3 conditions, and count how many times we satisfy the set of co
nditions, producing the value of the count at the end. We recall that \+
rand(N) produces random numbers between 0 and " }{XPPEDIT 18 0 "N-1;"
"6#,&%\"NG\"\"\"F%!\"\"" }{TEXT -1 8 ", while " }{XPPEDIT 18 0 "rand(N
);" "6#-%%randG6#%\"NG" }{TEXT -1 2 "/(" }{XPPEDIT 18 0 "N-1;" "6#,&%
\"NG\"\"\"F%!\"\"" }{TEXT -1 48 ") then produces random numbers betwee
n 0 and 1. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "
" {TEXT -1 16 "... [suppressed]" }}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1
31 "Computing the theoretical value" }}{EXCHG {PARA 0 "" 0 "" {TEXT
-1 341 "The set of all triplets of numbers between 0 and 1 forms a uni
t cube in space. The fractional volume of the subset of points in this
cube which corresponds to allowed triangle side triplets should repre
sent the probability that a random triplet correspond to a triangle. W
e can calculuate this fractional volume using multivariable calculus.
" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1
101 "The following visualizes the volume within the unit cube for whic
h the 3 inequalities are satisfied " }{XPPEDIT 18 0 "z <= x+y;" "6#1%
\"zG,&%\"xG\"\"\"%\"yGF'" }{TEXT -1 18 " (below the plane " }{XPPEDIT
18 0 "z = x+y;" "6#/%\"zG,&%\"xG\"\"\"%\"yGF'" }{TEXT -1 128 ") and th
e other two obtained by cyclic permutation of the coordinates (togethe
r with the additional ones to remain in the cube " }{XPPEDIT 18 0 "x \+
<= 1;" "6#1%\"xG\"\"\"" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "y <= 1;" "6#1
%\"yG\"\"\"" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "z <= 1;" "6#1%\"zG\"\"\"
" }{TEXT -1 92 " ). We use parametrized surfaces as in multivariable c
alculus integration to plot each face:" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 12 "with(plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1
0 328 "face3:=plot3d([x,y,x+y],y=0..1-x,x=0..1):\nface2:=plot3d([x,x+z
,z],x=0..1-z,z=0..1):\nface1:=plot3d([y+z,y,z],z=0..1-y,y=0..1):\nface
4:=plot3d([x,y,1],y=1-x..1,x=0..1):\nface5:=plot3d([x,1,z],x=1-z..1,z=
0..1):\nface6:=plot3d([1,y,z],z=1-y..1,y=0..1):\ndisplay(seq(face||i,i
=1..6),axes=boxed,scaling=constrained,orientation=[-62,46]);\n" }}}
{EXCHG {PARA 0 "" 0 "" {TEXT -1 4 "The " }{XPPEDIT 18 0 "x;" "6#%\"xG
" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "z;" "6#%\"zG" }{TEXT -1 104 " la
bels seem to be switched here, but I failed in attempting to rotate th
is so that the axes look right." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}
{EXCHG {PARA 0 "" 0 "" {TEXT -1 273 "This is the region obtained by cu
tting off 3 pyramid shaped regions from the cube, which are the parts \+
of the cube with lie outside the 3 plane faces of the 3 nontrivial ine
qualities. We can compute the volume of one of these using a double in
tegral for the volume between " }{XPPEDIT 18 0 "z = 1;" "6#/%\"zG\"\"
\"" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "z = x+y;" "6#/%\"zG,&%\"xG\"\"
\"%\"yGF'" }{TEXT -1 68 " over the right triangle with sides equal to \+
unit vectors along the " }{XPPEDIT 18 0 "x;" "6#%\"xG" }{TEXT -1 5 " a
nd " }{XPPEDIT 18 0 "y;" "6#%\"yG" }{TEXT -1 69 " coordinate axes (tha
t is the upper left corner in the above diagram)" }}}{EXCHG {PARA 0 ">
" 0 "" {MPLTEXT 1 0 35 "V:=int(int(1-x-y,y=0..1-x),x=0..1);" }}}
{EXCHG {PARA 0 "" 0 "" {TEXT -1 59 "Alternatively the lower right miss
ing corner would be from " }{XPPEDIT 18 0 "z = 0;" "6#/%\"zG\"\"!" }
{TEXT -1 7 " up to " }{XPPEDIT 18 0 "z = x-y;" "6#/%\"zG,&%\"xG\"\"\"%
\"yG!\"\"" }{TEXT -1 19 " over the triangle " }{XPPEDIT 18 0 "y = 0;"
"6#/%\"yG\"\"!" }{TEXT -1 4 " to " }{XPPEDIT 18 0 "y = x;" "6#/%\"yG%
\"xG" }{TEXT -1 4 " as " }{XPPEDIT 18 0 "x = 0 .. 1;" "6#/%\"xG;\"\"!
\"\"\"" }{TEXT -1 1 ":" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "i
nt(int(x-y,y=0..x),x=0..1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 77 "Su
btracting 3 of these (by symmetry) from the unit volume of the cube le
aves:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "V_total:=1-3*(1/6)
;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 82 "for the volume of allowed tr
iplets which can form triangles. The fractional volume" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "V_total/1;" }}}{EXCHG {PARA 0 "> "
0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 155 "is the \+
probability of obtaining a triplet which can form a triangle from a po
int randomly chosen in the unit cube. [The text hint starts with this \+
result.]" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 0 {PARA 4 "" 0 ""
{TEXT -1 21 "vector algebra volume" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1
573 "Initially I thought I could use vector algebra to calculate the v
olume of the 3 pyramid shaped regions to be subtracted from the total \+
volume of the cube, starting with the fact that the triple scalar prod
uct (det) of 3 vector edges of a parallelopiped gives its volume up to
sign, but we only want the pyramid cutoff from that parallelopiped by
the plane containing the endpoints of these three edges opposite thei
r common vertex. It appears that this is 1/6 the parallelopiped volume
, but it did not look easy to prove quickly so I fell back on multivar
iable integration." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "a:=[1
,0,0]:\nb:=[1,1,0]:\nc:=[1,0,1]:" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 13 "with(linalg);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT
1 0 31 "matrix(augment(a,b,c));\ndet(%);" }}}{EXCHG {PARA 0 "" 0 ""
{TEXT -1 567 "So 1/6 of this is 1/6, namely the correct volume we comp
uted by integration above, but not many of us know that the pyramid fo
rmed by 3 vectors as edges from one vertex has 1/6 = 1/3! the volume o
f the whole parallelopiped volume that they determine, as in the 2-dim
ensional case where the triangle has 1/2 =1/2! the area of the paralle
logram area determined by two vectors as edges from a vertex. Hmm, I w
onder if this generalizes to 1/n! in n dimensions...? You pull on a co
ncrete problem with mathematical thoughts and it suggests an abstract \+
mathematical problem." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }
}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}}{MARK "0 0 0" 38 }
{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }