All Collections
Administration
Asset Metric Administration
What are the commonly used mathematical equations ?
What are the commonly used mathematical equations ?

Basic operations, IF functions, time shift, rolling averages, etc..

Mark de Geus avatar
Written by Mark de Geus
Updated over a week ago


A full list of equations can be accessed by clicking on the ℹ "info" symbol beside the Equation field title. There is a variety of equations that can be used in the application, the most common ones used until today will be shown here. The equations are based on the math.js library

Circular References

Similar to in excel; brains.app circular reference occurs when a formula directly or indirectly refers to its own metric. This causes the formula to use its result in the calculation, which can create errors. To avoid this brains.app does not accept equation metrics in other equations.

Basic Operations (+, -, *, /)

You can add, subtract, multiply and/or divide metrics and/or metric.asset the way you want as long as measurement units make sense.

This can also be done with numbers and by combining operations.

Absolute value

You can get the absolute value of a metric or a basic operations equation using the “abs()” function.

IF function

In the app, you can use the “if” function that allows you to make logical comparisons between a value (metrics or numbers) and what you expect. This comparison can be made with the symbols equal (=), less than (<) and greater than (>). Then you can have two results, if your comparison is “true” and if your comparison is “false”; to get this you must add after your comparison a “?” which mean “if your comparison is true then return” followed by a metric or a number or even a NaN, and finally add a “:” which mean “otherwise if your comparison is false return” followed by what you expect.

You can also add the logic symbols “and”, “or”, like “&” and “|” when you want that two comparisons are both true or false; or when you want that one comparison or the other comparison are true or false.

isNaN function

The isNaN() function determines whether a value is an “Not-a-Number”, you can use it to determine the NaN values in a metric and then change that NaN values for numbers or metrics using the if function above.

Time shift function

The time shift function allows you to use the values contained in metrics at different times using the “time()” command by adding the number of minutes you want to move the timeline, backward (-) or forward; that is, e.g. if you want to use a value contained in "t-n" at time "t", “n” real number in minutes, and move the entire timeline, you must add “.time(-n)”.

time in equations:

  • entering 60 or +60 shifts time backwards 60 minutes

  • entering -60 shifts time forwards minutes

Rolling Average

Using the time function, the user can create rolling average metrics, below is an example of 10 minute rolling average equation for metric(8)

  • (metric(8)+metric(8).time(-1)+metric(8).time(-2)+metric(8).time(-3)+metric(8).time(-4)+metric(8).time(-5)+metric(8).time(-6)+metric(8).time(-7)+metric(8).time(-8)+metric(8).time(-9))/10

Did this answer your question?