series_asin
This page explains how to use the series_asin function in APL.
The series_asin function computes the arc sine (inverse sine) of each numeric element in a dynamic array. It returns a new array of the same length, where each element is the arc sine of the corresponding input element. The function is useful when you want to transform time series data or arrays of numeric values into angular measurements. This can help in advanced mathematical modeling, anomaly detection, and when working with normalized data that represents sine values.
You use series_asin when you need to invert sine transformations stored in array form, for example, to reconstruct angular information from periodic signals or normalize log and trace metrics for statistical or geometric analysis.
Usage
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
array | dynamic | A dynamic array of numeric values. Each element should be between -1 and 1, the valid domain of the arc sine function. |
Returns
A dynamic array of the same length as the input, where each element is the arc sine (in radians) of the corresponding input element.
Use case examples
When analyzing HTTP logs, you can normalize request durations to the range [-1, 1] and then apply series_asin to transform them into angular values for further statistical analysis.
Query
Output
| id | durations | normalized | angles |
|---|---|---|---|
| A12 | [100, 200, 300, 400, 500] | [0.1, 0.2, 0.3, 0.4, 0.5] | [0.100, 0.201, 0.305, 0.412, 0.524] |
The query collects request durations per user ID, normalizes them, and applies series_asin to transform values into angles.
For traces, you can normalize span durations and use series_asin to derive angular representations, which can be helpful in detecting periodic workload patterns.
Query
Output
| service.name | spans | normalized | angles |
|---|---|---|---|
| frontend | [12000000, 15000000, 20000000] | [1.2, 1.5, 2.0] | [null, null, null] |
| cartservice | [5000000, 8000000, 10000000] | [0.5, 0.8, 1.0] | [0.524, 0.927, 1.571] |
This query collects spans per service, normalizes their durations, and computes arc sine values. Values outside [-1, 1] result in null.
When examining security logs, you can normalize request durations for suspicious requests and use series_asin to highlight anomalous access patterns.
Query
Output
| geo.country | requests | normalized | angles |
|---|---|---|---|
| US | [50, 200, 400, 600] | [0.05, 0.2, 0.4, 0.6] | [0.050, 0.201, 0.412, 0.644] |
The query groups requests by country and converts normalized durations into angular values for anomaly detection.
List of related functions
- series_acos: Returns the arc cosine of each element in an array. Use when you need to invert cosine transformations instead of sine.
- series_atan: Returns the arc tangent of each element in an array. Useful for handling tangent-derived data.