UltipaDocs
Try Playground
  • Introduction
    • Overview
    • Node and Edge Patterns
    • Path Patterns
    • Quantified Paths
    • Shortest Paths
    • Graph Patterns
    • Overview
    • Typed Graph
    • Open Graph
    • Graph Sharding and Storage
    • Constraints
    • Unique Identifiers
    • INSERT
    • INSERT OVERWRITE
    • UPSERT
    • SET
    • REMOVE
    • DELETE
    • Query Composition
    • Result Table and Visualization
    • MATCH
    • OPTIONAL MATCH
    • FILTER
    • LET
    • FOR
    • ORDER BY
    • LIMIT
    • SKIP
    • CALL
    • RETURN
    • Composite Query
    • NEXT
    • All Functions
    • Scalar Functions
    • Path Functions
    • Aggregate Functions
    • Mathematical Functions
    • Trigonometric Functions
    • String Functions
    • List Functions
    • Datetime Functions
    • Spatial Functions
    • Table Functions
  • Operators
  • Predicates
  • Expressions
    • Index
    • Full-text Index
    • Vector Index
    • Managing HDC Graphs
    • HDC Graph Queries
  • Transaction
  • Trigger
    • Process
    • Job
    • Execution Plan
    • Variables
    • Values and Types
    • Comments
    • Reserved Words
    • Syntactic Notation
  • Access Control
  • GQL Conformance
  1. Docs
  2. /
  3. ISO GQL
  4. /
  5. Functions

Trigonometric Functions

acos()

Computes the angle in radians whose cosine is a given number, the output radians will be in the range [0, 𝜋]. If you need the result in degrees, which is in the range [0º, 180º], you can convert it using the degrees() function.

Syntaxacos(<num>)
ArgumentsNameTypeDescription
<num>NumericThe cosine value in the range of [-1,1]
Return TypeDOUBLE
GQL
RETURN degrees(acos(0.5)) AS degree

Result:

degree
60

asin()

Computes the angle in radians whose sine is a given number, the output radians will be in the range [-𝜋/2, 𝜋/2]. If you need the result in degrees, which is in the range [-90º, 90º], you can convert it using the degrees() function.

Syntaxasin(<num>)
ArgumentsNameTypeDescription
<num>NumericThe sine value in the range of [-1,1]
Return TypeDOUBLE
GQL
RETURN degrees(asin(0.5)) AS degree

Result:

degree
30

atan()

Computes the angle in radians whose tangent is a given number, the output radians will be in the range [-𝜋/2, 𝜋/2]. If you need the result in degrees, which is in the range [-90º, 90º], you can convert it using the degrees() function.

Syntaxatan(<num>)
ArgumentsNameTypeDescription
<num>NumericThe tangent value
Return TypeDOUBLE
GQL
RETURN degrees(atan(1)) AS degree

Result:

degree
45

cos()

Computes the cosine of an angle expressed in radian, the output will be in the range [-1, 1]. If you has an angle in degree, you can convert it to radians using the radians() function.

Syntaxcos(<radians>)
ArgumentsNameTypeDescription
<radians>NumericThe angle expressed in radian
Return TypeDOUBLE
GQL
RETURN cos(radians(60))

Result:

cos(radians(60))
0.5

cosh()

Computes the hyperbolic cosine of an angle expressed in radian, the output will be in the range [1, +∞). If you has an angle in degree, you can convert it to radians using the radians() function.

Syntaxcosh(<radians>)
ArgumentsNameTypeDescription
<radians>NumericThe angle expressed in radian
Return TypeDOUBLE
GQL
RETURN cosh(radians(60))

Result:

cosh(radians(60))
1.60028685770239

cot()

Computes the cotangent of an angle expressed in radian, the output will be in the range (−∞, −1] ∪ [1, +∞). If you has an angle in degree, you can convert it to radians using the radians() function.

Syntaxcot(<radians>)
ArgumentsNameTypeDescription
<radians>NumericThe angle expressed in radian; cot(0) is undefined
Return TypeDOUBLE
GQL
RETURN cot(radians(45))

Result:

cot(radians(45))
1

degrees()

Converts an angle from radians to degrees:

degrees = radians × 180 π
Syntaxdegrees(<radians>)
ArgumentsNameTypeDescription
<radians>NumericThe angle expressed in radian
Return TypeDOUBLE
GQL
RETURN degrees(pi())

Result:

degrees(pi())
180

radians()

Converts an angle from degrees to radians:

radians = degrees × π 180
Syntaxradians(<degrees>)
ArgumentsNameTypeDescription
<degrees>NumericThe angle expressed in degree
Return TypeDOUBLE
GQL
RETURN radians(60)

Result:

radians(60)
1.0471975511966

sin()

Computes the sine of an angle expressed in radian, the output will be in the range [-1, 1]. If you has an angle in degree, you can convert it to radians using the radians() function.

Syntaxsin(<radians>)
ArgumentsNameTypeDescription
<radians>NumericThe angle expressed in radian
Return TypeDOUBLE
GQL
RETURN sin(radians(30))

Result:

sin(radians(30))
0.5

sinh()

Computes the hyperbolic sine of an angle expressed in radian, the output will be in the range (−∞, +∞). If you has an angle in degree, you can convert it to radians using the radians() function.

Syntaxsinh(<radians>)
ArgumentsNameTypeDescription
<radians>NumericThe angle expressed in radian
Return TypeDOUBLE
GQL
RETURN sinh(radians(30))

Result:

sinh(radians(30))
0.54785347388804

tan()

Computes the tangent of an angle expressed in radian, the output will be in the range (−∞, +∞). If you has an angle in degree, you can convert it to radians using the radians() function.

Syntaxtan(<radians>)
ArgumentsNameTypeDescription
<radians>NumericThe angle expressed in radian
Return TypeDOUBLE
GQL
RETURN tan(radians(45))

Result:

tan(radians(45))
1

tanh()

Computes the hyperbolic tangent of an angle expressed in radian, the output will be in the range [−1, 1]. If you has an angle in degree, you can convert it to radians using the radians() function.

Syntaxtanh(<radians>)
ArgumentsNameTypeDescription
<radians>NumericThe angle expressed in radian
Return TypeDOUBLE
GQL
RETURN tanh(radians(45))

Result:

tanh(radians(45))
0.655794202632672