This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
formula [Thu May 20 20:04:30 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 cases: | + | |
- | * [[Set Column Formula]] | + | |
- | * [[fitting|Custom Fit Curve]] | + | |
- | * [[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**, | + | |
- | + | ||
- | Note that '' | + | |
- | + | ||
- | === Entering Numbers === | + | |
- | You can use only dot ('' | + | |
- | 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 a cycle variable in expression. Such variables are: | + | |
- | + | ||
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | ===== 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 can be defined only on a certain interval. For example, square root ('' | + | |
- | + | ||
- | The calculations are not terminated if NaN value occurs in some row(s). | + | |
- | + | ||
- | In some cases you may want to check if a '' | + | |
- | + | ||
- | ===== Functions ===== | + | |
- | You can see a 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 basic logical function is '' | + | |
- | + | ||
- | == Examples == | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | === Equality Checking === | + | |
- | + | ||
- | You have to be careful if you need to check equality of two values. Due to inaccuracy of computer 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 '' | + | |
- | + | ||
- | == 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> | + | |
- | '' | + |