Trigonometric Functions

degrees

degrees() converts radians to degrees.

Syntax:degrees(expression)

Returns:

A Float.

Arguments:

Considerations:

  • degrees(null) returns null.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN degrees(3.14159)
$$) as (deg agtype);

The number of degrees in something close to pi is returned.

Results:

radians

radians() converts radians to degrees.

Syntax:radians(expression)

Returns:

A Float.

Arguments:

Considerations:

  • radians(null) returns null.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN radians(180)
$$) as (rad agtype);

The number of degrees in something close to pi is returned.

Results:

pi

pi() returns the mathematical constant pi.

Syntax: pi()

Returns:

An agtype float.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN pi()
$$) as (p agtype);

The constant pi is returned.

Result:

sin

sin() returns the sine of a number.

Syntax:sin(expression)

Returns:

A Float.

Arguments:

Considerations:

  • sin(null) returns null.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN sin(0.5)
$$) as (s agtype);

The sine of 0.5 is returned.

Results:

cos

cos() returns the cosine of a number.

Syntax: cos(expression)

Returns:

A Float.

Arguments:

Considerations:

  • cos(null) returns null.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN cos(0.5)
$$) as (c agtype);

The cosine of 0.5 is returned.

Results:

tan

tan() returns the tangent of a number.

Syntax: tan(expression)

Returns:

A Float.

Arguments:

Considerations:

  • tan(null) returns null.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN tan(0.5)
$$) as (t agtype);

The tangent of 0.5 is returned.

Results:

asin

asin() returns the arcsine of a number.

Syntax:asin(expression)

Returns:

A Float.

Arguments:

Considerations:

  • asin(null) returns null.
  • If (expression < -1) or (expression > 1), then (asin(expression)) returns null.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN asin(0.5)
$$) as (s agtype);

The arcsine of 0.5 is returned.

Results:

acos

acos() returns the arccosine of a number.

Syntax:acos(expression)

Returns:

A Float.

Arguments:

Considerations:

  • acos(null) returns null.
  • If (expression < -1) or (expression > 1), then (acos(expression)) returns null.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN acos(0.5)
$$) as (arc_c agtype);

The arccosine of 0.5 is returned.

Results:

atan

atan() returns the arctangent of a number.

Syntax:atan(expression)

Returns:

A Float.

Arguments:

Considerations:

  • atan(null) returns null.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN atan(0.5)
$$) as (arc_t agtype);

The arccosine of 0.5 is returned.

Results:

atan2

atan2() returns the arctangent2 of a set of coordinates in radians.

Syntax: atan2(expression1, expression2)

Returns:

A Float.

Arguments:

Considerations:

  • atan2(null, null), atan2(null, expression2) and atan(expression1, null) all return null.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN atan2(0.5, 0.6)
$$) as (arc_t2 agtype);

The arctangent2 of 0.5 and 0.6 is returned.

Results: