series_sin
This page explains how to use the series_sin function in APL.
The series_sin function in APL returns the sine of each element in a numeric array. It applies the mathematical sine function element by element, producing a new array of the same length.
You use series_sin when you want to transform numeric sequences into their trigonometric equivalents. This is useful for signal processing, data transformations, or preparing time series data for statistical and mathematical analysis.
Usage
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
arr | dynamic | An array of numeric values. |
Returns
A dynamic array where each element is the sine of the corresponding input element.
Use case examples
You can use series_sin to transform request durations into trigonometric values for advanced analysis, such as periodicity detection.
Query
Output
| arr | sin_arr |
|---|---|
| [120, 250, 500, 750] | [−0.58, −0.97, −0.52, 0.94] |
This query collects a sample of request durations and applies series_sin to generate a transformed series for analysis.
You can use series_sin to apply trigonometric transformation to span durations for modeling or feature extraction.
Query
Output
| service.name | arr | sin_arr |
|---|---|---|
| frontend | [200, 400, 600] | [0.91, −0.73, −0.28] |
This query groups spans by service, aggregates durations into arrays, and transforms them using series_sin.
You can use series_sin to apply mathematical transformations to response times in security-related traffic to detect unusual patterns.
Query
Output
| geo.country | arr | sin_arr |
|---|---|---|
| US | [180, 360, 540] | [−0.80, −0.99, −0.84] |
This query filters failed requests (403) by country, aggregates durations, and applies series_sin to identify periodic anomalies.
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_tan: Returns the tangent of each element in an array. Use it when you want to transform arrays with tangent-based periodicity.