Topic: APLX Help : Help on APL language : APL Primitives : ○ Circular functions
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

Circular and Hyperbolic functions


Two-argument form  See also one-argument form pi times

This form of provides you with a group of related functions. The left argument identifies which of these functions you wish to use, the right argument is the data the function works on. (Data to trigonometric functions is expressed in radians.)

     Left argument 0 or positive          Left argument negative
     0  square root of 1-X*2
     1  sin X                             ¯1  arcsin X
     2  cos X                             ¯2  arccos X
     3  tan X                             ¯3  arctan X
     4  square root of (X*2)+1            ¯4  square root of (X*2)-1
     5  sinh X                            ¯5  arcsinh X
     6  cosh X                            ¯6  arcosh X
     7  tanh X                            ¯7  arctanh X

For example:

             1 ○ ○÷4                 (45 degrees is ○÷4 radians and
       0.7071067812                  Sin of 45 degrees is 1÷root 2)

The functions 0○, 4○, ¯4○ are known as the 'Pythagorean functions'. For example, given a right-angled triangle with hypotenuse of length 1, the length of one of the other two sides is 0 times the length of the third side. Conversely, if one of the sides in the triangle adjacent to the right angle is of length 1, the length of the hypotenuse is given by 4○ times the length of the third side and the length of the third side is ¯4 times the length of the hypotenuse.

Numeric Accuracy

Calculations of trigonometric functions are subject to accuracy limitations, especially near mathematical singularities. In addition, for very large arguments, the circular functions become meaningless because of limitations in the resolution of floating-point numbers, since the 'correct' answer depends on bits which have been lost from the representation. For these reasons, APLX gives a DOMAIN ERROR if you ask for the sine, cosine or tangent of a number greater than 2*51.


Topic: APLX Help : Help on APL language : APL Primitives : ○ Circular functions
[ Previous | Next | Contents | Index | APL Home ]