Trigonometric Functions

degrees

degrees() converts radians to degrees.

Syntax: degrees(expression)

Returns:

An agtype 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 degrees to radians.

Syntax: radians(expression)

Returns:

An agtype 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:

pi
3.141592653589793
1 row(s) returned

sin

sin() returns the sine of a number.

Syntax: sin(expression)

Returns:

An agtype 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:

An agtype 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 cos(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:

An agtype 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

Cot

cot() returns the cotangent of a number.

Syntax: cot(expression)

Returns:

A float.

Arguments:

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

Considerations:

  • cot(null) returns null.

Query:

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

The cotangent of 0.5 is returned.

Results:

t
1.830487721712452
1 row(s) returned

asin

asin() returns the arcsine of a number.

Syntax: asin(expression)

Returns:

An agtype 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 (arc_s agtype);

The arcsine of 0.5 is returned.

Results:

arc_s
0.523598775598299
1 row(s) returned

acos

acos() returns the arccosine of a number.

Syntax: acos(expression)

Returns:

An agtype 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:

An agtype 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 arctangent 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:

An agtype 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