SIN | COS | TAN | ASIN | ACOS | ATAN inputVector resultVector

These are the standard trigonometric functions. Each replaces the contents of the resultVector with the trig function of each element of the inputVector.

The elements are assumed to be in radians, not degrees.

There are two subroutines in the lib directory file trigCommands.txt that convert between degrees and radians. These are TODEG, which converts an angle in degrees to radians, and TORAD, which converts the other direction.

There are also trig subroutines in the same lib directory file, trigCommands.txt, that accept angles in degrees. Their names are: SINDEG, ASINDEG, COSDEG, ACOSDEG, TANDEG, ATANDEG.


The trig functions are used much like any other math function in Statistics101/Resampling Stats:

COPY 0,3 vec
SIN vec sinVec
COS vec cosVec
PRINT sinVec cosVec

The above program produces the following output:

sinVec: (0.0 0.8414709848078965 0.9092974268256817 0.1411200080598672)
cosVec: (1.0 0.5403023058681398 -0.4161468365471424 -0.9899924966004454)
Since the value of pi is not a predefined constant in Resampling Stats, you can compute it as in the following example:
'Compute the value of pi:
ACOS 0 temp
ADD temp temp pi
PRINT pi

The above program produces the following output:

pi: 3.141592653589793



For your convenience, pi and other mathematical constants are defined in the file "lib/mathConstants.txt".