EasyManuals Logo

Sinclair ZX81 User Manual

Sinclair ZX81
92 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 #13 background imageLoading...
Page #13 background image
The trigonometrical functions, &
EXP
,
LN
&
SQR
, are generally calculated to 8 digits accuracy.
RND
&
RAND
: These are both on the same key, but whereas
RND
is a function,
RAND
is a keyword, like
PRINT
.
RAND
is used for controlling the randomness of
RND
.
RND
is not truly random, but follows a fixed sequence of 65536 numbers that happen to be so jumbled
up as to appear random (
RND
is pseudo-random). You can use
RAND
to start
RND
off at a definite place
in this sequence by typing
RAND
, & then a number between 1 & 65535, & then
NEWLINE
. It's not so
important to know where a given number starts
RND
off, as that the same number after
RAND
will always
start
RND
off at the same place. For instance, type
RAND
1 (&
NEWLINE
)
& then
PRINT RND
& type both these in turn several times. (Remember to use
FUNCTION
to get
RND
.) The answer from
RND
will always be 0.0022735596, not a very random sequence.
RAND
0
(or you can miss out the 0) acts slightly differently: it judges where to srart
RND
off by how long the
television has been on, & this should be genuinely random.
Note
: In some dialects of BASIC you must always enclose the arguments of a function on brackets. This is
not the case in ZX81 8K BASIC.
Summary
Starement:
RAND
Functions:
SGN
.
ABS
,
SIN
,
COS
,
TAN
,
ASN
,
ACS
,
ATN
,
LN
,
EXP
,
SQR
,
INT
,
PI
,
RND
FUNCTION
Exercises
1. To get common logorithms (to base 10), which are what you'd look up in log tables, divide the natural
logarithm by
LN
10. For instance, to find log 2,
PRINT LN
2/
LN
10
which gives the answer 0.30103.
Try doing multiplication & division using logs, using the ZX81 as a set of log tables in this way (for
antilogs, see chapter 2, exercise 3). Check the answer using * and / - which are easier, quicker, more
accurate, & much to be preferred.
2.
EXP
&
LN
are mutually inverse
functions in the same sense that if you apply one & then the other, you
get back to your original number. For instance,
LN EXP
2 =
EXP LN
2 = 2
The same also holds for
SIN
&
ASN
, for
COS
&
ACS
, & for
TAN
&
ATN
. You can use this to test how
accurately the computer works out these functions.
3. radians are 180°, so to convert from degrees to radians you divide by 180 & multiply by : thus
PRINT TAN
(45/180*
PI
)
gives tan 45° (1).
To get from radians to degrees, you divide by & multiply by 180.
4. Try
PRINT RND
a few times to see how the answer varies. Can you detect any pattern? (Unlikely.)

Other manuals for Sinclair ZX81

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Sinclair ZX81 and is the answer not in the manual?

Sinclair ZX81 Specifications

General IconGeneral
ProcessorZilog Z80A
Processor Speed3.25 MHz
ROM8 KB
InputMembrane keyboard
StorageCassette tape
Power Supply9V DC
Dimensions167 mm x 40 mm x 175 mm
Release Year1981
ManufacturerSinclair Research
Weight350 g
Operating SystemSinclair BASIC
RAM1 KB
PortsTV out, expansion port
DisplayTelevision (RF modulator output)

Related product manuals