FAQ
Using iMath questions
Q: How can I reduce a formula to floating point numbers as far as possible? VAL does not do this
A: iMath preserves mathematical exactness as far as possible. For example, square roots will not be evaluated to floating point numbers. But you can force iMath to approximate exact numbers by using SIMPLIFY with the eval
simplification.
Q: Is it possible to clear only chosen equations?
A: You can clear equations by label (select it and choose Edit - Clear from the menu), or use this line in a formula %%ii DELETE{@equation_label@}
. A list of labels separated by semicolons is also possible.
Q: How do I hide an equation?
A: Select the formula and choose iMath - Edit - Hide/show, alternatively put * after EQDEF.
Q: How do I include a something.imath file in the document?
A: Go to iMath - References and write your filename in the User-defined references box, or use this line in an iFormula: %%ii READFILE {"something.imath"}
. For example, if you have created 1.imath file in some directory, after READFILE the full path must be given. See the documentation for READFILE for details.
Q: I have an equation x = 100 m
. How do I tell iMath that the value is in meters?
A: In the new iFormula dialog write this x=100 "m"
. The "m" tells iMath that the value is in meters. This will only work if you have included the abbreviated SI units definition file in the iMath - References dialog.
Q: I can't get iMath to work properly with differentials
A: Here are two rules of thumb for working with differentials:
- You should only use the keyword differential when it is really necessary. If you want to create a complete differential like
df/dx
, useDIFFERENTIATE(f,x,1)
instead. - If you want iMath to be able to match differential objects, as in
d²f = y dx²
, then you must specify them asdifferential(f,2) = y differential(x, 2)
, not asdifferential(f,2) = y differential(x)^2
. - See the documentation for differential and DIFFERENTIATE for details.
Q: It's such a hassle to type differential(x)
all the time. Can't this be shorter, like d(x)
?
A: Please have a look at the question above and try to avoid using differential
.
Otherwise, just define a short-cut function yourself, e.g.
%%ii FUNCTION {{expand}, d, y_{_y_}}
%%ii @3@ FUNCDEF* d(y_{_y_}) = differential(y_{_y_})
Q: How can I create a variable named Δx?
A: By calling it nospace{%DELTA x}
. Note that the space in the middle is required. Another way is to simply use a unicode character (put it into your document somewhere and grab it from there to paste into the formula dialog).
Q: How can I have iMath print the unit %radian?
A: Since %radian is defined as 1, this does not happen automatically. But there is a workaround (since iMath 2.2.4)
%%ii UNITDEF {"radian", %ra = %unity}
%%ii OPTIONS {units={%ra}}
For "radian"
you can put whatever you would like to see printed as the name of this unit.
With this workaround you will need to be consistent when using the unit %ra
. For example, %ra + 1
will not evaluate to 2! Also, trigonometric functions will not evaluate their arguments unless you substitute %unity = 1
.
Formatting of formulas
Q: The iFormula and standard formula are placed differently from the left margin, is there a fast way to unify them?
A: If you are lucky, all formulas have the same object style. Open the "Formatting and Styles" window with F11 and click on a formula. The style will be highlighted, and you can right-click on it and edit it. Otherwise, each formula would have to be manually edited. This happens because the standard formula is created with 2mm left margin (right-click -> Object to see these margins), while iFormula is created with 0mm margin.
Q: Is it possible to hide units after evaluation?
A: Yes, in evaluation formula use NUMVAL instead of VAL. In addition, with iMath 2.1.2 there is now an option that suppresses the display of units alltogether (on a per-formula or per-document level).
Mathematical background questions
Q: How can I tell iMath that the cubic root of -1 is -1?
A: By default, iMath returns the root on the principal branch (which is complex for negative bases). This is a convention of the underlying GiNaC library which iMath uses to do the calculations. Starting with iMath 2.1.2, there is an option "Evaluate to real roots" which will give the desired result. Be aware that turning this option on might break older documents because the results of VAL statements might be different.
Q: How do I access Euler's number e
in an equation?
A: There are two ways: Using the exp()
function or using the built-in constant %e
. In the latter case you probably want to turn on auto-formatting for the equation to get nicer output (without the %
sign).
User interface questions
Q: Is it possible to make decimal numbers using "," instead of "."?
A: No, because the "," is also used to separate arguments to commands. But if your locale is set accordingly, iMath will convert the "." to a "," automatically when printing your formulas
Q: Why is the options dialog Tools-Options-Writer-iMath blank?
A: This seems to be a bug in Office when updating iMath. You could try completely removing iMath through the extension manager, closing Office, starting it again, and installing iMath again through the extension manager. Unfortunately, even this does not always remove all traces of the old iMath version. Often I had to remove the complete office configuration directory. For example, on Ubuntu, this is located in .config/libreoffice. On Windows, you should look in C:\users\<username>\Application Data\LibreOffice (or OpenOffice).
Different platforms
Q: Will iMath work in LibreOffice on Windows platform?
A: Yes, the current version of iMath (from 2.0.0 upwards) now works on the Windows platform. Note that MS Visual C++ 2010 redistributable is required for it to work properly.
Mysterious errors
Q: I get an error message that says syntax error, unexpected '\n'
and iMath marks the end of my formula as the place where the error occurs. But I think that the formula is totally in order.
A: This happens frequently if you work with vectors, but the left-hand side of the equation has not been defined as a vector. In other words, your expression creates a vector, but you are trying to assign it to a normal variable. Use "iFormula - Define vector" to define your variable to be a vector before using it.
Another possible reason is that you are creating an equation, but your formula text does not contain an =
sign.
Q: Why do I get a wrong result in the following example?
%%ii FUNCTION {{none}, z, y;x}
%%ii FUNCTION {{none}, y, x}
%%ii @eq:1@ EQDEF z = sin {y} + x^2
%%ii TEXT newline
%%ii @eq:2@ EQDEF DIFFERENTIATE(@eq:1@, x, 1)
A: You need to define FUNCTION {{none}, y, x}
before function z(). In the example, you have two different versions of y
: When defining function z(), it is a normal variable. After that, you define it to be a function, and then use y() to define the value of z(). When you differentiate z(), the left-hand side is a total differential, but since y
is a variable here, dy/dx
is zero, so only the second part remains. On the right-hand side, the chain rule is applied to sin(y)
, since here it is a function.
Q: What does the message Compile error: invalid map<K, T> key
mean?
A: This error occurs when another soffice...
process is running in the background. Usually it happens after a fatal error in Office and the termination of iMath. If you get this error message, try to kill all running instances of the soffice...
process in the task manager of your operating system. Then run Office again.
Obsolete questions
Q: There is nothing under File->Properties->User defined properties, why is that?
A: This happens while working on a new document, the user defined properties will appear after saving that document and reloading it.
Q: Help! All my numeric results are wrong!
A: Have a look at the precision setting in File - Properties - User-defined properties. If the type of the property precision is set to String/Text, set it to Integer/Number instead. This was a bug in some beta version of iMath 2.0.5. You should also set the following properties from Text to Number: Automatic vector size and Exponent.
Q: Help! Part of my document has become invisible!
A: This seems to be a bug in LibreOffice when you open a document with hyperlinks in a table of contents (e.g. iMath-tour), and CTRL+click on some hyperlink after the first recalculation of whole document. Focus goes to this part of a document, but some text and formulas disappear.
The content is not lost, but becomes hidden somehow, and may be restored either by switching the view of the document from "page" to "HTML" or hitting ENTER many times until the hidden text appears on the next page.