series_tan
function computes the tangent of each numeric element in a dynamic array. You use it when you work with time series or other array-based datasets and want to transform values using the trigonometric tangent. For example, you can convert request durations, latency values, or span durations into their tangent values for mathematical modeling, anomaly detection, or visualization.
This function is useful when you want to:
- Apply trigonometric transformations to time series data.
- Prepare data for advanced mathematical or statistical analysis.
- Detect periodic or angular patterns in logs, traces, or security events.
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
Splunk SPL doesn’t include a direct
tan
function for arrays. In SPL, you often use eval
with tan()
on scalar values. In APL, series_tan
applies the tangent function element-wise to an entire array, which makes it better suited for time series or dynamic arrays.ANSI SQL users
ANSI SQL users
In ANSI SQL, you use the
TAN()
function on scalar values, but there is no native array type or array-wide trigonometric function. In APL, series_tan
applies tan
to each array element, which makes it easy to work with time series data.Usage
Syntax
Parameters
Parameter | Type | Description |
---|---|---|
array | dynamic (array of numeric values) | The array of numeric values to apply the tangent function to. |
Returns
A dynamic array where each element is the tangent of the corresponding input element.Use case examples
You want to analyze request durations and apply a trigonometric transformation to highlight periodic anomalies.QueryRun in PlaygroundOutput
This query groups request durations by user ID, transforms them into arrays, and applies the tangent function element-wise.
id | durations | tan_series |
---|---|---|
A123 | [100, 200, 300] | [1.56, -2.19, -0.14] |
B456 | [150, 250, 350] | [14.10, -0.75, 0.51] |
List of related functions
- series_abs: Returns the absolute value of each element in an array. Use it to normalize negative values in arrays.
- series_acos: Computes the arccosine of each element in an array. Use when you want the inverse cosine.
- series_atan: Computes the arctangent of each element in an array. Use when you want the inverse tangent.
- series_cos: Returns the cosine of each element in an array. Use it when analyzing cyclical data with a phase shift.
- series_sin: Returns the sine of each element in an array. Use it when analyzing cyclical data with a phase shift.