Random Numbers; User-Definable Keys - HP -11C Owner's Handbook Manual

Hide thumbs Also See for HP-11C:
Table of Contents

Advertisement

216
Section 11: Pragramining Techniques
Regression
Exponential
Logarithmic
Power
The two flags are initially set by the program and, depending on
the choice
of curve
fit, one
or the other
may
be cleared
in
accordance with the above table. The status of the two flags
determines the treatment of the input data (x, and y,) as follows:
2
f Input x; and yi. 7
pac atc
The treatment of the output value (A) is similar.
The use of flags here is very convenient. A problem that otherwise
might have required three separate programs is solved very neatly
in one. The use of flags can become a very powerful tool and will
enhance your own personal programs.
~ wo
~
ee
Oe
Ne
a ae
wi
Section 11: Programming Techniques
217
Random Numbers
The HP-11C has a convenient built-in function that generates
pseudo-random
numbers
([RAN#]). By pseudo-random
we mean
that no calculator or computer,
no matter
how powerful, can
generate a totally random number. The nature of the machine is
such that it performs a sequence of established steps on an input
and produces a predictable result. So the random number generator
on the HP-11C takes a random "seed", stored by the user, and
performs an operation on it to produce a generally unpredictable
(by the user) result. This result is always a number between 0 and 1,
exclusive of 1.
To illustrate the ease in which different ranges of random numbers
may be generated let's take another example. Suppose you need a
real number between the limits 34.5 and 98.36 including the lower
bound and excluding the upper bound. The routine need only
generate values between 0 and 63.86 (98.36 - 34.50) to which the
value 34.5 will be added. This range is easily generated
by
multiplying
63.86
by the output
from
the random
number
generator,
User-Definable Keys
Among the most useful features on the HP-11C are the five user-
definable keys: (A), (8), (C), (D], and
[E]. These keys are particularly
useful for three applications:
1.
Storing data in specific registers (see page 213).

Advertisement

Table of Contents
loading

Table of Contents