cot
cot is useful when you work with angular or cyclic calculations and need the cotangent as part of a larger formula. In observability, you might use it to transform normalized metric ratios into angular coordinates for signal analysis.
Usage#
Syntax#
cot(x)Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
x |
real | Yes | The angle in radians. Must not be a multiple of π. |
Returns#
The cotangent of x. Returns infinity or null when sin(x) equals zero (that is, when x is a multiple of π).
Example#
Use cot to compute the cotangent of an angle in radians.
Query
print result = cot(pi() / 4)Output
| result |
|---|
| 1.0000 |
List of related functions#
- tan: Returns the tangent, the reciprocal of
cot. Use it as the primary trigonometric ratio when cotangent isn't needed. - sin: Returns the sine. Use it along with
costo compute cotangent manually ascos(x)/sin(x). - cos: Returns the cosine. Use it in combination with
sinfor manual cotangent calculation. - atan: Returns the arc tangent. Use it as the inverse of
tanwhen you need to recover an angle. - radians: Converts degrees to radians. Use it to prepare degree-based angle inputs before calling
cot.
Other query languages#
Splunk SPL users
Splunk SPL doesn't include a built-in cot() function. You compute it as the reciprocal of tan().
Splunk example
| eval cot_val = 1 / tan(angle_rad)APL equivalent
['sample-http-logs']
| extend cot_val = cot(angle_rad)ANSI SQL users
ANSI SQL does not define a standard COT() function, though SQL Server provides one. In PostgreSQL and other databases, you compute it as 1 / TAN(x).
SQL example
SELECT 1.0 / TAN(angle_rad) AS cot_val FROM logsAPL equivalent
['sample-http-logs']
| extend cot_val = cot(angle_rad)