math

Enables scientific calculator functionality.

Synopsis

math('math\_function')

Description

The 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

Find the calories per meal item, then multiply by the number of servings for a meal:

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.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com