Activities
775
Simulation of Sampling without Replacement
Simulation of Sampling without Replacement
Simulation of Sampling without Replacement
Simulation of Sampling without Replacement
This activity simulates drawing different colored balls from an urn without replacing them.
Detailed information about the steps used in this example can be found in the electronic
chapter
Programming
.
Sampling-without- Replacement Function
Sampling-without- Replacement Function
Sampling-without- Replacement Function
Sampling-without- Replacement Function
In the
Program Editor
, define
drawball( )
as a function that can be called with two
parameters. The first parameter is a list where each element is the number of balls of a
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.
: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
Summary of Contents for TI-89 Voyage 200
Page 1: ...TI 89 Titanium Graphing Calculator...
Page 35: ...Getting Started 35 2 B u s i n e s s D B D B Press Result...
Page 44: ...Getting Started 44 3 0 D B D D Press Result...
Page 45: ...Getting Started 45 B D D 2 0 0 2 Press Result...
Page 46: ...Getting Started 46 D B Scroll down to October and press D 1 9 Press Result...
Page 60: ...Getting Started 60 Example Set split screen mode to TOP BOTTOM Press Result 3 B D...
Page 63: ...Getting Started 63 2 D B 4 Press Result...
Page 453: ...Differential Equation Graphing 453...
Page 468: ...Tables 468...
Page 539: ...Data Matrix Editor 539...