Logarithmic Functions

e()

e() returns the mathematical constant e, the base of natural logarithms.

Syntax: e()

Returns:

An agtype floating-point number.

Query:

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

Result:

e
2.71828182845905
1 row

sqrt()

sqrt() returns the square root of a number.

Syntax: sqrt(expression)

Returns:

An agtype floating-point number.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN sqrt(144)
$$) as (results agtype);

Result:

results
12
1 row

exp()

exp() returns e raised to the power n, where e is the base of natural logarithms and n is the value of the argument expression.

Syntax: exp(expression)

Returns:

An agtype floating-point number.

Parameters:

Name Description
expression An agtype numeric expression.

Notes:

  • exp(null) returns null.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN exp(2)
$$) as (e agtype);

Returns e squared.

Result:

e
7.38905609893065
1 row

log()

log() returns the natural logarithm of a number.

Syntax: log(expression)

Returns:

An agtype floating-point number.

Parameters:

Name Description
expression An agtype numeric expression.

Notes:

  • log(null) returns null.
  • log(0) returns null.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN log(27)
$$) as (natural_logarithm agtype);

Returns the natural logarithm of 27.

Result:

natural_logarithm
3.295836866004329
1 row

log10()

log10() returns the common (base-10) logarithm of a number.

Syntax: log10(expression)

Returns:

An agtype floating-point number.

Parameters:

Name Description
expression An agtype numeric expression.

Notes:

  • log10(null) returns null.
  • log10(0) returns null.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN log10(27)
$$) as (common_logarithm agtype);

Returns the base-10 logarithm of 27.

Result:

common_logarithm
1.4313637641589874
1 row