DEV Community

Muhammad Sarmad
Muhammad Sarmad

Posted on

Logarithmic Functions in Apache AGE

ApacheAGE being a multipurpose extension provides a range of functions including the logarithmic functions that are quite useful, we have discussed them in detail below:

e

e() returns the base of the natural logarithm, e.

Syntax:e()

Returns:
An agtype float.

Query:

SELECT *
FROM cypher('graph_name', $$
    RETURN e()
$$) as (e agtype);
Enter fullscreen mode Exit fullscreen mode

Results

Image description

sqrt

sqrt() returns the square root of a number.

Syntax:sqrt(expression)

Returns:
An agtype float.

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

Results

Image description

exp

exp() returns e^n, where e is the base of the natural logarithm, and n is the value of the argument expression.

Syntax: e(expression)

Returns:
An agtype Float.

Arguments:

Image description

Considerations:

  • exp(null) returns null.

Query:

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

e to the power of 2 is returned.

Result:

Image description

log

log() returns the natural logarithm of a number.

Syntax:log(expression)

Returns:
An agtype Float.

Arguments:

Image description

Considerations:

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

Query:

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

The natural logarithm of 27 is returned.

Result:

Image description

log10

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

Syntax:log10(expression)

Returns:
An agtype Float.

Arguments:
Image description

Considerations:

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

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

The common logarithm of 27 is returned.

Result:
Image description

API Trace View

How I Cut 22.3 Seconds Off an API Call with Sentry πŸ•’

Struggling with slow API calls? Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more β†’

Top comments (0)

Image of Docusign

πŸ› οΈ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more