FUNCTIONS AVAILABLE TO THE BASIC USER Basic has a limited number of built in mathematical functions Those which do not exist directly can easily be defined using the DEFINE FUNCTION statement of BASIC. DEFINE FUNCTION STATEMENT DEF FN (list) = expression DEF FN%(list) = expression DEF FN$(list) = expression where: IS AN ALPHABETIC CHARACTER (A-Z) THAT BECOMES PART OF THE FUNCTION NAME. % INDICATES THE FUNCTION RETURNS AN INTEGER VALUE. $ INDICATES THAT THE FUNCTION RETURNS A STRING VALUE (list) Contains from 1-5 dumy variables (var1,var2,var3,var4,var5) expression is evaluated each time the function is used. It may contain any of the dumy variables or any other variables in the program. DEFINED FUNCTIONS SIN(expression) expression is an angle in radians COS(expression) ATN(expression) PI Returns the value of PI (3.14159) SQR(expression) Returns the square root EXP(expression) Returns the exponential function. LOG(exp) LOG10(exp) Returns the natural and base 10 logarithm. INT(exp) Returns the integer part of the expression. ABS(exp) Returns the absolute value the expression. SGN(exp) Returns +1 if the expression is positive, -1 if negative. RND Gives a pseudo random number from 0 to 1 each time it is used. The pseudo random numbers generated are randomized further by executing a RANDOMIZE statement within the program. If this were not done the random numbers generated each time the program is run would be the same. USEFUL EXPRESSIONS (where E is any expression) TAN(E) = SIN(E)/COS(E) SEC(E) = 1/COS(E) CSC(E) = 1/SIN(E) COT(E) = COS(E)/SIN(E) ASIN(E) = ATN(E/SQR(1-E*E)) ACOS(E) = ATN(SQR(1-E*E)/E) ASEC(E) = ATN(SQR(E*E-1)) ACSC(E) = ATN(1/SQR(E*E-1)) ACTN(E) = ATN(1/E) SINH(E) = (EEP(E)-EEP(-E))/2 COSH(E) = (EEP(E)+EEP(-E))/2 TANH(E) = (EEP(E)-EEP(-E))/(EEP(E)+EEP(-E)) ASINH(E) =LOG(E+SQR(E*E+1)) ACOSH(E) = LOG(E+SQR(E*E-1)) ATANH(E) = (LOG(1+E) - LOG(1-E))/2