> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Math functions

On top of the functions listed below, measures can also be combined with mathematical operators.

* The classic `+`, `-` and `*` operators:
  ```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
  >>> df = pd.DataFrame(
  ...     columns=["City", "A", "B", "C", "D"],
  ...     data=[
  ...         ("Berlin", 15.0, 10.0, 10.1, 1.0),
  ...         ("London", 24.0, 16.0, 20.5, 3.14),
  ...         ("New York", -27.0, 15.0, 30.7, 10.0),
  ...         ("Paris", 0.0, 0.0, 0.0, 0.0),
  ...     ],
  ... )
  >>> table = session.read_pandas(df, keys={"City"}, table_name="Math")
  >>> cube = session.create_cube(table)
  >>> l, m = cube.levels, cube.measures
  >>> m["Sum"] = m["A.SUM"] + m["B.SUM"]
  >>> m["Subtract"] = m["A.SUM"] - m["B.SUM"]
  >>> m["Multiply"] = m["A.SUM"] * m["B.SUM"]
  >>> cube.query(
  ...     m["A.SUM"],
  ...     m["B.SUM"],
  ...     m["Sum"],
  ...     m["Subtract"],
  ...     m["Multiply"],
  ...     levels=[l["City"]],
  ... )
             A.SUM  B.SUM     Sum Subtract Multiply
  City
  Berlin     15.00  10.00   25.00     5.00   150.00
  London     24.00  16.00   40.00     8.00   384.00
  New York  -27.00  15.00  -12.00   -42.00  -405.00
  Paris        .00    .00     .00      .00      .00
  ```
* The float division `/` and integer division `//`:
  ```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
  >>> m["Float division"] = m["A.SUM"] / m["B.SUM"]
  >>> m["Int division"] = m["A.SUM"] // m["B.SUM"]
  >>> cube.query(
  ...     m["A.SUM"],
  ...     m["B.SUM"],
  ...     m["Float division"],
  ...     m["Int division"],
  ...     levels=[l["City"]],
  ... )
             A.SUM  B.SUM Float division Int division
  City
  Berlin     15.00  10.00           1.50         1.00
  London     24.00  16.00           1.50         1.00
  New York  -27.00  15.00          -1.80        -2.00
  Paris        .00    .00            NaN          NaN
  ```
* The exponentiation `**`:
  ```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
  >>> m["a²"] = m["A.SUM"] ** 2
  >>> cube.query(m["A.SUM"], m["a²"], levels=[l["City"]])
             A.SUM      a²
  City
  Berlin     15.00  225.00
  London     24.00  576.00
  New York  -27.00  729.00
  Paris        .00     .00
  ```
* The modulo `%`:
  ```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
  >>> m["Modulo"] = m["A.SUM"] % m["B.SUM"]
  >>> cube.query(m["A.SUM"], m["B.SUM"], m["Modulo"], levels=[l["City"]])
             A.SUM  B.SUM Modulo
  City
  Berlin     15.00  10.00   5.00
  London     24.00  16.00   8.00
  New York  -27.00  15.00   3.00
  Paris        .00    .00    NaN
  ```

| [`abs`](./atoti.math.abs#atoti.math.abs)       | Return a measure equal to the absolute value of the passed measure.                         |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------- |
| [`ceil`](./atoti.math.ceil#atoti.math.ceil)    | Return a measure equal to the smallest integer that is >= to the passed measure.            |
| [`cos`](./atoti.math.cos#atoti.math.cos)       | Return a measure equal to the cosine of the passed measure in radians.                      |
| [`erf`](./atoti.math.erf#atoti.math.erf)       | Return the error function of the input measure.                                             |
| [`erfc`](./atoti.math.erfc#atoti.math.erfc)    | Return the complementary error function of the input measure.                               |
| [`exp`](./atoti.math.exp#atoti.math.exp)       | Return a measure equal to the exponential value of the passed measure.                      |
| [`floor`](./atoti.math.floor#atoti.math.floor) | Return a measure equal to the largest integer \<= to the passed measure.                    |
| [`isnan`](./atoti.math.isnan#atoti.math.isnan) | Return a measure equal to `True` when the passed measure is `NaN` and to `False` otherwise. |
| [`log`](./atoti.math.log#atoti.math.log)       | Return a measure equal to the natural logarithm (base *e*) of the passed measure.           |
| [`log10`](./atoti.math.log10#atoti.math.log10) | Return a measure equal to the base 10 logarithm of the passed measure.                      |
| [`max`](./atoti.math.max#atoti.math.max)       | Return a measure equal to the maximum of the passed arguments.                              |
| [`min`](./atoti.math.min#atoti.math.min)       | Return a measure equal to the minimum of the passed arguments.                              |
| [`round`](./atoti.math.round#atoti.math.round) | Return a measure equal to the closest integer to the passed measure.                        |
| [`sin`](./atoti.math.sin#atoti.math.sin)       | Return a measure equal to the sine of the passed measure in radians.                        |
| [`sqrt`](./atoti.math.sqrt#atoti.math.sqrt)    | Return a measure equal to the square root of the passed measure.                            |
| [`tan`](./atoti.math.tan#atoti.math.tan)       | Return a measure equal to the tangent of the passed measure in radians.                     |
