EasyManua.ls Logo

Texas Instruments TI-89 Titanium

Texas Instruments TI-89 Titanium
977 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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]
N1!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.

Table of Contents

Other manuals for Texas Instruments TI-89 Titanium

Related product manuals