MySQL COT() Function
The COT()
function in MySQL calculates the cotangent of an angle. The cotangent is the reciprocal of the tangent (cot(x) = 1 / tan(x)). The input to the function is an angle expressed in radians.
COT(): Definition and Usage
The cotangent is a trigonometric function useful in various mathematical and geometrical calculations. COT()
provides a convenient way to compute cotangent values directly within your MySQL queries. Note that if the input is 0, the function may return an error or NULL
, as the cotangent of 0 is undefined.
Syntax
Syntax
COT(number)
Parameter Values
Parameter | Description |
---|---|
number |
The angle in radians for which you want to compute the cotangent. This is a required numeric value. If the value is 0, the result might be an error or NULL. |
Examples
Calculating the Cotangent of a Positive Number
This example calculates the cotangent of 6 radians.
Syntax
SELECT COT(6);
Output
-0.29100619
Calculating the Cotangent of a Negative Number
This example calculates the cotangent of -2 radians.
Syntax
SELECT COT(-2);
Output
-0.45765755