Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v2 n9 (Volume 2, Issue 9)
Date: September 1981
Pages: 2
You can closely approximate sine functions on your 4K ROM with a few BASIC statements.
These equations simulate sine between 0 and 45° (X in integer degrees):
1000sin(X)=[ 2621X - 11X² - 11X³ ]/10
----- ---- ----
15 450 1350
Program sine using:
R=(11*X**2)/450+((11*X**2)/1350)*X
S=(262*X)/15-R/10
where S is 1000 times sin(X).
Lori Olson added this note to her sine and cosine programs. To approximate tangent with 4K ROM, use this equation:
1000tan(X)=1000sin(X)
cos(X)
Program tangent using:
LET T=(25*S)/(C/40)
where S=1000sin(X), C=1000cos(X). (See p.2 & p.16 for sin and cos.) The error increases with X and any X>88 produces an overflow.
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.