tan function in APL to compute the tangent of an angle expressed in radians. The tangent is defined as the ratio of the sine to the cosine: tan(x) = sin(x) / cos(x). The function is undefined at odd multiples of π/2, where the cosine is zero.
tan is useful when you work with angular data or want to convert a ratio into an angle. In observability contexts, it can be used alongside sin and cos to encode periodic signals or compute angular features for cyclic analysis.
For users of other query languages
If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.Splunk SPL users
Splunk SPL users
In Splunk SPL,
tan() takes an angle in radians and returns the tangent, just like APL.ANSI SQL users
ANSI SQL users
In ANSI SQL,
TAN() is a standard function with identical behavior.Usage
Syntax
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
x | real | Yes | The angle in radians. |
Returns
The tangent ofx. The result is unbounded, approaching ±∞ near odd multiples of π/2.
Example
Usetan to compute the tangent of an angle in radians.
Query
| result |
|---|
| 1.0000 |
List of related functions
- sin: Returns the sine. Use
sinandcostogether for bounded cyclic encoding instead oftan, which is unbounded. - cos: Returns the cosine. It is the denominator in
tan(x) = sin(x) / cos(x). - cot: Returns the cotangent, the reciprocal of
tan. Use it when you need the inverse ratio. - atan: Returns the arc tangent. Use it as the inverse of
tan. - isfinite: Returns whether a value is finite. Use it to filter out
tanoverflow values near π/2 poles.