Overview

tan

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.

Usage#

Syntax#

tan(x)

Parameters#

Name Type Required Description
x real Yes The angle in radians.

Returns#

The tangent of x. The result is unbounded, approaching ±∞ near odd multiples of π/2.

Example#

Use tan to compute the tangent of an angle in radians.

Query

print result = tan(pi() / 4)

Run in Playground

Output

result
1.0000
  • sin: Returns the sine. Use sin and cos together for bounded cyclic encoding instead of tan, which is unbounded.
  • cos: Returns the cosine. It's 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 tan overflow values near π/2 poles.

Other query languages#

Splunk SPL users

In Splunk SPL, tan() takes an angle in radians and returns the tangent, just like APL.

Splunk example

| eval tan_val = tan(angle_rad)

APL equivalent

['sample-http-logs']
| extend tan_val = tan(angle_rad)
ANSI SQL users

In ANSI SQL, TAN() is a standard function with identical behavior.

SQL example

SELECT TAN(angle_rad) AS tan_val FROM logs

APL equivalent

['sample-http-logs']
| extend tan_val = tan(angle_rad)

Updated

Was this page helpful?