EasyManuals Logo
Home>Texas Instruments>Calculator>TI-89

Texas Instruments TI-89 Guide Book

Texas Instruments TI-89
623 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
Page #424 background imageLoading...
Page #424 background image
Chapter 23: Activities 407
23ACTS.DOC TI-89/TI-92 Plus: Activities (English) Susan Gullord Revised: 02/23/01 1:24 PM Printed: 02/23/01 2:20 PM Page 407 of 26
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
:For j,1,colordim,1
:cumSum(templist)
!
urncum
(continued in next column)
:If pick
urncum[j] Then
:drawlist[j]+1
!
drawlist[j]
:templist[j]
ì
1
!
templist[j]
:Exit
:EndIf
:EndFor
:EndFor
:Return drawlist
:EndFunc
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.
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.
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 Chapter 17: Programming.
Sampling-without-
Replacement
Function
Sampling without
Replacement

Table of Contents

Other manuals for Texas Instruments TI-89

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-89 and is the answer not in the manual?

Texas Instruments TI-89 Specifications

General IconGeneral
Display size (HxV)100 x 160 mm
Memory type639K FLASH ROM, 188K bytes RAM
Compatible operating systemsOperating System 2.09
Battery typeAAA

Related product manuals