# Math Expression

{% hint style="info" %}
See the changelog of this Action type [here](/actions/math-expression.md).
{% endhint %}

## Overview

The **Math Expression** Action can be used to perform mathematical operations over your data.

<figure><img src="/files/cTKwfvmhz1w7vlHkvoov" alt=""><figcaption></figcaption></figure>

In order to configure this action, you must first link it to a Listener. Go to [Building a Pipeline ](/the-workspace/pipelines/building-a-pipeline.md)to learn how to link.

{% hint style="info" %}
**AI Action Assistant**

This Action has an AI-powered chat feature that can help you configure its parameters. Read more about it in [this article](/the-workspace/pipelines/building-a-pipeline/ai-assistant/ai-action-assistant.md).
{% endhint %}

## Ports

These are the input and output ports of this Action:

<details>

<summary>Input ports</summary>

* **Default port** - All the events to be processed by this Action enter through this port.

</details>

<details>

<summary>Output ports</summary>

* **Default port** - Events are sent through this port if no error occurs while processing them.
* **Error port** - Events are sent through this port if an error occurs while processing them.

</details>

## Configuration

{% stepper %}
{% step %}
Find **Math Expression** in the **Actions** tab (under the **Transformation** group) and drag it onto the canvas.
{% endstep %}

{% step %}
To open the configuration, click the Action in the canvas and select **Configuration**.
{% endstep %}

{% step %}
Enter the required parameters:

<table><thead><tr><th width="152">Parameter</th><th>Description</th><th data-hidden></th></tr></thead><tbody><tr><td><strong>Fields</strong><mark style="color:red;"><strong>*</strong></mark></td><td>The fields view shows a list of integer fields from the connected Listener or Action. </td><td></td></tr><tr><td><strong>Operation</strong><mark style="color:red;"><strong>*</strong></mark></td><td><p>You can use these fields to carry out your calculations. Type or drag the fields to create a new operation and write the mathematical operation you wish to do.</p><p></p><p>Use the corresponding symbols to apply the required operations. Check the list of available operations in the table below.</p><p></p><p>Add as many operations as required using the <strong>Add Operation</strong> option.</p></td><td></td></tr><tr><td><strong>Output field</strong></td><td>Give a name to the output field.</td><td></td></tr></tbody></table>
{% endstep %}

{% step %}
Click **Save** to complete the process.
{% endstep %}
{% endstepper %}

## List of operations

These are all the available operations you can use in this Action:

{% hint style="warning" %}
Note that you can always use either numeric fields from the incoming data or specific values you type directly in the operation box.
{% endhint %}

<table><thead><tr><th width="175.09375">Operation</th><th width="271.1171875">Description</th><th>Example</th></tr></thead><tbody><tr><td>Sum</td><td>Sum of 2  values.</td><td><ul><li><code>field1</code><mark style="color:purple;"><strong><code>+</code></strong></mark><code>field2</code></li><li><code>field1</code><mark style="color:purple;"><strong><code>+</code></strong></mark><code>10</code></li></ul></td></tr><tr><td>Subtraction</td><td>Subtraction of 2 values.</td><td><ul><li><code>field1</code><mark style="color:purple;"><strong><code>-</code></strong></mark><code>field2</code></li><li><code>field1</code><mark style="color:purple;"><strong><code>-</code></strong></mark><code>10</code></li></ul></td></tr><tr><td>Multiplication</td><td>Multiplication of 2 values.</td><td><ul><li><code>field1</code><mark style="color:purple;"><strong><code>*</code></strong></mark><code>field2</code></li><li><code>field1</code><mark style="color:purple;"><strong><code>*</code></strong></mark><code>10</code></li></ul></td></tr><tr><td>Division</td><td>Division of 2 values.</td><td><ul><li><code>field1</code><mark style="color:purple;"><strong><code>/</code></strong></mark><code>field2</code></li><li><code>field1</code><mark style="color:purple;"><strong><code>/</code></strong></mark><code>10</code></li></ul></td></tr><tr><td>Module</td><td>The remainder of the division of 2 values.</td><td><ul><li><code>field1</code><mark style="color:purple;"><strong><code>%</code></strong></mark><code>field2</code></li><li><code>field1</code><mark style="color:purple;"><strong><code>%</code></strong></mark><code>10</code></li></ul></td></tr><tr><td>Power</td><td>A value raised to the power of a specific value.</td><td><ul><li><code>field1</code><mark style="color:purple;"><strong><code>**</code></strong></mark><code>field2</code></li><li><code>field1</code><mark style="color:purple;"><strong><code>**</code></strong></mark><code>10</code></li></ul></td></tr><tr><td>Exponential function</td><td>The result of the Euler's number <code>e</code> raised to the power of a specific value.</td><td><ul><li><mark style="color:purple;"><strong><code>EXP(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li></ul></td></tr><tr><td>Natural logarithm</td><td>The natural logarithm of a given value.</td><td><ul><li><mark style="color:purple;"><strong><code>LN(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li></ul></td></tr><tr><td>Logarithm with given base</td><td>Calculates the logarithm of a given value with a specific base.</td><td><ul><li><mark style="color:purple;"><strong><code>LOG(</code></strong></mark><code>base,field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li></ul></td></tr><tr><td>Constant π</td><td>Add the constant π to your operations.</td><td><ul><li><mark style="color:purple;"><strong><code>PI()</code></strong></mark></li></ul></td></tr><tr><td>Trigonometric functions (in radians)</td><td>Calculate the sine, cosine and tangent of a given value.</td><td><ul><li><mark style="color:purple;"><strong><code>SIN(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li><li><mark style="color:purple;"><strong><code>COS(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li><li><mark style="color:purple;"><strong><code>TAN(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li></ul></td></tr><tr><td>Inverse trigonometric functions</td><td>Calculate the arcsine, arccosine and arctangent of a given value.</td><td><ul><li><mark style="color:purple;"><strong><code>ASIN(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li><li><mark style="color:purple;"><strong><code>ACOS(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li><li><mark style="color:purple;"><strong><code>ATAN(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li></ul></td></tr><tr><td>Hyperbolic functions (in radians)</td><td>Calculate the hyperbolic sine, hyperbolic cosine and hyperbolic tangent of a given value.</td><td><ul><li><mark style="color:purple;"><strong><code>SINH(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li><li><mark style="color:purple;"><strong><code>COSH(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li><li><mark style="color:purple;"><strong><code>TANH(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li></ul></td></tr><tr><td>Inverse hyperbolic functions</td><td>Calculate the inverse hyperbolic sine, inverse hyperbolic cosine and inverse hyperbolic tangent of a given value.</td><td><ul><li><mark style="color:purple;"><strong><code>ASINH(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li><li><mark style="color:purple;"><strong><code>ACOSH(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li><li><mark style="color:purple;"><strong><code>ATANH(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li></ul></td></tr><tr><td>Degrees/radians conversion</td><td>These functions convert between radians and degrees.</td><td><ul><li><mark style="color:purple;"><strong><code>DEGREES(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li><li><mark style="color:purple;"><strong><code>RADIANS(</code></strong></mark><code>field</code><mark style="color:purple;"><strong><code>)</code></strong></mark></li></ul></td></tr></tbody></table>

## Examples

Simple expression with an event field:

```
2.5 * (${mynumber} + 3)
```

Transform a number into its opposite one:

```
-${mynumber}
```

Negation of a parenthesis:

```
-(1 + 2) * 3
```

The module of a division and, then, raised to the power of three:

```
(${mynumber} % 2) ** 3
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onum.com/the-workspace/pipelines/actions/transformation/math-expression.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
