> For the complete documentation index, see [llms.txt](https://nodanomics.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nodanomics.gitbook.io/docs/documentation/nodes/logic-type-nodes/formula.md).

# Formula

<figure><img src="https://3575185254-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fib30WaNePUQBBFJBULTa%2Fuploads%2FL1mNs91PeMrJU8UquEyJ%2Fimage.png?alt=media&amp;token=53ba3019-42c4-42fc-9b2e-a9acdd6255fe" alt=""><figcaption><p>Image 1. The Formula Node.</p></figcaption></figure>

This node is responsible for calculating mathematical expressions.

The inputs can either be dynamic, as logic connections attached to the node or constants, present in the expression itself. The inputs can also be the value from other components using the tag notation system. The diagram designer can assign as many dynamic variables as needed to be used.

## Internal Functions

The Formula Node can use methods and properties from the [math.js](https://mathjs.org/docs/index.html) library.

To use any of the methods or properties from the library, all you need is to use the function name (without the 'math.') from the math.js [reference](https://mathjs.org/docs/reference/index.html).&#x20;

<figure><img src="https://3575185254-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fib30WaNePUQBBFJBULTa%2Fuploads%2FTvkRF4Wn5lNIqhHmazOI%2Fimage.png?alt=media&amp;token=ccd86574-1466-406f-9461-415f68b3170f" alt=""><figcaption><p>Image 2. Example of usage of math.js functions.</p></figcaption></figure>

The most common methods are:

* equal(a, b)
* smaller(a, b), smallerEq(a, b), larger(a, b), largerEq(a, b)
* not(a)
* sqrt(a)

{% hint style="warning" %}
Some names are reserved to the math.js function. \
That means, if you name a node the same as one of the math.js' methods or properties, the logic won't work.&#x20;
{% endhint %}

## Advanced Uses

### If-statements

<figure><img src="https://3575185254-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fib30WaNePUQBBFJBULTa%2Fuploads%2FiqKm4pfP7UWIVkxpJyoo%2Fimage.png?alt=media&amp;token=d8586ec3-cc4f-469f-879a-a6db3a6ac184" alt=""><figcaption></figcaption></figure>

Alongside with the Chain Connection's condition field, the Formula node can be a powerful tool to calculate if expressions.
