Reference: Difference between revisions

From iMath
Jump to navigation Jump to search
(PREFIXDEF)
(Page deleted)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
It is recommended to always use the iMath menus to create or modify iFormulas. Nevertheless, sometimes it will be necessary to fine-tune equations by editing them directly.


All iMath commands start with the string <code>%%ii</code> at the beginning of a line, which will be interpreted as a comment by Office. When the document is recalculated, iMath parses the string and generates the formula that is displayed. The generated lines are marked by <code>%%gg</code> at the end of the line. Editing such a line makes no sense because it will be deleted at the next recalculation! Always modify the <code>%%ii</code> lines if you want to tweak an iFormula. Formulas may also have lines without either <code>%%ii</code> or <code>%%gg</code>, these will not be touched by iMath.
There is also a reference section integrated into the Office help. Press F1 and enter "iFormula" into the Index tab of the help.
== Elements ==
The following elements can be part of an iFormula definition string
* <code>symbol</code> The name of a mathematical symbol or function, e.g. <code>x</code> or <code>a_n</code>
* <code>unit</code>  The name of a physical unit, either preceded by a percent sign or enclosed in quotation marks, e.g. <code>%meter</code> or <code>"meter"</code>
* <code>expression</code> A mathematical expression in Openoffice math format
* <code>exlist = expression; expression ... </code> A list of expressions, separated by semicolons
* <code>equation</code>  A relation which has the form <code>expression1 operator expression2</code>. Operator can be <code>=</code>, <code>></code> etc.
* <code>eqlist = equation; equation... </code> A list of equations, separated by semicolons
* <code>vector = expression1 : expression2 : expression3</code> A vector of expressions where expression1 is the first element, expression2 the second element and the optional expression3 the step. By default the given interval will be subdivided into 20 steps, so for example <code>x = 1:20</code> will give a vector containing the integer numbers from 1 to 20.
* <code>vector = leftbracket expression;expression ... rightbracket</code> A vector given as a list of expressions, enclosed in brackets
* <code>symbol [ number ] or symbol [ number, number ]</code> Accesses an element of a vector or matrix.
* <code>@label@</code> A equation label, used to reference a previously defined equation. The label MUST be enclosed in hash signs.
* <code>*</code> If the asterisk is given, then the output of this line is supressed, which is useful for hiding intermediate calculations.
* <code>{ option; option; ... }</code> The options can be any of those described for the OPTIONS keyword. It is not necessary to specify options (you need to leave away the brackets, too, if you don't).
* Brackets
** All statements use curly brackets {}
** All functions (including built-in functions like VAL() or SUBST()) use normal ()
** Otherwise, all bracket types permitted by Office Math are accepted, including bracket sizing with <code>left</code< and <code>right</code>
== Commands ==
After the initial <code>%%ii</code>, several groups of commands are possible.
=== Definitions ===
iMath allows you to define equations, units and functions, and to evaluate expressions.
==== <code>{ options } EXDEF expression</code> ====
Create an expression. This keyword is most frequently used with <code>VAL</code> to find the values of a symbol or an expression, e.g. <code>EXDEF VAL(y)</code>.
==== <code>@label@ { options } EQDEF * expression</code> ====
Define an equation. The expression most be of the form <code>expression1 = expression2</code>. For the special case of the equation label starting with <code>lib:</code>, the equation will not be erased by <code>CLEAREQUATIONS</code>. This is useful for building a library of generic equations, as for example in the file substitutions.imath.
==== <code>@label@ { options } CONSTDEF * expression</code> ====
Define a constant. The expression most be of the form <code>variable = expression</code>, and the expression must evaluate to a quantity (a numeric with or without units). Constants are not erased by <code>CLEAREQUATIONS</code>. This makes it possible to specify general constants only once in the file and reuse them for several different calculations.
==== <code>@label@ { options } FUNCDEF * funcname(symbol|exlist) = expression</code> ====
Define an equation that can be used to find the value of a user-defined function. The function must first have been declared with <code>FUNCTION</code>.
==== <code>FUNCTION { hints, symbol, symbol|exlist }</code> ====
Declare a user-defined function. <code>symbol</code> is the name of the function. The expression declares the arguments of the function and can be either a single symbol or a list of symbols. The way that iMath treats this function can be influenced by function hints:
* none: No function hints (must be used because iMath requires three arguments to the <code>FUNCTION</code> declaration
* lib: A library function: It will not be affected by <code>CLEAREQUATIONS</code>
* trig: For trigonometric functions. Tells iMath that this function will get special treatment when printing (e.g. <math>sin^2 x</math> instead of <math>(sin x)^2</math>)
* expand: The function is to be expanded immediately. Useful for functions that are really abbreviations, e.g. <code>square(x)</code> will be expanded to <math>x^2</math>
* nobracket: The function does not require brackets around the argument (e.g. <code>sqrt(x)</code> is printed as <math>root x</math>)
* defdiff: Differentiate the definition of the function, not the function itself
==== <code>UNITDEF { "unitname", symbol = expression }</code> ====
Defines a new unit. The symbol is the name of the unit, this must begin with a percent sign % to distinguish it from a variable name. The expression defines the unit in terms of units already known to iMath. If this expression contains data types apart from units, powers of units, numerics, or constants already known to iMath, a warning is issued, but the unit definition is created anyway. The unitname is optional and gives a string to be printed instead of the symbol. This is useful when defining units whose name is not a valid symbol, e.g. inches: <nowiki>UNITDEF{"''", %inch = 0.0254 %m}</nowiki>.
==== <code>PREFIXDEF { symbol = expression }</code> ====
Defines a new unit prefix. The symbol is the name of the prefix, this must begin with a percent sign % to distinguish it from a variable name. The expression defines the numeric value of the prefix. Example: With the definition <nowiki>PREFIXDEF{%milli = 10^{-3}}</nowiki> iMath will automatically recognize the unit <nowiki>%millimetre</nowiki>.
==== <code>REALVARDEF symbol</code> ====
Defines the symbol to be real-valued. This allows iMath to evaluate some functions immediately (e.g. complex conjugation).
==== <code>POSVARDEF symbol</code> ====
Defines the symbol to be positive (and real-valued). This allows iMath to evaluate some functions immediately (e.g. absolute value).
==== <code>VECTORDEF symbol</code> ====
Defines the symbol to be a vector. This is important because vectors are non-commutative when evaluating an expression.
==== <code>@label@ { options } VECTORDEF * symbol = expression</code> ====
Defines the symbol to be a vector and assigns the expression to it. It is important to use this keyword because vectors are non-commutative when evaluating an expression.
==== <code>MATRIXDEF symbol</code> ====
Defines the symbol to be a (two-dimensional) matrix. This is important because matrices are non-commutative when evaluating an expression.
==== <code>@label@ { options } MATRIXDEF * symbol = expression</code> ====
Defines the symbol to be a (two-dimensional) matrix and assigns the expression to it. It is important to use this keyword because matrices are non-commutative when evaluating an expression.
==== <code>TEXT string</code> ====
Arbitrary text that should be displayed between two iMath formulas. The text must be enclosed in quotes, and formatting rules for Office formulas apply.
==== <code>DELETE { @label1@; @label2@; ... }</code> ====
Removes an equation such that it has no influence on future searches for variable values. Note that the equation is not deleted from the file, but only becomes ineffective (and unaccessible) after the point in the text where the delete statement is.
==== <code>CLEAREQUATIONS</code> ====
iMath stores all equations and functions that it encounters. If you want to make a fresh start in your document, use this command.
=== Symbolic manipulations of expressions ===
==== <code>COLLECT ( equation|expression, variable )</code> ====
Tries to restructure both sides of the equation as a polynomial in the given variable. The variable may be omitted, in this case, iMath uses the variable that occurs in the greatest amount of powers.
==== <code>DIFFERENTIAL ( expression )</code> ====
Create a single differential object like <code>dx</code>. Please note that though you can handle this object like a variable, this does not always make mathematical sense!
If you want iMath to be able to match differential objects, as in d²f = y dx², then you must specify them as <code>differential(f,2) = y differential(x, 2)</code>, not as <code>differential(f,2) = y differential(x)^2</code>!
If you want to create a complete differential like <code>df/dx</code>, use <code>diffferentiate(f,x,1)</code> instead. iMath will automatically separate this into two differential objects <code>df</code> and <code>dx^{-1}</code>, but will mark them as being connected, so that on printing they can be displayed correctly.
In other words, you should only use <code>differential</code> when it is really necessary.
==== <code>DIFFERENTIATE ( equation|expression, variable, variable)</code> ====
Differentiate the expression or both sides of the equation with respect to the variable. The second variable gives the number of times to differentiate.
If you are differentiating a function, e.g. <code>DIFFERENTIATE(f(x), x, 1)</code>, iMath will automatically separate the resulting expression into two differential objects <code>df(x)</code> and <code>dx^{-1}</code>, but will mark them as being connected, so that on printing they can be displayed correctly.
==== <code>INTEGRATE ( equation|expression, variable1, variable2)</code> ====
Create an integral for the expression or for both sides of the equation with respect to variable1. variable2 is the integration constant. The integral will be evaluated immediately (if possible).
==== <code>INTEGRATE ( equation, variable;variable, variable;variable)</code> ====
Create an integral for both sides of the equation with respect to the two variables in the first list. The second list contains the integration constants to be used. The integrals will be evaluated immediately (if possible).
==== <code>INTEGRATE ( equation|expression, variable1, variable2, variable3)</code> ====
Create an integral for the expression or for both sides of the equation with respect to variable1. Variable2 is the lower bound, variable3 is the upper bound. The integral will be evaluated immediately (if possible).
==== <code>INTEGRATE ( equation, variable;variable, variable;variable, variable;variable)</code> ====
Create an integral for both sides of the equation with respect to the variables in the first list. The second list contains the lower bounds, the third contains the upper bounds. The integrals will be evaluated immediately (if possible).
==== <code>INT FROM variable = expression TO { expresssion} { expression differential(variable)}</code> ====
Create an integral from the lower bound to the upper bound. The function can then be symbolically evaluated with the <code>SIMPLIFY</code> keyword. If the upper bound is a number or a variable then the curly braces around it can be omitted. Example: <code>INT FROM x = -%pi to %pi { sin(x) differential(x)}</code>. The differential can be contained in the expression and iMath will find it (you might have to expand the expression first). But if there is no differential matching the integration variable anywhere then you will get strange results.
==== <code>INT { expression differential(variable)}</code> ====
Create an integral without bounds. The expression must be enclosed in brackets. The function can then be symbolically evaluated with the <code>SIMPLIFY</code> keyword.
==== <code>ITERATE ( equation, expression, expression, integer )</code> ====
Iterate an expression until it converges. Example: <code>ITERATE(x = sqrt(x), 100, 0.1, 10)</code> will start iterating with <code>x=100</code>. The next value of <code>x</code> will be <code>sqrt(100)</code>. Iteration will continue until the difference between two consecutive values of <code>x</code> is less than <code>0.1</code>. The last parameter gives the maximum number of iterations, in case there is no convergence.
==== <code>ITERATE ( eqlist, exlist, exlist, integer )</code> ====
Iterate a list of expressions until it converges. Example: <code>ITERATE(x=sqrt(x);y=ln(y), 100;20, 0.1;0.01, 10)</code> will start iterating with <code>x=100</code> and <code>y=20</code>. The next value of <code>x</code> and <code>y</code> will be <code>sqrt(100)</code> and <code>ln(20)</code>. Iteration will continue until the difference between two consecutive values of <code>x</code> and <code>y</code> is less than <code>0.1</code> and <code>0.01</code>, respectively. The last parameter gives the maximum number of iteration, in case there is no convergence.
==== <code>LHS ( equation )</code> ====
Gets the left hand side of the equation.
==== <code>NROOT number number</code> ====
Creates the nth root of a number. If you specify expressions instead of numbers, you must enclose them in curly brackets {} to avoid ambiguities.
==== <code>NUMVAL ( expression )</code> ====
Try to find a numeric value (without units) for the expression from any equations defined previously in the document. Gives an error if the expression does not evaluate to a number.
==== <code>NUMVALWITH ( expression, eqlist )</code> ====
Try to find a numeric value for the expression from any equations defined previously in the document, plus the equations given as the second argument. Gives an error if the expression does not evaluate to a number.
==== <code>PDIFFERENTIATE ( equation|expression, variable, variable)</code> ====
Partially differentiate the expression or both sides of the equation with respect to the variable. The second variable gives the number of times to differentiate.
==== <code>QUANTITY ( expression )</code> ====
Try to find a quantity (number with optional units) for the expression from any equations defined previously in the document. Gives an error if the expression does not evaluate to a quantity.
==== <code>QUANTITYWITH ( expression, eqlist )</code> ====
Try to find a quantity (number with optional units) for the expression from any equations defined previously in the document, plus the equations given as the second argument. Gives an error if the expression does not evaluate to a quantity.
==== <code>QUO ( expression, expression, variable )</code> ====
Calculates the quotient of two polynomials in the given variable. An error message will be shown if one of the expressions is not a polynomial in the variable.
==== <code>REM ( expression, expression, variable )</code> ====
Calculates the remainder after division of two polynomials in the given variable. An error message will be shown if one of the expressions is not a polynomial in the variable.
==== <code>REV ( equation )</code> ====
Reverse the left hand side and the right hand side of the equation
==== <code>RHS ( equation )</code> ====
Gets the right hand side of the equation
==== <code>SIMPLIFY ( equation|expression, "simplification"; "simplification" ... )</code> ====
Simplifies both sides of the equation according to the simplifications given in a list. Possible values are:
* <code>expand</code> Fully expands all expressions, including function arguments.
* <code>expandf</code> Only expand function definition, not arguments.
* <code>eval</code> Numerically evaluate the equation as far as possible.
* <code>normal</code> Normalize the equation (see description of GiNaC normal() method for details).
* <code>collect-common</code> Collect common factors (see description of GiNaC collect_common_factors() method for details).
* <code>unsafe</code> Does unsafe simplifications, for example <code>sqrt{x^2} => x</code> or <code>\arctan\tan{x} => x</code>. Note that the opposite <code>\tan\arctan{x} => x</code> is not an unsafe evaluation and is thus done automatically (by GiNaC).
* <code>diff</code> Evaluates differential function diff, thus symbolically calculating differentials as far as possible.
* <code>sum</code> Evaluates sum functions, thus symbolically calculating sums as far as possible.
* <code>gather-sqrt</code> Gathers single square roots under one root symbol.
* <code>integrate</code> Symbolically integrates any integrals in the expression as far as possible.
==== <code>SOLVE ( equation, variable, solution )</code> ====
Solve the equation for the variable. If there are several possible solutions (e.g. for a quadratic equation), you can specify which one you want in the third argument. Note that this argument is not optional, so you must specify 1 for a linear equation.
==== <code>SUBST ( expression, eqlist )</code> ====
Substitute the equation or the list of equations into the expression. All substitutions will be done in parallel, which means that a list of equations like <code>x = y; y = z</code> might not have the desired effect (consider using <code>SUBSTC</code> instead).
==== <code>SUBSTC ( expression, eqlist )</code> ====
Substitute the equation or the list of equations in the expression. The substitutions will be done in the order you specify them, so a list of equations like <code>x = y; y = z</code> will have the effect of substituting all <code>x</code> and <code>y</code> in the expression with <code>z</code>.
==== <code>SUBSTV ( expression, variable = vector )</code> ====
Substitute a vector of expressions in the expression. The result will be a vector. This is mostly useful for specifying values to the <code>CHART</code> keyword.
==== <code>SUM FROM variable = expression TO { expresssion} { expression }</code> ====
Create a sum function summing up the expression from the lower bound to the upper bound. The function can then be symbolically evaluated with the <code>SIMPLIFY</code> keyword. If the upper bound is a number or a variable then the curly braces around it can be omitted.
==== <code>TSERIES ( expression, variable = expression, nth )</code> ====
Create a Taylor series of nth grade for the expression around the given point.
==== <code>UNIT ( expression )</code> ====
Try to find a quantity (number with optional units) for the expression from any equations defined previously in the document, and then get the units of this result. Gives an error if the expression does not evaluate to a quantity.
==== <code>UNITWITH ( expression, eqlist )</code> ====
Try to find a quantity (number with optional units) for the expression from any equations defined previously in the document, plus the equations given as the second argument, and then get the units of this result. Gives an error if the expression does not evaluate to a quantity.
==== <code>VAL ( expression )</code> ====
Try to find a numeric value for the expression from any equations defined previously in the document.
==== <code>VALWITH ( expression, eqlist )</code> ====
Try to find a numeric value for the expression from any equations defined previously in the document, plus the equations given as the second argument. These will be removed again after the value search, so they have no effect on the rest of the document.
=== Conditions ===
Conditions are currently only parsed within the context of the ifelse() function.
==== <code>{expression|equation} AND {expression|equation}</code> ====
If the argument is an expression, interpret zero as false, anything greater than zero as true, and -1 as "not able to evaluate". If the argument is an equation, take the difference of the left- and right-hand-sides and interpret it according to the type of equation. If the expression or equation cannot be evaluated, the result will be -1.
Examples: <code>0 AND 1</code> will evaluate to 0. <code>VAL(x) > 2 AND VAL(x) < 5</code> will evaluate to 1 if <code>x</code> has a value between 2 and 5. Beware: <code>x == 0 AND y == 0</code> will always evaluate to -1 because it is not possible to compare symbols and numbers!
==== <code>{expression|equation} OR {expression|equation}</code> ====
If the argument is an expression, interpret zero as false, anything greater than zero as true, and -1 as "not able to evaluate". If the argument is an equation, take the difference of the left- and right-hand-sides and interpret it according to the type of equation. If the expression or equation cannot be evaluated, the result will be -1.
Examples: <code>0 OR 1</code> will evaluate to 1. <code>VAL(x) > 2 OR VAL(x) < -2</code> will evaluate to 1 if <code>x</code> has a value greater than 2 or less than -2. Beware: <code>x == 0 OR y == 0</code> will always evaluate to -1 because it is not possible to compare symbols and numbers!
==== <code>NEG {expression|equation}</code> ====
If the argument is an expression, interpret zero as false, anything greater than zero as true, and -1 as "not able to evaluate". If the argument is an equation, take the difference of the left- and right-hand-sides and interpret it according to the type of equation. If the expression or equation cannot be evaluated, the result will be -1.
<code>NEG 0</code> will evaluate to 1. <code>NEG VAL(x) > 2</code> will evaluate to 1 if <code>x</code> has a value less or equal 2.
=== Operator Precedence ===
Operator precedence defines the order in which operators are evaluated when no brackets are set. For example, <code>3 * 4 + 5</code> will evaluate to 17, not to 23, because <code>+</code> has lower precedence than <code>*</code>.
The precedence of operators in iMath, from lowest to highest, is
  EXDEF
  ##
  ; #
  OR
  AND
  NEG
  = < > != <>
  :
  - +
  * / TIMES
  - (unary minus)
  FUNC WILD LHS RHS REVERSE VALUE VALUEWITH ITERATE INTEGRAL NROOT QUO REM GCD LCM
  DIFFERENTIAL
  ^
  TRANSPOSE
  ! (faculty)
  [ (matrix index)
  SIZE (font size specification)
=== Data Exchange ===
==== <code>CALCCELL ( string , string , string )</code> ====
Access the value of a cell or a cell range in a Calc document. The first string contains the file name of the Calc document (relative paths are possible). The second string contains the sheet name, and the third the cell. iMath will create numeric values or a string expressions, depending on the type of the Calc cell.
==== <code>SETCALCCELLS ( string , string , string , expression )</code> ====
Set the value of a cell range in a Calc document. The first string contains the file name of the Calc document (relative paths are possible). The second string contains the sheet name, and the third the cell range. The dimensions of the cell range must match the dimensions of the expression value (scalar, vector or matrix).
Note: The Calc document is saved immediately after the change (during the recalculation of the iMath document).
==== <code>SETTABLECELL ( string , string , expression )</code> ====
Set the value, string or formula of a table cell. The first string must contain the table name and the second string the cell reference (you can see both if you click into the table cell and then look at the status bar at the bottom of the Writer window). You must reference a single cell. iMath checks whether the expression is a real number and set the table cell to a double-precision floating point value. If the expression is a string and begins with '=', iMath will set the table cell to a formula. Otherwise the table cell will be set to a text.
==== <code>TABLECELL ( string , string )</code> ====
Access the value of a table cell. The first string must contain the table name and the second string the cell reference (you can see both if you click into the table cell and then look at the status bar at the bottom of the Writer window). The string must reference a single cell. iMath checks whether the table cell has number type or string type and will create the appropriate expression.
Note: Cell ranges are not supported because if you split/merge cells then the cell addresses become very complicated and a range might not be clearly defined.
==== <code>TEXTFIELD ( string )</code> ====
Access the value of a text field. The string must contain the text field type, e.g. <code>DDE.<dde-name></code> for a DDE text field or <code>User.<varname></code> for a user-defined text field. DDE text fields can reference single cells or cell ranges. The text field value is always a string. iMath tries to guess the value type and will create either numeric values or string expressions.
If the argument is a cell range, iMath will create a vector filled with the referenced cell values. The vector will be a row or column vector, depending on the cell range.
For German users: [http://www.ooowiki.de/DDE.html ooowiki] has a good explanation of how to create DDE links.
=== Charts ===
==== <code>CHART { "objectname", xval, xunit, yval, yunit, idx }</code> ====
Update or create data in a chart with the Office object name given in the string (in other words, the chart must already exist in the document). The x-values can be either a vector of values or an equation assigning a vector of values to a variable. The x-values will be expressed in the given units. In other words, after dividing the x-values by the units, a vector of purely numeric values must result. The y-values can be either a vector of values or an equation or an equation label. If you specifiy an equation or a label, the vector of x-values will be substituted into the equation to produce a vector of y-values. This will only work if you specified the x-values as an equation! If the y-values have units, they must be specified. The last argument is the index of the chart series. This enables you to add or manipulate different series of the chart.
=== Reading and writing files ===
====<code>READFILE { "path/to/file" }</code>====
Open the given file and parse the iMath commands in this file. This command can be used to put common formulas in a file to re-use them. At the moment, the path is operation-system dependent! In other words, you cannot use an Office URL.
=== Options ===
Options can be defined with the keyword <code>OPTIONS { key1 = value1; key2 = value2; ... }</code>. The following key-value pairs are possible.
==== Default units ====
<code>units={unit1; unit2; ...}</code> Specifies a list of units separated by ';' which should be used for printing physical quantities. If no such list is specified, the SI base units are used. A useful list of units for mechanical engineering might be <code>{%mm; %N; %Nm; %Nosqmm}</code>. The order in which the units are specified is important! Simple units should be specified first, more complex ones later on. The reason is that the complex units usually imply the simpler ones, for example, <code>N</code> implies <code>mm</code> because <code>1 N</code> equals <code>1 kg m/s^2</code>.
==== Suppress display of units ====
<code>suppress_units=true|false</code> Specifies whether units should be suppressed when printing formulas or evaluation resaults. The default is <code>suppress_units=false</code>. Note that calculations will always be made with units. This option simply suppresses unit display.
==== Precision of numbers ====
<code>precision=integer</code> Specifies what precision is to be used for printing floating point numbers. The precision is the number of digits printed, more digits are rounded away. The precisions is 4 by default. The next option fixedpoint influences the interpretation of the precision.
==== Fixed or floating point notation of numbers ====
<code>fixedpoint=true/false</code> Specifies whether floating point numbers should be printed with a fixed number of digits after the decimal marker (true) or with a fixed number of significant digits, not counting leading zeros (false). The default is fixedpoint=false.
==== Fixed exponent ====
<code>exponent=integer</code> Specifies that all numbers should be printed with the given exponent
==== Display of differentials ====
<code>difftype="line"/"dot"/"dfdt"</code>  Specifies how differentials should be printed: With an apostrophe after the variable name (f'), with a dot on top of the variable name (dot f) or as df/dt.
==== Automatic formatting of iFormulas ====
<code>autoformat=true/false</code> Specifies whether iMath should do automatic formatting of your input equations. By default this option is turned off (false, meaning that the equations are printed exactly as you typed them in). This of course is only possible for original equations, not for equations obtained by symbolic operations.
==== Automatic aligning of iFormulas ====
<code>autoalign=true/false</code> Specifies whether iMath should automatically align multi-line formulas at the equation symbol. Consecutive formulas must be merged (e.g. using the context menu) for this option to have any effect.
==== Automatic chaining of iFormulas ====
<code>autochain=true/false</code> Specifies whether iMath should omit the left hand side of an equation in multi-line formulas if it is identical to the previous line's left hand side.
==== Inhibit underflow exceptions ==== 
<code>underflow=true|false</code> Specifies whether iMath should silently ignore underflow exceptions. The default value is <code>underflow=true</code>. In this case numbers smaller than the underflow limit will be treated as zero.
==== Evaluate odd nth roots of negative bases to the real value ====
<code>realroots=true|false</code> Specifies whether iMath should return real nth roots as the result of VAL() where the base is negative. By default, the root on the principal branch is returned (which is complex for negative bases). For example, the third root of -1 would be returned as 1/2 + 1/2 * sqrt(3) * I.
=== Miscellaneous ===
==== <code>SIZE sizestring</code> ====
Change the default display size of the formula (the usage is identical with normal math formula usage).
==== <code>ALIGNL</code> ====
Align the following text to the left (use bracketing if you need to align more than one symbol).
==== <code>ALIGNC</code> ====
Align the following text to the center.
==== <code>ALIGNR</code> ====
Align the following text to the right.
== Built-in constants and functions ==
This section describes constants and functions specific to iMath. Most functions will try to immediately evaluate themselves. If this is not possible, then the function will remain in the expression where it has been used. In that case it can be evaluated later with the <code>SIMPLIFY</code> keyword
=== Constants ===
iMath knows about Pythagoras' number <code>%pi</code> and the basis of the natural logarithm <code>%e</code>. Trigonometric expressions with pi or multiples of it will usually simplify automatically, but the expression <code>ln(%e)</code> requires a <code>VAL()</code> call to evaluate to 1.
=== Functions for vectors and matrices ===
====<code>vmin ( vector )</code> ====
Immediately evaluates to the minimal element of the vector if possible.
====<code>vmax ( vector )</code> ====
Immediately evaluates to the maximal element of the vector if possible.
====<code>transpose ( vector or matrix )</code> ====
Immediately evaluates to the transposed vector or matrix.
====<code>det ( matrix )</code> ====
Immediately evaluates to the determinant of the matrix.
=== Functions for number display ===
====<code>round ( expression; expression )</code> ====
Immediately evaluates to a number rounded to the given number of decimal places, if possible.
====<code> ceil ( expression; expression )</code> ====
Immediately evaluates to a number rounded up to the given number of decimal places, if possible.
==== <code>floor ( expression; expression )</code> ====
Immediately evaluates to a number rounded down to the given number of decimal places, if possible.
=== Functions for differentials ===
=== Functions for conditional evaluation ===
==== <code>ifelse ( condition; expression1; expression2 )</code> ====
Immediately evaluate to expression1 or expression2 if the condition is an equation involving numbers (e.g. <code>3 < 4</code>).

Latest revision as of 18:01, 9 July 2017