Simulating Random Variables - HP 39g Master Manual

Graphing calculator
Hide thumbs Also See for 39g:
Table of Contents

Advertisement

The expression INT(RANDOM*6+1) will
simulate one roll of the die. This means that
MAKELIST(INT(RANDOM*6+1),X,1,500,1)
will simulate 500 rolls of a normal die.
We therefore need only store the
resulting list into a Statistics aplet
column to analyze and graph it. This
is shown in the series of screen shots
to the right.
To simulate the adding of two six sided dice, use the similar expression
MAKELIST(INT(RANDOM*6+1)+INT(RANDOM*6+1),X,1,500,1)

Simulating Random Variables

It is occasionally handy to be able to simulate a set of observations on
random variables of various sorts. This can also be done using the MATH
menu function MAKELIST. (See previous page for syntax. Covered in more
detail on page 266)
Example 1: Simulate 100 observations on a U[0,1] r.v. to be stored in C2.
In the HOME view type: MAKELIST(RANDOM,X,1,100,1) C2
Note: 1. The
appearing as
2. The X is only a dummy variable here to count off the values.
Example 2: Simulate 50 observations on a discrete uniform r.v. U[3,7]
In HOME type: MAKELIST(INT(5*RANDOM+3),X,1,50,1) C2
Example 3: Simulate 50 obs. on a Binomial r.v. with n = 20 and p = 0.75.
In HOME type:
MAKELIST( Σ (I=1,20,RANDOM<0
Note: The Σ and the = are both on the keyboard. This will be a
relatively slow calculation because it involves evaluating 1000
random numbers.
symbol is one of the screen keys in the HOME view,
and read as 'store'.
130
.
75),X,1,50,1) C2

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

40g39g+

Table of Contents