Table of Contents
Qalculate! provides flexible parsing, calculation output and result display. There are several ways in which parsing of expression and display of results can be customized. These modes can generally be changed through the mode menu. The state of each mode can be saved under a name in
→ for quick access. The Preset and Default meta modes are always available and represents the state when Qalculate! is load for the first time and the mode settings automatically loaded at each startup (and by default saved on exit), respectively. Different modes are summarized below.Non-decimal bases can be selected for display of numbers in the result. This include regular number bases (binary, octal, hexadecimal, sexagesimal) as well as sexagesimal time format and roman numerals. All number bases between 2 and 36, and base for expression input, can be selected from a dialog window accessed from the section called “Convert Number Bases Dialog”) is efficient for simple conversion between common bases.
→ → or → → . Note that duodecimal (base 12) numbers use upside down 2 and 3 (or 'X' and 'E'), instead of 'A' and 'B', for the tenth and eleventh digit. The convert number bases dialog (seeThese modes mainly control when numbers are displayed exponentially (e.g. “2.62E3” which equals “2620”). In the default normal mode, numbers are displayed in exponential format if the exponent will be greater than the current precision. In scientific mode the lowest exponent is 3. In simple numerical mode the exponential format is never used and it is always used in purely scientific mode. In the engineering mode, the exponent is always a multiple of three. This is naturally equivalently true for numbers less than one and negative exponents. When the scientific modes are selected in the keypad (not from the menubar), negative exponents are automatically activated and sort minus last deactivated, while normal and simple modes do the opposite.
If this option is on, Qalculate! will not round infinitely repeating digit sequences, if the digits in the sequence fits the maximum number of decimals. Instead “…” will be displayed after the repeated digits and the result indicated as exact (compare “9/11 ≈ 0,81818182” with “9/11 = 0,81 81…”).
With this option, halfway numbers will be rounded to even instead of upwards (e.g. 2.65 is then rounded to 2.6 instead of 2.7). Note that this behavior is always applied in the round() function.
if this option is on, approximate numbers in the result will be appended with zeroes, so that the number of digits (after preceding zeroes) will equal the precision.
If negative exponents is activated, division is shown as a negative power (e.g. “x * y^-1” instead of “x / y”).
This option decides if minus signs should be avoided in the first positions of the result expression.
Complex number can be displayed in rectangular/cartesian (e.g. “5i + 2”), exponential (e.g. “5.39 * e^1.19”) or polar form (e.g. “5.39 * (cos(1.19) + i * sin(1.19))”).
This controls if numbers are displayed in fractional or decimal mode. Decimal mode displays numbers as usually expected (“6/4 = 1.5”), combined displays a whole number and a fraction (“6/4 = 1 1/2”) and fractional only displays as fraction (“6/4 = 3/2”).
The automatic use of prefixes for units in results can be toggled on and off. By default prefixes are only used for a selection of units (mainly standard SI and CGS units), but this can be changed to also include currencies or all other units. By default prefixes representing a power of ten not dividable by three (centi, deci, deca and hekto) are not used and need to be enabled. If denominator prefixes are not explicitly enabled, prefixes will only be set for the numerator in a fractional unit expression (e.g. “1 Mg/m” or “1 kg/mm”), unless there is no unit in the numerator. The place units separately alternative controls the display of unit expressions in result. If it is enabled (default) units will be displayed separate from other parts of the expression at the end (compare “(5x*m)/(y*s)” and “5x/y m/s”).
Units can be automatically converted to base units or the optimal units in results. Optimal conversion means that the number of units in the result is reduced to as few units as possible. Only SI units are used for conversion. If “60.2 minutes = 1 hour to 12 seconds”.
is activated, non-SI units are converted to SI units, even if equally or less optimal than the original unit(s). In optimal unit mode, currencies are converted to the local currency, unless deactivated in the preferences dialog. Mixed units conversion allows certain units, such as time units and many imperial/U.S. customary units, to be converted to a combination of appropriate units, e.g.The display of unit, prefix, variable and function names can be controlled by selecting to display abbreviations or full length names (e.g. “5 cm” or “5 centimeters”). Both abbreviations and long names can however always be entered in expressions.
When always exact mode is on, the calculation will not go further than what can be calculated exactly (e.g. “sqrt(2+3) = sqrt(5)”). The default “Try Exact” mode, will calculate the result exact as far as possible and then approximately. Approximate mode will directly calculate a approximate result, thus being a bit faster but giving a less correct approximate indication (“sin(pi/2)” return approximately one instead of exactly one). If the interval arithmetic mode is activated the precision of the final result is guaranteed by calculating an interval for every approximate value (See the section called “Interval Arithmetic”).
This controls the default assumptions for unknown variables without explicitly defined assumptions. See Chapter 5, Variables. The assume denominators non-zero alternative makes it possible to avoid the situation where expressions such as “(x-1)/(x-1)” can not be further simplified because the denominator might be zero (if x equals 1). With this alternative activated the example can be reduced to 1.
These options controls how expressions are interpreted. There are three main modes, which mainly controls if implicit multiplication is handled differently from explicit multiplication and if spaces are taken into account or not. See the section called “Implicit Multiplication and Parsing Modes”. If the read precsion option is activated, decimal numbers are intrepeted as approximate with precision equal to the number of digits (e.g. “1.1 * 1.1 ≈ 1.2”). If interval arithmetic is enabled, decimal numbers are interpreted as an interval between the numbers that are normally rounded to the entered number (e.g. “1.1 = 1.1±0.05”).
Precision controls the precision in approximate numbers and the number of significant digits. If the read precision option is turned on, input numbers with decimals will be interpreted as approximate with a precision equal to the number of digits (e.g. “2.50 + 3.4567 = 5.96”).
In the decimals dialog, the number of decimals displayed can be controlled. This includes minimal (will fill out with zeroes) and maximal number of decimals (will round numbers).
Interval arithmetic can be used explicitly to perform calculations on an interval (defined using the interval() function or “±” notation), or implicitly for all approximate calculations to keep track of precision changes. The latter is especially useful for calculation using numbers with few implicit digits, in combination with the “read precision” mode, for calculation with approximate physical constants, which are defined as an interval using standard uncertainty values (if interval arithmetic is activated), or to gracefully handle for example catastrophic cancellation (in subtracting two nearly equal numbers). Interval arithmetic can be (de)activated using + → or from the corresponding menu on the keypad.
The main issue with interval arithmetic is handling of dependent values. The simple expression “2 * interval(1, 2) - pi * interval(1, 2)” gives as result “interval(-4.283, 0.858)”, which is correct if the two intervals in the expression are unrelated. If they on the instead refers to the same measurement the true result should be “-interval(1.141, 2.283)”, but Qalculate! has no way of knowing this. There are some ways the circumvent this issue “interval(1, 2) * (2 - pi)” returns the correct interval. Qalculate! is in most cases able to handle this automatically with variables and function arguments for most differentiable functions.
Some non-invertible functions (including bessel and airy functions) are not properly support and only the function value for the end values of the interval are calculated. Trigonometric functions should however give correct intervals for real and imaginary numbers, but will in some cases for complex numbers with both a real and imaginary part return a too wide interval.
Generally, the resulting interval will be guaranteed to include the true interval, but may often for non-trivial expression (especially involving complex numbers) return an interval that is to wide.
For implicit interval arithmetic the result is by default shown as an ordinary number with the number of significant digits determined by the width of the interval(“interval(2.075, 2.15) = 2.1”), unless the interval is too wide. If the interval() has been used in the expression the result is by default displayed as an interval, and if “±” notation has been used, it will also be used in the result. The default behaviour can be changed from + . The midpoint alternative displays the value halfway between the lower and upper limit of the interval (“interval(2.075, 2.15) = 2.1125”). Note that, for the plus/minus notation, the same midpoint (not the result for the midpoint of intervals in the expression) is displayed in front of the plus/minus symbol.
The Reverse Polish Notation mode can be activated from Ctrl+R or from the context menu of the expression entry. For details about what Reverse Polish Notation is and how it generally works, see for example the RPN article at Wikipedia.
→ ,Central to the RPN mode is the stack, a list of registers/values that is operated on by functions and operators. The stack has a variable number of registers which can hold an unlimited number of values. The stack size is dynamically changed when a new value is added and the first value on the stack is shown in the result display. Mathematical operators such as plus and minus then operates on the first two, last added, values on the stack. The second value is changed with input from the first value. For example, the minus operator subtracts the first value from the second.
For example, 5 ENTER 3 + 2 / adds 5 to the stack, then adds 3 to the stack and moves 5 down a step and adds 3 to 5. The first value, 3, is removed from the stack and the value left is 8. Then 2 is added to the stack and 8 is divided by 2, resulting in 4. This would in a single expression with non-RPN (infix) syntax be entered as “(5+3)/2”.
Functions operate on the top values of the stack. Functions which require multiply arguments, fill the arguments in reversed order from the top (e.g. 5 ENTER 2 ENTER rem equals “rem(5, 2)”). Functions with a vector argument uses all stack regsters (unless the top value is a vector). This is quite useful for statistical functions (e.g. 5 ENTER 2 ENTER 3 ENTER 4 ENTER harmmean calculates the harmonic mean of 5, 2, 3, and 4 and leaves the result, 3.1169, as the only value on the stack).
When the RPN stack is enabled, full expressions can still be entered (you can add e.g. “5x+3+23+sin(2)” directly to the stack). The buttons on the keypad do not insert operators and functions in the expression entry, but instead applies them to the stack. This is also true for the keys on the keyboard, unless deactivated in the preferences ( → ). Enter calculates the current expressions and adds it to the stack (calculated mathematical expressions are automatically added to the stack when the RPN stack is enabled). If the expression entry is not empty when applying an operator or function to the stack, the expression is first calculated and added to the stack. All keys on the main part of the keyboard add the corresponding characters in the expression entry, unless the Use only keypad keys for RPN option is deactivated from the preferences dialog. To apply the raise operator '^' to the stack, without clicking the keypad button with the mouse, use the Ctrl+* (keypad) shortcut. If the expression only contains an operator or a single function without arguments, the operator/function is applied to the stack.
The RPN mode adds a third page to the main window, for display and manipulation of the values on the stack. This shows a list of values on the stack, with the last added value on the top. On the right are buttons for manipulation of the stack. The buttons move the selected value up or down, move it to the top, edit it, or removes it, in order. If no stack row is selected, the up and down buttons rotates the stack, the swap button swaps the places of the first and second value and the copy and delete buttons acts on the the top value of the stack. The last button removes all values from the stack. On the left are buttons for applying mathematical operations to the stack. These works the same as buttons on the separate keypad. Changes in the display of results only affects the first value on the stack.
Reverse Polish Notation can also be used directly in expression. This can be activated or deactivated separately from the RPN stack (“(5+3)/2”, as in the example above, with RPN syntax you should enter the expression “5 3 + 2 /”. Instead of actually pressing enter on the keyboard, each separate value on the stack is separated by a blank space. The RPN syntax only supports functions that require exactly one argument.
→ → ). When using RPN syntax, a temporary stack, separate from the previously mentioned stack, is created from the contents of each mathematical expression entered. To calculate