In this post we will be discussing the trigonometric functions in age. Following descriptions represents the function name, it's description, syntax, what it possibly returns, and a sample query.
degrees:
Degrees convert radians into degrees.
Syntax:
degrees(a numeric expression)
A numeric function can be any number or an expression resulting into a number
Returns:
The function returns a agtype float.
Query:
SELECT *
FROM cypher('your_graph_name', $$
RETURN degrees(3.14159)
$$) as (deg agtype);
Above query will return the number of degrees something close to pi.
radians:
Radians convert radians into degrees.
Syntax:
radians(a numeric expression)
A numeric function can be any number or an expression resulting into a number
Returns:
The function returns a agtype float.
Query:
SELECT *
FROM cypher('your_graph_name', $$
RETURN degrees(180)
$$) as (deg agtype);
Above query will return the number of radians something close to pi i.e. 3.1415.
pi:
pi() returns the mathematical constant pi.
Syntax:
pi()
Returns:
The function returns a agtype float.
Query:
SELECT *
FROM cypher('your_graph_name', $$
RETURN pi()
$$) as (p agtype);
Above query will return pi which is 3.1415.
sin:
sin function returns the sine of a number.
Syntax:
sin(a numeric expression)
Returns:
The function returns a agtype float.
Query:
SELECT *
FROM cypher('your_graph_name', $$
RETURN sin(0.5)
$$) as (s agtype);
Above query will return sin of 0.5.
cos:
cos() returns the cosine of the number provided.
Syntax:
cos(a numeric expression)
Returns:
The function returns a floating point number.
Query:
SELECT *
FROM cypher('graph_name', $$
RETURN cos(0.5)
$$) as (c agtype);
Above query will return the cosine of 0.5.
tan:
tan() function returns the tangent of a number.
Syntax:
tan(a numeric expression)
Returns:
The function returns a floating point number.
Query:
SELECT *
FROM cypher('your_graph_name', $$
RETURN tan(0.5)
$$) as (t agtype);
Above query will return the tangent of 0.5.
You can also refer here to the part2
References:
You can view more on GitHub and documentation of Apache age by following these links:
Top comments (0)