Apple II User Manual

Page of 257
                Note that (B-A)*RND(1)+A will
                generate a random number between
                A and B.
STATEMENT       SYNTAX/FUNCTION                                         EXAMPLE
SGN             SGN (expression)                                        230 PRINT SGN(X)
                Gives 1.  If X>0, 0 if X=0, and -1 if
                X<0.
STATEMENT       SYNTAX/FUNCTION                                         EXAMPLE
SIN             SIN (expression)                                        190 PRINT SIN(X)
                Gives the sine of the expression X.  X is
                interpreted as being in radians.  Note:
                COS(X) =SIN(X+3.14159/2) and that
                1 Radian = 180/PI degrees = 57.2958
                degrees; so that the sine of X degrees=
                SIN(X/57.2958).
STATEMENT       SYNTAX/FUNCTION                                         EXAMPLE
SQR             SQR (expression)                                        180 PRINT SQR(X)
                Gives the square root of the expression X.
                An FC error will occur if X is less than zero,
STATEMENT       SYNTAX/FUNCTION                                         EXAMPLE
TAN             TAN (expression)                                        200 PRINT TAN(X)
                Gives the tangent of the expression X.  X is
                interpreted as being in radians.
DERIVED FUNCTIONS
The following functions, while not intrinsic to BASIC, can be calculated using the existing BASIC
functions:
FUNCTION                 FUNCTION EXPRESSED IN TERMS OF BASIC FUNCTIONS
SECANT                   SEC(X) = 1/COS(X)
COSECANT                 CSC(X) = 1/SIN(X)
COTANGENT                COT(X) = 1/TAN(X)
INVERSE SINE*            ARCSIN(X) = ATN(X/SQR(-X*X+1))
INVERSE COSINE*          ARCCOS(X) = -ATN(X/SQR(-X*X+1))+1.5708
INVERSE SECANT*          ARCSEC(X) = ATN(SQR(X*X-1))+(SGN(X)-1)*1.5708
INVERSE COSECANT*        ARCCSC(X) = ATN(1/SQR(X*X-1))+(SGN(X)-1)*1.5708
INVERSE COTANGENT*       ARCCOT(X) = -ATN(X)+1.5708
HYPERBOLIC SINE          SINH(X) = (EXP(X)-EXP(-X))/2
HYPERBOLIC COSINE        COSH(X) = (EXP(X)+EXP(-X))/2
HYPERBOLIC TANGENT       TANH(X) = -EXP(-X)/(EXP(X)+EXP(-X))*2+1
HYPERBOLIC SECANT        SECH(X) = 2/(EXP(X)+EXP(-X))
HYPERBOLIC COSECANT      CSCH(X) = 2/(EXP(X)-EXP(-X))
HYPERBOLIC
COTANGENT                COTH(X) = EXP(-X)/(EXP(X)-EXP(-X))*2+1
*These functions require the user-defined ATN function.  See Appendix H for details.