# Wave:Calculator

The Calculator analysis function performs mathematical operations on time series.

The mathematical operations to be performed are entered as a formula or mathematical expression. The formula is individually applied to each of the timestamps contained in the series that were selected for the analysis. The result is a new time series.

The following mathematical operators and functions are supported:

`()`

: Parenthesis`+`

: Addition operator e.g.`3 + 2`

`-`

: Subtraction operator e.g.`3 - 2`

`*`

: Multiplication operator e.g.`3 * 2`

`/`

: Division operator e.g.`3 / 2`

`%`

: Modulus operator e.g.`3 % 2`

(divides the two numbers, but returns the remainder)`^`

: Exponent operator e.g.`3 ^ 2`

`ABS`

: Returns the absolute of a number e.g.`ABS(-3)`

`SIN`

: Returns the sine of a number e.g.`SIN(3.14)`

`COS`

: Returns the cosine of a number e.g.`COS(3.14)`

`TAN`

: Returns the tangent of a number e.g.`TAN(3.14)`

`LOG`

: Returns the base 10 logarithm of a number e.g.`LOG(3)`

`LOGN`

: Returns the natural logarithm of a number e.g.`LOGN(4)`

`MAX`

: Returns the maximum of two numbers e.g.`MAX(4, 6)`

`MIN`

: Returns the minimum of two numbers e.g.`MIN(4, 6)`

Time series selected for the analysis can be added to the formula as variables either by entering the letter representing the time series manually or by double-clicking the time series in the list box.

The calculation only results in a number value for those timestamps that are common to all of the time series selected for analysis. If a timestamp is missing in one or more time series or the value of one or more time series is NaN for a timestamp, the resulting time series will have a NaN value for this particular timestamp.

Examples:

`100`

(without any variables):

- results in a time series with the value of 100 for each timestamp

`A / 100`

(where A is a time series):

- results in a time series where all values of A are divided by 100

`A + B`

(where A and B are time series):

- results in a time series where the values of A and B are added to together for each common timestamp

`MAX(A, B)`

(where A and B are time series):

- results in a time series with the maximum values from A and B

`(2 * A) + LOG(B) - ABS(C)`

(where A, B and C are time series):

- complex calculation with multiple time series

Notes:

- Added in Wave v1.9.4
- The Math Parser .NET library is used for parsing and evaluating the mathematical expression.