Activities
754
certain color. The second parameter is the number of balls to select. This function
returns a list where each element is the number of balls of each color that were selected.
Sampling without Replacement
Suppose an urn contains
n1
balls of a color,
n2
balls of a second color,
n3
balls of a third
color, etc. Simulate drawing balls without replacing them.
:drawball(urnlist,drawnum)
:Func
:Local templist,drawlist,colordim,
numballs,i,pick,urncum,j
:If drawnum>sum(urnlist)
:Return “too few balls”
:dim(urnlist)
!
colordim
:urnlist
!
templist
:newlist(colordim)
!
drawlist
:For i,1,drawnum,1
:sum(templist)
!
numballs
:rand(numballs)
!
pick
(
continued in next column
)
:For j,1,colordim,1
:cumSum(templist)
!
urncum
:If pick
urncum[j] Then
:drawlist[j]+1
!
drawlist[j]
:templist[j]
N
1
!
templist[j]
:Exit
:EndIf
:EndFor
:EndFor
:Return drawlist
:EndFunc
1. Enter a random seed using the
RandSeed
command.
2. Assuming the urn contains 10 red balls
and 25 white balls, simulate picking 5
balls at random from the urn without
replacement. Enter
drawball({10,25},5)
.
Result: 2 red balls and 3 white balls.
Summary of Contents for Titanium TI-89
Page 9: ...Getting Started 6 TI 89 Titanium keys Ë Ì Í Ê ...
Page 34: ...Getting Started 31 2 or D 2 B u s i n e s s D B D B Press Result ...
Page 43: ...Getting Started 40 3 0 D B D D B D Press Result ...
Page 44: ...Getting Started 41 D 2 0 0 2 D B Scroll down to October and press Press Result ...
Page 58: ...Getting Started 55 Example Set split screen mode to TOP BOTTOM Press Result 3 B D ...
Page 70: ...Getting Started 67 ...
Page 175: ...Operating the Calculator 172 From the Keyboard ...
Page 456: ...Tables 453 ...
Page 527: ...Data Matrix Editor 524 ...