Wave:Calculator: Difference between revisions

From BlueM
Jump to navigation Jump to search
(Created page with "{{Wave_nav}} The Calculator analysis function performs mathematical operations on time series. The mathematical operations to be performed are entered as a formula or mathe...")
 
(added custom functions MAX and MIN)
Line 5: Line 5:
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 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 are supported:
The following mathematical operators and functions are supported:


*<code>()</code>: Parenthesis
*<code>()</code>: Parenthesis
Line 20: Line 20:
*<code>LOG</code>: Returns the base 10 logarithm of a number e.g. <code>LOG(3)</code>
*<code>LOG</code>: Returns the base 10 logarithm of a number e.g. <code>LOG(3)</code>
*<code>LOGN</code>: Returns the natural logarithm of a number e.g. <code>LOGN(4)</code>
*<code>LOGN</code>: Returns the natural logarithm of a number e.g. <code>LOGN(4)</code>
*<code>MAX</code>: Returns the maximum of two numbers e.g. <code>MAX(4, 6)</code>
*<code>MIN</code>: Returns the minimum of two numbers e.g. <code>MIN(4, 6)</code>


Time series selected for this 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.
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 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.
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:
Examples:
Line 32: Line 34:
* <code>A + B</code> (where A and B are time series):
* <code>A + B</code> (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
: results in a time series where the values of A and B are added to together for each common timestamp
* <code>MAX(A, B)</code> (where A and B are time series):
: results in a time series with the maximum values from A and B
* <code>(2 * A) + LOG(B) - ABS(C)</code> (where A, B and C are time series):
* <code>(2 * A) + LOG(B) - ABS(C)</code> (where A, B and C are time series):
: complex calculation with multiple time series
: complex calculation with multiple time series


Note: The [https://www.codeproject.com/articles/274093/math-parser-net Math Parser .NET] library is used for parsing and evaluating the mathematical expression.
Notes:  
* Added in Wave v1.9.4
* The [https://www.codeproject.com/articles/274093/math-parser-net Math Parser .NET] library is used for parsing and evaluating the mathematical expression.


[[Category:BlueM.Wave|C]]
[[Category:BlueM.Wave|C]]
[[Category:Analysis functions|C]]
[[Category:Analysis functions|C]]

Revision as of 02:16, 17 April 2021

Wave.png Wave | Development

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.