Mathematical Functions
Mathematical trigonometric functions calculate the sine, cosine, and tangent of angles in radians.
MATH.SIN
Returns the Sine of the input in radians.
SYNTAX
math.sin(input)
input
- Type: double
- Description: The attribute to return the sine of
OUTPUT
double
EXAMPLE
SELECT math.sin(radians) as sine_output
radians | → | sine_output |
---|---|---|
1.5707963267948966 | 1.0 | |
0.0 | 0.0 | |
NaN | NaN | |
Infinity | NaN | |
-Infinity | NaN | |
null | null |
MATH.COS
Returns the Cosine of the input in radians.
SYNTAX
math.cos(input)
input
- Type: double
- Description: The attribute to return the cosine of
OUTPUT
double
EXAMPLE
SELECT math.cos(radians) as cosine_output
radians | → | cosine_output |
---|---|---|
3.141592653589793 | -1.0 | |
0.0 | 1.0 | |
NaN | NaN | |
Infinity | NaN | |
-Infinity | NaN | |
null | null |
MATH.TAN
Returns the trigonometric Tangent of an angle.
SYNTAX
math.tan(input)
input
- Type: double
- Description: An angle, in radians
OUTPUT
double
EXAMPLE
SELECT math.tan(input) as tan_output
input | → | tan_output |
---|---|---|
0.0 | 0.0 | |
Infinity | NaN | |
-Infinity | NaN | |
NaN | NaN | |
null | null |
MATH.ASIN
Computes the Inverse Sine of the input in radians.
SYNTAX
math.asin(input)
input
- Type: double
- Description: The attribute to return the arcsine of
OUTPUT
double
EXAMPLE
SELECT math.asin(input) as arcsine_output
input | → | arcsine_output |
---|---|---|
1.0 | 1.5707963267948966 | |
20.0 | NaN | |
0.0 | 0.0 | |
Infinity | NaN | |
-Infinity | NaN | |
null | null |
MATH.ACOS
Computes the Inverse Cosine of the input in radians.
SYNTAX
math.acos(input)
input
- Type: double
- Description: The attribute to return the arccosine of
OUTPUT
double
EXAMPLE
SELECT math.acos(input) as arccosine_output
input | → | arccosine_output |
---|---|---|
1.0 | 0.0 | |
0.0 | 1.5707963267948966 | |
Infinity | NaN | |
-Infinity | NaN | |
null | null |
MATH.ATAN
Computes the Inverse Tangent of the input in radians.
SYNTAX
math.atan(input)
input
- Type: double
- Description: The attribute to return the arctangent of
OUTPUT
double
EXAMPLE
SELECT math.atan(input) as arctan_output
input | → | arctan_output |
---|---|---|
0.0 | 0.0 | |
1.0 | 0.7853981633974483 | |
NaN | NaN | |
null | null |
MATH.ATAN2
Returns the angle from the conversion of rectangular coordinates to polar coordinates using the Two Argument Arctangent.
SYNTAX
math.atan2(y, x)
y
- Type: double
- Description: The y coordinate in the cartesian plane
x
- Type: double
- Description: The x coordinate in the cartesian plane
OUTPUT
double
EXAMPLE
SELECT math.atan2(y, x) as arctan2_output
y | x | → | arctan2_output |
---|---|---|---|
0.0 | 0.0 | 0.0 | |
0.0 | Infinity | 0.0 | |
0.0 | -Infinity | 3.141592653589793 | |
NaN | 0.0 | NaN | |
null | 0.0 | null |
MATH.DEGREES
Converts the radian input to degrees.
SYNTAX
math.degrees(input)
input
- Type: double
- Description: An angle, in radians
OUTPUT
double
EXAMPLE
SELECT math.degrees(radians) as degrees
radians | → | degrees |
---|---|---|
0.0 | 0.0 | |
3.141592653589793 | 180.0 | |
Infinity | Infinity | |
-Infinity | -Infinity | |
NaN | NaN | |
null | null |
MATH.RADIANS
Converts the degree input to radians.
SYNTAX
math.radians(input)
input
- Type: double
- Description: An angle, in degrees
OUTPUT
double
EXAMPLE
SELECT math.radians(degrees) as radians
degrees | → | radians |
---|---|---|
0.0 | 0.0 | |
180.0 | 3.141592653589793 | |
Infinity | Infinity | |
-Infinity | -Infinity | |
NaN | NaN | |
null | null |
MATH.LN
Computes the natural logarithm.
SYNTAX
math.ln(input)
input
- Type: double
- Description: The input value
OUTPUT
double
EXAMPLE
SELECT math.ln(input) as naturalLog
input | → | naturalLog |
---|---|---|
0.0 | -Infinity | |
1.0 | 0 | |
2.718281828459045 | 1 | |
Infinity | Infinity | |
-Infinity | NaN | |
-1.0 | NaN | |
NaN | NaN | |
null | null |
MATH.LOG10
Computes the logarithm with base 10.
SYNTAX
math.log10(input)
input
- Type: double
- Description: The input value
OUTPUT
double
EXAMPLE
SELECT math.log10(input) as log
input | → | log |
---|---|---|
0.0 | -Infinity | |
1.0 | 0 | |
10 | 1 | |
1000 | 3 | |
Infinity | Infinity | |
-Infinity | NaN | |
-1.0 | NaN | |
NaN | NaN | |
null | null |
MATH.LOG
Computes the logarithm of a value for a specific base.
SYNTAX
math.log(input, base)
input
- Type: double
- Description: The input value
base
- Type: double
- Description: The base value
OUTPUT
double
EXAMPLE
SELECT math.log(input, base) as log
input | base | → | log |
---|---|---|---|
0.0 | 0 | NaN | |
1.0 | 1 | NaN | |
10 | 10 | 1 | |
10000 | 100 | 2 | |
Infinity | 2 | Infinity | |
-Infinity | 4 | NaN | |
-1.0 | 10 | NaN | |
NaN | NaN | NaN | |
null | 10 | null | |
10 | null | null | |
null | null | null |
MATH.DOT_PRODUCT
Computes the dot product of the input arrays
SYNTAX
math.dot_product(array1, array2)
array1
- Type: {'type': 'array', 'elementType': 'double'}
- Description: First array to compare in dot product calculation
array2
- Type: {'type': 'array', 'elementType': 'double'}
- Description: Second array to compare in dot product calculation
OUTPUT
double
EXAMPLE
SELECT math.dot_product(array1, array2) as dot_product
array1 | array2 | → | dot_product |
---|---|---|---|
[1.0, 2.0, 3.0] | [4.0, -5.0, 6.0] | 12.0 | |
[1.0, 2.0, 3.0] | null | null | |
null | [4.0, -5.0, 6.0] | null | |
[1.0, 'NaN', 3.0] | [4.0, -5.0, 6.0] | NaN | |
[1.0, 2.0, 3.0] | [4.0, -5.0] | null | |
[1.0, 2.0] | [4.0, -5.0, 6.0] | null | |
[1.0, 2.0, 4.0] | [4.0, -5.0, 6.0] | 18.0 | |
[1.0, null, 4.0] | [4.0, -5.0, 6.0] | null | |
[] | [4.0, -5.0, 6.0] | null | |
[] | [] | 0.0 | |
[1.0, 2.0, 3.0] | [2.0, 3.0, -0.0] | 8.0 | |
[1.0, 2.0, 3.0] | [2.0, 'Infinity', -0.0] | Infinity | |
[1.0, 2.0, 3.0] | [2.0, '-Infinity', -0.0] | -Infinity | |
[1.0, -2.0, 3.0] | [2.0, 1.7976931348623157e+308, -0.0] | -Infinity | |
[1.0, -2.0, 3.0] | [2.0, 5e-324, -0.0] | 2.0 |
MATH.NORMALIZED_DOT_PRODUCT
Computes the normalized dot product between two vectors of numbers using the Model Assurance Criterion
SYNTAX
math.normalized_dot_product(array1, array2)
array1
- Type: {'type': 'array', 'elementType': 'double'}
- Description: First array to compare in dot product calculation
array2
- Type: {'type': 'array', 'elementType': 'double'}
- Description: Second array to compare in dot product calculation
OUTPUT
double
EXAMPLE
SELECT math.normalized_dot_product(array1, array2) as dot_product
array1 | array2 | → | dot_product |
---|---|---|---|
[1.0, 2.0, 3.0] | [4.0, -5.0, 6.0] | 0.13358070500927643 | |
[1.0, 2.0, 3.0] | null | null | |
null | [4.0, -5.0, 6.0] | null | |
[1.0, 'NaN', 3.0] | [4.0, -5.0, 6.0] | NaN | |
[1.0, 2.0, 3.0] | [4.0, -5.0] | null | |
[1.0, 2.0] | [4.0, -5.0, 6.0] | null | |
[1.0, 2.0, 4.0] | [4.0, -5.0, 6.0] | 0.20037105751391465 | |
[1.0, null, 3.0] | [4.0, -5.0, 6.0] | null | |
[] | [4.0, -5.0, 6.0] | null | |
[] | [] | 0.0 | |
[1.0, 2.0, 3.0] | [2.0, 3.0, -0.0] | 0.3516483516483517 | |
[1.0, 2.0, 3.0] | [2.0, 'Infinity', -0.0] | NaN | |
[1.0, 2.0, 3.0] | [2.0, '-Infinity', -0.0] | NaN | |
[1.0, -2.0, 3.0] | [2.0, 1.7976931348623157e+308, -0.0] | NaN | |
[1.0, -2.0, 3.0] | [2.0, 5e-324, -0.0] | 0.07142857142857142 | |
[1.0, -2.0, 3.0] | [1.0, -2.0, 3.0] | 1.0 | |
[1.0, -2.0, 3.0] | [0.0, 0.0, 0.0] | 0.0 |
Updated 6 months ago