This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
formula [Sun Feb 28 00:34:25 2010] Alexander |
formula [Tue Jan 12 13:37:10 2021] (current) Alexander |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Formula Editing ====== | + | Page moved to [[expressions]]. |
- | Formula editor is used in the following windows: | + | |
- | * [[Set Column Formula]] | + | |
- | * [[Custom Fit Curve]] | + | |
- | * [[Transform X/Y Data]] | + | |
- | * [[Table]] -- cell editing | + | |
- | + | ||
- | MagicPlot uses standard [[wp> | + | |
- | + | ||
- | ==== Syntax Highlighting ==== | + | |
- | MagicPlot formula editor highlights expression syntax. It also marks matching brackets: | + | |
- | {{: | + | |
- | + | ||
- | ===== General Rules ===== | + | |
- | ==== Case Sensitivity ==== | + | |
- | MagicPlot formula translator is generally **case sensitive**, | + | |
- | + | ||
- | The '' | + | |
- | + | ||
- | ==== Entering Numbers ==== | + | |
- | You can use only dot ('' | + | |
- | The comma ('','' | + | |
- | + | ||
- | You can use '' | + | |
- | + | ||
- | ==== 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. | + | |
- | + | ||
- | ===== Cycle Variable ===== | + | |
- | You can use the cycle variable in expression. This variable is: | + | |
- | + | ||
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | ===== Using Table Data ===== | + | |
- | Only in //Set Column Formula// window. | + | |
- | + | ||
- | There are two functions to obtain current table cell values in formula: | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | You can use either upper-case letters ('' | + | |
- | + | ||
- | == Example == | + | |
- | * '' | + | |
- | + | ||
- | ===== What is " | + | |
- | Some mathematical functions are defined only on a certain interval. For example, the square root ('' | + | |
- | + | ||
- | The calculations are not terminated if NaN value occurs in some row(s). | + | |
- | + | ||
- | In some cases you may want to check if the '' | + | |
- | + | ||
- | ===== Functions ===== | + | |
- | You can see the list of all available functions and their descriptions in // | + | |
- | + | ||
- | MagicPlot uses functions of Java programming language library '' | + | |
- | + | ||
- | ==== Constants ==== | + | |
- | The predefined constants are: | + | |
- | + | ||
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | ===== Boolean Logic ===== | + | |
- | MagicPlot can interpret boolean logic expressions. Zero and negative values (''< | + | |
- | You can use simple logical operators which are described below. Use '' | + | |
- | + | ||
- | ==== ' | + | |
- | + | ||
- | The major logical function is '' | + | |
- | + | ||
- | == Examples == | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | ==== Equality Checking ==== | + | |
- | + | ||
- | You have to be careful if you need to check the equality of two values. Due to inaccuracy of computer calculations the result of evaluation is always approximate. For example, the result of '' | + | |
- | + | ||
- | Generally if you need to check the equality of two values you need use some equality threshold for relative difference. That is you should compare the absolute of relative difference of two values '' | + | |
- | + | ||
- | == Examples == | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | ===== Operators ===== | + | |
- | ^ Operator | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | ''/'' | + | |
- | | ''< | + | |
- | | ''< | + | |
- | | ''&'' | + | |
- | + | ||
- | ==== Operations Priority ==== | + | |
- | Operators with **lower** precedence value are evaluated **earlier**. You can use brackets to change calculation sequence. | + | |
- | + | ||
- | Expression is evaluated left-to-right, | + | |
- | + | ||
- | The reason exponentiation is right-associative is that a repeated left-associative exponentiation operation would be less useful. Multiple appearances could (and would) be rewritten with multiplication: | + | |
- | + | ||
- | ^ Operations | + | |
- | | '' | + | |
- | | ''< | + | |
- | | '' | + | |
- | | '' | + | |
- | | '' | + | |
- | | ''<'', | + | |
- | | '' | + | |
- | | ''&'' | + | |
- | |''< | + | |
- | |'' | + | |
- | + | ||
- | == Examples == | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | ===== Trigonometric Functions ===== | + | |
- | MagicPlot supports all standard trigonometric functions ('' | + | |
- | + | ||
- | You can use the following functions to convert angles units: | + | |
- | + | ||
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | == Examples == | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | ===== Table Rows Evaluation Order ===== | + | |
- | Rows are always evaluated one after another from the first to the last in range which was specified in 'Set Column Formula' | + | |
- | + | ||
- | == Example == | + | |
- | You can use this behaviour to calculate [[wp> | + | |
- | '' | + |