MathLib.cot()

MathLib.cot() calculates the cotangent of a number (given in radians). \[ \text{MathLib.cot}(x) = \cot(x) \]

Examples

To calculate the cotangent of 2 type: MathLib.cot(2);

Specification

MathLib.cot accepts one argument. Any additional arguments will be ignored. The type of the argument should be number. For other argument types see the unary function specification.
  • MathLib.cot(NaN) = NaN
  • MathLib.cot(+0) = +∞
  • MathLib.cot(-0) = -∞
  • MathLib.cot(+∞) = NaN
  • MathLib.cot(-∞) = NaN
  • otherwise MathLib.cot(x) = cotangent of x

Implementation

MathLib uses the identity \[ \cot(x) = \tan\left(\frac{\pi}{2}-x\right) \] and the built-in JavaScript function Math.tan.

Tests

Categories: unary Function