Trigonometric Functions

degrees

degrees() converts radians to degrees.

Syntax:degrees(expression)

Returns:

A Float.

Arguments:

Name Description
expression An agtype number expression that represents the angle in radians.

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:

deg
179.99984796050427
1 row(s) returned

radians

radians() converts radians to degrees.

Syntax:radians(expression)

Returns:

A Float.

Arguments:

Name Description
expression An agtype number expression that represents the angle in degrees.

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:

rad
3.14159265358979
1 row(s) returned

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:

p
3.141592653589793
1 row(s) returned

sin

sin() returns the sine of a number.

Syntax:sin(expression)

Returns:

A Float.

Arguments:

Name Description
expression An agtype number expression that represents the angle in radians.

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:

s
0.479425538604203
1 row(s) returned

cos

cos() returns the cosine of a number.

Syntax: cos(expression)

Returns:

A Float.

Arguments:

Name Description
expression An agtype expression that represents the angle in radians.

Considerations:

  • cos(null) returns null.

Query:

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

The cosine of 0.5 is returned.

Results:

c
0.8775825618903728
1 row(s) returned

tan

tan() returns the tangent of a number.

Syntax: tan(expression)

Returns:

A Float.

Arguments:

Name Description
expression An agtype number expression that represents the angle in radians.

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:

t
0.5463024898437905
1 row(s) returned

asin

asin() returns the arcsine of a number.

Syntax:asin(expression)

Returns:

A Float.

Arguments:

Name Description
expression An agtype number expression that represents the angle in radians.

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:

s
0.523598775598299
1 row(s) returned

acos

acos() returns the arccosine of a number.

Syntax:acos(expression)

Returns:

A Float.

Arguments:

Name Description
expression An agtype number expression that represents the angle in radians.

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:

arc_c
1.0471975511965979
1 row(s) returned

atan

atan() returns the arctangent of a number.

Syntax:atan(expression)

Returns:

A Float.

Arguments:

Name Description
expression An agtype number expression that represents the angle in radians.

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:

arc_t
0.463647609000806
1 row(s) returned

atan2

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

Syntax: atan2(expression1, expression2)

Returns:

A Float.

Arguments:

Name Description
expression1 An agtype number expression for y that represents the angle in radians.
expression2 An agtype number expression for x that represents the angle in radians.

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:

arc_t2
0.694738276196703
1 row(s) returned