DEV Community

Talha Munir πŸ‡΅πŸ‡Έ
Talha Munir πŸ‡΅πŸ‡Έ

Posted on

Trigonometric functions in age part 2

The blog represents the part 2 of the trigonometric functions in age. You can also refer to the part 1 here.

asin:

asin() returns the arcsine of the number.

Syntax:

asin(a numeric expression)

Returns:

The function returns a floating point number.

Query:

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

Above query will return arcsine of 0.5.

acos:

acos() returns the arccosine of the number.

Syntax:

acos(a numeric expression)

Returns:

The function returns a floating point number.

Query:

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

Above query will return arccosine of 0.5.

atan:

atan() returns the arctangent of the number.

Syntax:

atan(a numeric expression)

Returns:

The function returns a floating point number.

Query:

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

Above query will return the arctangent of 0.5.

atan2():

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

Syntax:

atan2(a numeric expression 1, a numeric expression 2)

Returns:

The function returns a floating point number.

Query:

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

Above query will return arctangent2 of 0.5 and 0.6.

References:

You can view more on GitHub and documentation of Apache age by following these links:

  1. https://age.apache.org/age-manual/master/intro/overview.html
  2. https://github.com/apache/age
  3. https://dev.to/talhahahae/numeric-functions-in-apache-age-34ga
  4. https://dev.to/talhahahae/logarithmic-functions-1nbl

Top comments (0)