User GuidesAPI ReferenceRelease Notes
Doc HomeHelp CenterLog In
User Guides

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.57079632679489661.0
0.00.0
NaNNaN
InfinityNaN
-InfinityNaN
nullnull

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.01.0
NaNNaN
InfinityNaN
-InfinityNaN
nullnull

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.00.0
InfinityNaN
-InfinityNaN
NaNNaN
nullnull

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.01.5707963267948966
20.0NaN
0.00.0
InfinityNaN
-InfinityNaN
nullnull

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.00.0
0.01.5707963267948966
InfinityNaN
-InfinityNaN
nullnull

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.00.0
1.00.7853981633974483
NaNNaN
nullnull

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
yx→arctan2_output
0.00.00.0
0.0Infinity0.0
0.0-Infinity3.141592653589793
NaN0.0NaN
null0.0null

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.00.0
3.141592653589793180.0
InfinityInfinity
-Infinity-Infinity
NaNNaN
nullnull

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.00.0
180.03.141592653589793
InfinityInfinity
-Infinity-Infinity
NaNNaN
nullnull

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.00
2.7182818284590451
InfinityInfinity
-InfinityNaN
-1.0NaN
NaNNaN
nullnull

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.00
101
10003
InfinityInfinity
-InfinityNaN
-1.0NaN
NaNNaN
nullnull

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
inputbase→log
0.00NaN
1.01NaN
10101
100001002
Infinity2Infinity
-Infinity4NaN
-1.010NaN
NaNNaNNaN
null10null
10nullnull
nullnullnull

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
array1array2→dot_product
[1.0, 2.0, 3.0][4.0, -5.0, 6.0]12.0
[1.0, 2.0, 3.0]nullnull
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
array1array2→dot_product
[1.0, 2.0, 3.0][4.0, -5.0, 6.0]0.13358070500927643
[1.0, 2.0, 3.0]nullnull
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