This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
expressions [Tue Jan 12 13:37:16 2021] Alexander created |
expressions [Sat Jan 16 17:25:32 2021] (current) Alexander |
||
---|---|---|---|
Line 9: | Line 9: | ||
==== Syntax Highlighting ==== | ==== Syntax Highlighting ==== | ||
- | MagicPlot formula editor highlights expression syntax. It also marks matching brackets:\\ | + | MagicPlot formula editor highlights expression syntax. It also marks matching brackets |
{{: | {{: | ||
===== General Rules ===== | ===== General Rules ===== | ||
==== Case Sensitivity ==== | ==== Case Sensitivity ==== | ||
- | MagicPlot formula translator is generally **case sensitive**, | + | MagicPlot formula translator is generally **case sensitive**, |
- | + | ||
- | Note that '' | + | |
==== Entering Numbers ==== | ==== Entering Numbers ==== | ||
- | * You can use **dot ('' | ||
- | * Cell editing in [[Table|Tables]] | ||
- | * Entering value in any numeric field | ||
- | * Using [[Calculator]] | ||
- | * You can use **dot ('' | + | * You can use **dot ('' |
* [[Set Column Formula]] | * [[Set Column Formula]] | ||
* [[fitting|Custom Fit Curve]] | * [[fitting|Custom Fit Curve]] | ||
+ | * Using [[Calculator]] | ||
+ | |||
+ | * You can use **dot ('' | ||
+ | * Cell editing in [[Table|Tables]] | ||
+ | * Entering value in any numeric field | ||
You can use '' | You can use '' | ||
Line 32: | Line 32: | ||
==== Using Spaces and Line Breaks ==== | ==== Using Spaces and Line Breaks ==== | ||
You can freely insert space characters and line breaks in formula, but do not break function names, numbers, operators. You do not need to enter special characters to indicate line break. | You can freely insert space characters and line breaks in formula, but do not break function names, numbers, operators. You do not need to enter special characters to indicate line break. | ||
+ | |||
+ | ===== Local variables in expression ===== | ||
+ | |||
+ | You can set a local variables in expression. Use semicolon to separate variable assignments and the result expression: '' | ||
===== Functions ===== | ===== Functions ===== | ||
Line 37: | Line 41: | ||
MagicPlot uses functions of Java programming language library '' | MagicPlot uses functions of Java programming language library '' | ||
+ | |||
+ | Special functions (Bessel, Erf, Gamma, Beta) calculation is based on [[https:// | ||
==== Trigonometric Functions ==== | ==== Trigonometric Functions ==== | ||
Line 60: | Line 66: | ||
===== Boolean Logic ===== | ===== Boolean Logic ===== | ||
- | MagicPlot can interpret boolean logic expressions. Zero and negative values (''< | + | MagicPlot can interpret boolean logic expressions. Zero is interpreted as '' |
- | You can use simple logical operators which are described below. Use '' | + | |
- | ==== ' | + | ==== The conditional function |
- | The basic logical function is '' | + | The conditional |
== Examples == | == Examples == | ||
Line 75: | Line 80: | ||
==== Equality Checking ==== | ==== Equality Checking ==== | ||
- | You have to be careful if you need to check equality of two values. Due to inaccuracy of computer floating-point calculations the result of evaluation is always approximate. For example, result of '' | + | You have to be careful if you need to check equality of two values. Due to inaccuracy of computer floating-point calculations the result of evaluation is always approximate. For example, result of '' |
Generally, if you want to check equality of two values you need to use some equality threshold for relative difference. That is, you should compare the modulus of relative difference of two values '' | Generally, if you want to check equality of two values you need to use some equality threshold for relative difference. That is, you should compare the modulus of relative difference of two values '' | ||
Line 84: | Line 89: | ||
===== Operators ===== | ===== Operators ===== | ||
- | ^ Operator | + | ^ Operator |
- | | '' | + | | '' |
- | | '' | + | | '' |
- | | '' | + | | '' |
- | | '' | + | | ''/'' |
- | | '' | + | | '' |
- | | '' | + | | '' |
- | | ''&'' | + | | '' |
+ | | ''&'' | ||
==== Operations Priority ==== | ==== Operations Priority ==== | ||
- | Operators with **lower** precedence value are evaluated **earlier**. You can use brackets to change calculation sequence. | ||
- | Expression | + | ^ Operations |
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
- | The reason for exponentiation being right-associative is that a repeated left-associative exponentiation operation would be less useful. Multiple appearances could (and would) be rewritten | + | Operators |
- | ^ Operations | + | Expression is evaluated |
- | | '' | + | |
- | | ''< | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | |''< | + | |
- | |'' | + | |
== Examples == | == Examples == | ||
Line 119: | Line 124: | ||
* '' | * '' | ||
* '' | * '' | ||
+ | |||
+ | ===== Comments in formulas ===== | ||
+ | |||
+ | You can insert comments in any formula using ''/ | ||
+ | |||
+ | Press '' | ||