# MagicPlot Manual

Plotting and nonlinear fitting software

expressions

# Differences

This shows you the differences between two versions of the page.

 expressions [Tue Jan 12 20:21:29 2021]Alexander expressions [Sat Jan 16 17:25:32 2021] (current)Alexander Both sides previous revision Previous revision Sat Jan 16 17:25:32 2021 Alexander Sat Jan 16 17:02:23 2021 Alexander Sat Jan 16 17:01:58 2021 Alexander Tue Jan 12 20:21:29 2021 Alexander Tue Jan 12 14:15:29 2021 Alexander Tue Jan 12 13:37:16 2021 Alexander created Next revision Previous revision Sat Jan 16 17:25:32 2021 Alexander Sat Jan 16 17:02:23 2021 Alexander Sat Jan 16 17:01:58 2021 Alexander Tue Jan 12 20:21:29 2021 Alexander Tue Jan 12 14:15:29 2021 Alexander Tue Jan 12 13:37:16 2021 Alexander created 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: ''a=5; a*a + 2*a + 1''. The expression after the last semicolon is the result expression. The variables are calculated in the present order so you need to assign the variable before usage. ===== Functions ===== ===== Functions ===== Line 120: Line 124: * ''(-3)^2'' returns ''9''. * ''(-3)^2'' returns ''9''. * ''2^2^3'' is equal to ''2^(2^3)'', because ''^'' is right-associative operator. The result is ''256''. * ''2^2^3'' is equal to ''2^(2^3)'', because ''^'' is right-associative operator. The result is ''256''. + + ===== Comments in formulas ===== + + You can insert comments in any formula using ''/*…*/'' notation. + + Press ''Ctrl+/'' on Windows/Linux or ''Cmd-/'' on Mac OS to comment selection. Comments can be multi-line. Note that the single line comments using a symbol at the line start are not supported because line breaks are not taken into account in MagicPlot formula syntax.