# Math Calculations

The extensive Math feature allows you to define your own math calculations. There are over 170 math functions built-in. You can even use complex numbers, matrices or SI units.

A background process will automatically calculate all your formulas, when new data are uploaded.

You can use the math result channels in the Visual Controls of your Dashboards or even for Alarms.

## Simple Usage

### Formula Inputs

The Variables list will show all channels, that have been selected as input. Simply click on the Name to add the variable to your formula.

### Preview

The Preview feature is incredible useful. It will load the latest data from the channels, that you use in the formula from the server and display the results immediately.

So you can check the expected results of your calculation/s and spot errors right away.

### Multi Result

The Mulit-Result feature allows to return multiple values from a formula. Simply assign calculation results to the implicit $result variable.

All result channels will belong to the same channel-group and will thus have the same timestamp. This means, that you can even use these channels in a Heatmap Visual Control.

## Extensive Math Features

### Built-in Functions

There are currently over 170 built-in functions from all possible categories: Arithmetic, Bitwise, Combinatorics, Geometry, Logical, Matrix, Probability, Relational, Set Theory, Statistics, String (Text), Trigonometry and Units.

The edit dialogue contains a convenient search form so that you can easily find what you need. Press the Info icon to get detailed description for every function, its parameters and return value.

### Powerful Formula Language

The syntax is really simple to grasp, even for non-programmers. It is similar to many calculators and mathematical applications and close to JavaScript.

You can use constants, operators, built-in functions, different data-types, variables and you can even define your own simple functions. The hash character (#) can be used to add single end-of-line comments directly inside of your formulas.

### Data Types

In your custom formulas you can use many different data-types: Floating Point Numbers, BigNumbers (higher precision), Complex Numbers, Matrices/Arrays, Booleans, Fractions, Text, Objects and Units.

However, the return value of the function must be a number, so that it can be used in the Dashboards, Alarm conditions, etc.

### SI Units

There are over 100 units supported from all available categories: Length, Surface Area, Volume, Liquid Volume, Angles, Time, Frequency, Mass, Electric Current, Temperature, Amount of Substance, Luminous Intensity, Force, Energy, Power, Pressure, Electricity and Magnetism, Binary.

Use the to or in operators to easily convert units:

2 inch to cm # 5.08 cm

20 celsius in fahrenheit # ~68 Fahrenheit

90 km/h to m/s # 25 m / s

### Constants

There are more than 50 well-known constants available from different categories:

Universal: e.g. PI, Speed-of-light, …

Electromagnetic: Coulomb, Bohr Magneton, …

Atomic and Nuclear: Bohr Radius, Electron Mass, …

Physico-chemical: Avogadro, Boltzmann, …

Adopted values: Molar Mass, Gravity, …

Natural Units: Planck Length/Mass/Time, …

Check the Math section of the User Manual for detailed information.