math
Enables scientific calculator functionality.
Synopsis
math('math_function')
Syntax conventions | Description |
---|---|
Lowercase and uppercase | Literal keyword. Includes () . |
Italics |
Variable value. Replace with a user-defined value. |
[] |
Optional. Square brackets ( [] ) surround
optional command arguments. Do not type the square brackets. |
{} |
Group. Braces ( {} ) identify a group to choose
from. Do not type the braces. |
| |
Or. A vertical bar ( | ) separates alternative
elements. Type any one of the elements. Do not type the vertical
bar. |
... |
Repeatable. An ellipsis ( ... ) indicates that
you can repeat the syntax element as often as required. |
Description
math()
step enables scientific calculator functionality. The basic
operations ( +, -, *, /, ^, and %) are available, as well as:Function | Description |
---|---|
abs | absolute value |
acos | arc cosine |
asin | arc sine |
atan | arc tangent |
cbrt | cubic root |
ceil | nearest upper integer |
cos | cosine |
cosh | hyperbolic cosine |
exp | Euler's number raised to the power e^x |
floor | nearest lower integer |
log | natural logarithm (base e) |
log10 | logarithm (base 10) |
log2 | logarithm (base 2) |
sin | sine |
sinh | hyperbolic sine |
sqrt | square root |
tan | tangent |
tanh | hyperbolic tangent |
signum | signum function |
Examples
g.V().hasLabel('meal_item').as('a').
inE('includes').as('b').
math('a*b').
by('calories').
by('numServ')
Note
that two by()
statements are used to retrieve a particular property for
each math variable used, calories for a and numServ for b.