From e5a44964ff1b6d4efd3b4ad747541d6ec3b33cc5 Mon Sep 17 00:00:00 2001 From: Levi Harrison Date: Mon, 23 Aug 2021 20:15:32 -0400 Subject: [PATCH] Added docs Signed-off-by: Levi Harrison --- docs/querying/functions.md | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/querying/functions.md b/docs/querying/functions.md index 079a1e320..ad7d25f20 100644 --- a/docs/querying/functions.md +++ b/docs/querying/functions.md @@ -434,3 +434,45 @@ over time and return an instant vector with per-series aggregation results: Note that all values in the specified interval have the same weight in the aggregation even if the values are not equally spaced throughout the interval. + +## Trigonometric Functions + +- `acos(v instant-vector)`: calculates the arccosine, in radians, of all elements in `v`. Special cases are: + - `acos(x) = NaN if x < -1 or x > 1` +- `asin(v instant-vector)`: calculates the arcsine, in radians, of all elements in `v`. Special cases are: + - `asin(±0) = ±0` +- `atan(v instant-vector)`: calculates the arctangent, in radians, of all elements in `v`. Special cases are: + - `atan(±0) = ±0` + - `atan(±Inf) = ±Pi/2` +- `atan2(y, x instant-vector)`: calculates the arctangent of `y`/`x` for all elements, in radians, using the signs of the two to determine the quadrant of the result ([from the package](https://pkg.go.dev/math#Atan2)). Special cases are: + - `atan2(y, NaN) = NaN` + - `atan2(NaN, x) = NaN` + - `atan2(+0, x>=0) = +0` + - `atan2(-0, x>=0) = -0` + - `atan2(+0, x<=-0) = +Pi` + - `atan2(-0, x<=-0) = -Pi` + - `atan2(y>0, 0) = +Pi/2` + - `atan2(y<0, 0) = -Pi/2` + - `atan2(+Inf, +Inf) = +Pi/4` + - `atan2(-Inf, +Inf) = -Pi/4` + - `atan2(+Inf, -Inf) = 3Pi/4` + - `atan2(-Inf, -Inf) = -3Pi/4` + - `atan2(y, +Inf) = 0` + - `atan2(y>0, -Inf) = +Pi` + - `atan2(y<0, -Inf) = -Pi` + - `atan2(+Inf, x) = +Pi/2` + - `atan2(-Inf, x) = -Pi/2` +- `cos(v instant-vector)`: calculates the cosine, in radians, of all elements in `v`. Special cases are: + - `cos(±Inf) = NaN` + - `cos(NaN) = NaN` +- `deg(v instant-vector)`: converts radians to degrees for all elements in `v`. +- `pi()`: returns the first 16 digits of Pi. +- `rad(v instant-vector)`: converts degrees to radians for all elements in `v`. +- `sin(v instant-vector)`: calculates the sine, in radians, of all elements in `v`. Special cases are: + - `sin(±0) = ±0` + - `sin(±Inf) = NaN` + - `Sin(NaN) = NaN` +- `tan(v instant-vector)`: calculates the tangent, in radians, of all elements in `v`. Special cases are: + - `tan(±0) = ±0` + - `tan(±Inf) = NaN` + - `tan(NaN) = NaN` \ No newline at end of file