<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
  <!ENTITY legal SYSTEM "legal.xml">
  <!ENTITY appversion "5.5.0">
  <!ENTITY manrevision "5.5.0">
  <!ENTITY date "January 2025">
  <!ENTITY app "Qalculate!">
  <!ENTITY appendixa SYSTEM "appendixa.xml">
  <!ENTITY appendixb SYSTEM "appendixb.xml">
  <!ENTITY appendixc SYSTEM "appendixc.xml">
  <!ENTITY examples SYSTEM "examples.xml">
]>
<book id="index" lang="en">
<title>&app; Manual v&manrevision;</title>
<bookinfo>
	<copyright>
		<year>2005-2007, 2016-2025</year>
		<holder>Hanna Knutsson</holder>
	</copyright>
	<publisher> 
		<publishername>Hanna Knutsson</publishername> 
	</publisher> 
	<authorgroup>
		<author>
			<firstname>Hanna</firstname>
			<surname>Knutsson</surname>
		</author>
	</authorgroup>

	<releaseinfo>This manual describes version &appversion; of &app;.
	</releaseinfo> 
	<legalnotice> 
		<title>Feedback</title> 
		<para>
			To report a bug or make a suggestion regarding the &app; application or this manual create a new issue at <ulink url="https://github.com/Qalculate/qalculate-gtk/issues"/>.
		</para>
	</legalnotice> 
	
</bookinfo>

<chapter id="qalculate-introduction">
<title>Introduction</title>
<para>
&app; is a powerful and highly flexible desktop calculator, but with a comparably simple and minimal user interface.
</para>
<para>
The center of attention in &app; is the expression entry. Just enter a mathematical expression as you would write it on paper, press <keycap>Enter</keycap>,  et voilà!
</para>
<para>
The interpretation of mathematical expressions is flexible and fault tolerant. If you nevertheless enter an expression which is not entirely recognized or is considered ambiguous, &app; will provide an informative, but unobtrusive, error or warning. If an expression cannot be fully solved, &app; will simplify it as far as it can and answer with an expression.
</para>
<para>
In addition to numbers and arithmetic operators, expressions may contain any combination of variables, units, and functions. These are immediately accessible from the user interface — through automatic completion, or using the menu bar, the object managers, or the calculator keypad.
</para>
<para>
&app; also provides some specific tools for your convenience, such as a number base conversion dialog and a simple plotting interface.
</para>
<para>
Although use of &app; for simple calculations should be natural and self-explanatory, reading the rest of the manual can help you maximize your productivity and discover some maybe unexpected features. More advanced users should read on and discover a large number of customization options and the ability to create and modify your own variables, functions and units directly from the user interface.
</para>
</chapter>

<chapter id="qalculate-qt">
<title>Differences in the <quote>new</quote> Qt user interface</title>
<para>
This manual describes the <quote>classic</quote> GTK version of &app;. Most of it (particularly from chapter 4 and forward) also applies to the <quote>new</quote> Qt version. There are however some significant differences, particularly in the layout of the main window.
</para>
<para>
In the QT interface the current result is only shown in the history, which is always present below the expression entry. The current result is emphasized with a larger font size, compared to previous results. By default only the parsed expression, and not the entered expression, is displayed in the history.
</para>
<para>
How the currently edited expression is parsed is either displayed directly in the history or in a tooltip next to the text cursor, instead of below the expression entry. The current result of the expression (calculate-as-you-type) is also displayed in the same way (with a slight delay by default).
</para>
<para>
The keypad is hidden by default, but can be shown using the second button from the right (the last of the left aligned buttons).
</para>
<para>
Calculator mode options are changed in the menu opened using the top-left button (above the expression entry). Some settings have been moved to the preferences dialog.
</para>
<para>
Conversion (including unit conversion) are primarily applied to the current result or expression using the second button from the left.
</para>
<para>
The contents of the file menu and some of the edit menu in the GTK interface have been moved to the menu accessed using the top-right <quote>hamburger</quote> button.
</para>
</chapter>

<chapter id="qalculate-user-interface">
<title>User Interface</title>
<sect1 id="qalculate-main-window">
<title>Main Window</title>
<figure id="qalculate-FIG-main-window">
	<title>Main Window</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/mainwindow.png" format="PNG" width="809"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
The main window provides a menu bar, the expression entry, the result display and a calculator keypad, history and conversion view (see <xref linkend="qalculate-unit-conversion"/>) which can be shown/hidden by clicking on <guilabel>Keypad</guilabel>, <guilabel>History</guilabel> and <guilabel>Conversion</guilabel>, respectively. When non-default options for the interpretation of expressions have been selected, the choice will be indicated in a small status area below the expression entry, to the right (click to change these choices).
</para>
</sect1>
<sect1 id="qalculate-expression-entry">
<title>Expression Entry</title>
<para>
The expression entry is the most important part of the &app; user interface. The normal calculation procedure in &app; is to type in a mathematical expression (e.g. <quote>5 + 5</quote>) and press <keycap>Enter</keycap> (or click <guibutton>=</guibutton>). The result (<quote>10</quote>) is then displayed below the expression entry in the result display.
</para>
<para>
The icon in the upper right corner of the expression entry changes function depending on the current status. While editing the expression an equals sign is shown. When the icon is clicked the expression will be calculated. If this results in an error or a warning, the corresponding icon will be displayed instead, and if this is clicked, or if the pointer is placed over it, the error/warning text will be shown. If no error or warning is triggered, activation of the icon will instead clear the expression entry. No icon is shown when the expression is empty.
</para>
<figure id="qalculate-FIG-completion">
	<title>Completion</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/completion.png" format="PNG" width="445"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
&app; helps out with the expression by giving a list of possible endings to words representing functions, variables and units. Titles, and countries for currencies, will also be searched, but any matches will be placed at the end of the list. The list will narrow with each letter typed. Select an item in the list and the name will be completed. If a function was selected, parenthesis will be added and the position moved for immediate entry of arguments. Completion can be configured from the context menu, or in more detail, from the preferences dialog.
</para>
<para>
As the expression is typed in, the area directly below the expression entry, to the left, will show useful information. By default the calculator's interpretation of the expression is shown (e.g. <quote>5 × meter</quote> for <quote>5m</quote>). The interpretation will be displayed in red (configurable) if there are errors in the expression or in blue for lesser errors (for example too many arguments in a function). If the last typed-in text represents a function and arguments are about to be entered, the function's name and its arguments will be displayed. The first argument in the information text is highlighted and includes information about its type and restrictions and when an argument has been entered, the next will be highlighted.
</para>
<para>
After execution of an expression, the whole expression will be marked. This normally means that if something new is entered, the old expression will be overwritten. If, however, an operator (+, −, ×, /, ^) is entered first, the old expression will instead be the target of action. The operator will then apply to the whole expression, which is put in parenthesis. This works on all marked ranges, meaning that this way an expression can conveniently be put in parenthesis. Functions set the selection as their first argument.
</para>
<para>
The <keycap>Page Up</keycap> and <keycap>Page Down</keycap> keys will access previously entered expressions. With focus in the expression entry, <keycap>Page Up</keycap> traverses backwards in the expression history and <keycap>Page Down</keycap> forward. The <keycap>Up</keycap> and <keycap>Down</keycap> can also be used for the same purpose when the completion list is not shown.
</para>
<para>
Although the expression entry can display multiple lines of text, the <keycap>Enter</keycap> key does not insert a line feed. New lines are automatically created when needed.
</para>
<para>
The expression entry also accepts commands, preceded be <quote>/</quote>. These commands are the same as in the command line program, qalc.
</para>
<para>
The font used for the expression entry can be selected in the preferences dialog (<menuchoice><guimenu>Edit</guimenu><guimenuitem>Preferences</guimenuitem></menuchoice>).
</para>
<para>
Right-click in the expression entry to open a context menu, with general text editing options as well as selection of parsing modes (including number base), and menu items which open dialogs for insertion of vectors, matrices, or dates.
</para>
</sect1>
<sect1 id="qalculate-result-display">
<title>Result Display</title>
<para>
The result of calculations is displayed in the open area below the expression entry. The font used for the result display can be selected in the preferences dialog (<menuchoice><guimenu>Edit</guimenu><guimenuitem>Preferences</guimenuitem></menuchoice>). Use of Unicode signs can be turned off in the same dialog. Otherwise &app; will try to make the result as fancy as possible and print π for pi, √ for sqrt, € for euro, and so on. Information about customization of the mathematical result output is available in <xref linkend="qalculate-mode"/>.
</para>
<para>
In front of the result an equals or approximately equals sign is shown. This indicates whether &app; was able to calculate/display the result exact or only approximate, in the current mode.
</para>
<para>
The result display has a context menu, which pops up when clicking with the right button anywhere in the field. This menu provides a subset of the display alternatives from the mode menu (<xref linkend="qalculate-TBL-mode-menu"/>) and some actions from the edit menu (<xref linkend="qalculate-TBL-edit-menu"/>). See more info in <xref linkend="qalculate-mode"/>.
</para>
<para>
If you hold the pointer over the result area a tooltip will show the text representation of the result. To make it more obvious what the result means, abbreviations and implicit multiplication are not used here, and excessive parentheses are shown.
</para>
<para>
To copy the result, either select <menuchoice><guimenu>Edit</guimenu><guimenuitem>Copy Result</guimenuitem></menuchoice>, press <keycombo><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>C</keycap></keycombo>, or copy the text from the history window.
</para>
</sect1>
<sect1 id="qalculate-calculator-buttons">
<title>Keypad</title>
<para>
The keypad provides access to a simple traditional number pad and as well as more advanced functionality.
<figure id="qalculate-FIG-calculator-buttons">
	<title>Keypad</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/calculator-buttons.png" format="PNG" width="818"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
</para>
<para>
Click on the padlock icon to enable/disable persistent keypad, which makes it possible to display the keypad and the history simultaneously (the keypad view will be independent of the other views).
</para>
<para>
The top buttons (from left to right) switches between the general keypad and the programming keypad (affects the buttons on the left side, see <xref linkend="qalculate-TBL-programming-keypad"/>), switches between exact and approximate calculation, changes rational number form, selects display mode and selects number base in result (see <xref linkend="qalculate-mode"/>).
</para>
<para>
The buttons below are separated in two areas. The buttons on the right inserts basic numbers and operators, while most of the buttons to the left inserts or applies mathematical functions to the expression. All buttons on the left is paired with buttons, with downward arrows, that opens a menu with related functionality (generally more mathematical functions).
</para>
<para>
Most of buttons to the right will do something different depending on which button on the pointing device (mouse) that is clicked (for details see the table below; all actions are displayed as tooltips when holding the pointer over a button). Button press and hold on a button (for approximately half a second) will generally perform the same action as right-click. Right-click or long press on the buttons to the left will open the associated menu.
</para>
<para>
Selected/marked text in the expression entry is handled in different ways depending on the type of keypad button used. Numbers, variables and units will replace the selected text.
</para>
<para>
Operators will be placed after any selected text (except bitwise and logical NOT which is placed in front of the selection), which is put in parentheses. This, together with the fact that recently calculated expressions are automatically selected in the entry, means that if you click 5, 9, +, 2, =, × and 2 in order, the result expression is <quote>(59 + 2) × 2</quote>. In RPN mode the operators acts on the top two registers in the stack.
</para>
<para>
The mathematical functions accessed using keypad buttons (and menus) behave differently depending on the current edited expression. If the cursor is at the end of the expression and there is no operator or parenthesis immediately to left of the cursor (at the end of expression), the whole expression is used as function argument and the expression is immediately calculated using the function (if you type <quote>5 + 2</quote> and then click <guibutton>sin</guibutton>, <quote>sin(5 + 2)</quote> will be calculated). If text in the expression is selected, the selection will be used as the function argument. If the whole expression was selected the resulting expression will immediately be calculated. Functions that requires more than one argument do not follow these rules and in many cases opens a separate dialog for argument input. In RPN mode the function will always be applied to the register(s) at the top of stack, if the current expression is empty and there are enough registers for functions that require more one argument.
</para>
<para>
All actions and labels of the buttons on the right can be customized using <menuchoice><guimenu>Edit</guimenu><guimenuitem>Customize Keypad Buttons</guimenuitem></menuchoice> (it is also possible to add additional columns of buttons). The default buttons, and associated actions, are listed below.
<table id="qalculate-TBL-keypad-right" frame="topbot" colsep="1">
	<title>Right Keypad</title> 
	<tgroup cols="2" colsep="1" rowsep="0">
		<colspec colname="COLSPEC0" align="center" colwidth="10%"/>
		<colspec colname="COLSPEC1"/>
		<colspec colname="COLSPEC2"/>
		<colspec colname="COLSPEC3"/>
		<thead>
			<row valign="top">
				<entry colname="COLSPEC0"><para>Button</para></entry>
				<entry colname="COLSPEC1"><para>Left-click (button 1)</para></entry>
				<entry colname="COLSPEC2"><para>Right-click (button 3) or long press</para></entry>
				<entry colname="COLSPEC3"><para>Middle-click (button 2)</para></entry>
			</row>
		</thead> 
		<tbody>
			<row valign="top">
				<entry><para>=</para></entry>
				<entry><para>Calculates the current expression</para></entry>
				<entry><para>MR (memory recall)</para></entry>
				<entry><para>MS (memory store)</para></entry>
			</row>
			<row valign="top">
				<entry><para>ANS</para></entry>
				<entry><para>Variable for last calculated value (dynamic)</para></entry>
				<entry><para><command>answer()</command> function (fixed)</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>DEL</para></entry>
				<entry><para>Delete</para></entry>
				<entry><para>Backspace</para></entry>
				<entry><para>M− (memory minus)</para></entry>
			</row>
			<row valign="top">
				<entry><para>AC</para></entry>
				<entry><para>Clears the expression</para></entry>
				<entry><para>MC (memory clear)</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>+</para></entry>
				<entry><para>Addition operator</para></entry>
				<entry><para>M+ (memory plus)</para></entry>
				<entry><para>Bitwise AND operator (&amp;)</para></entry>
			</row>
			<row valign="top">
				<entry><para>−</para></entry>
				<entry><para>Subtraction operator</para></entry>
				<entry><para>Negate</para></entry>
				<entry><para>Bitwise OR operator (|)</para></entry>
			</row>
			<row valign="top">
				<entry><para>×</para></entry>
				<entry><para>Multiplication operator.</para></entry>
				<entry><para>Bitwise exclusive OR operator (XOR)</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>/</para></entry>
				<entry><para>Division operator.</para></entry>
				<entry><para>Reciprocal (inv() function)</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>x<superscript>y</superscript></para></entry>
				<entry><para>Exponentiation operator (^)</para></entry>
				<entry><para>Square root function (√)</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>0</para></entry>
				<entry><para>0</para></entry>
				<entry><para>⁰ (^0)</para></entry>
				<entry><para>° (degree)</para></entry>
			</row>
			<row valign="top">
				<entry><para>1</para></entry>
				<entry><para>1</para></entry>
				<entry><para>¹ (^1)</para></entry>
				<entry><para>Reciprocal (<command>inv()</command> function)</para></entry>
			</row>
			<row valign="top">
				<entry><para>2</para></entry>
				<entry><para>2</para></entry>
				<entry><para>² (^2)</para></entry>
				<entry><para>½ (1/2)</para></entry>
			</row>
			<row valign="top">
				<entry><para>3</para></entry>
				<entry><para>3</para></entry>
				<entry><para>³ (^3)</para></entry>
				<entry><para>⅓ (1/3)</para></entry>
			</row>
			<row valign="top">
				<entry><para>4</para></entry>
				<entry><para>4</para></entry>
				<entry><para>⁴ (^4)</para></entry>
				<entry><para>¼ (1/4)</para></entry>
			</row>
			<row valign="top">
				<entry><para>5</para></entry>
				<entry><para>5</para></entry>
				<entry><para>⁵ (^5)</para></entry>
				<entry><para>⅕ (1/5)</para></entry>
			</row>
			<row valign="top">
				<entry><para>6</para></entry>
				<entry><para>6</para></entry>
				<entry><para>⁶ (^6)</para></entry>
				<entry><para>⅙ (1/6)</para></entry>
			</row>
			<row valign="top">
				<entry><para>7</para></entry>
				<entry><para>7</para></entry>
				<entry><para>⁷ (^7)</para></entry>
				<entry><para>⅐ (1/7)</para></entry>
			</row>
			<row valign="top">
				<entry><para>8</para></entry>
				<entry><para>8</para></entry>
				<entry><para>⁸ (^8)</para></entry>
				<entry><para>⅛ (1/8)</para></entry>
			</row>
			<row valign="top">
				<entry><para>9</para></entry>
				<entry><para>9</para></entry>
				<entry><para>⁹ (^9)</para></entry>
				<entry><para>⅑ (1/9)</para></entry>
			</row>
			<row valign="top">
				<entry><para>. or ,</para></entry>
				<entry><para>Decimal point</para></entry>
				<entry><para>Blank space</para></entry>
				<entry><para>New line</para></entry>
			</row>
			<row valign="top">
				<entry><para>EXP</para></entry>
				<entry><para>E or e (shorthand for 10<superscript>x</superscript>)</para></entry>
				<entry><para>Exponential function</para></entry>
				<entry><para><command>exp10()</command> function</para></entry>
			</row>
			<row valign="top">
				<entry><para>)</para></entry>
				<entry><para>Right parenthesis.</para></entry>
				<entry><para>Right bracket (]) for vectors and matrices</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>(</para></entry>
				<entry><para>Left parenthesis.</para></entry>
				<entry><para>Left bracket ([) for vectors and matrices</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>(x)</para></entry>
				<entry><para>Smart parentheses</para></entry>
				<entry><para>[] around selection</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>, or ;</para></entry>
				<entry><para>Argument/vector separator</para></entry>
				<entry><para>Blank space</para></entry>
				<entry><para>New line</para></entry>
			</row>
			<row valign="top">
				<entry><para>±</para></entry>
				<entry><para>Interval/uncertainty operator</para></entry>
				<entry><para>Uncertainty function (relative error)</para></entry>
				<entry><para>Interval function</para></entry>
			</row>
			<row valign="top">
				<entry><para>%</para></entry>
				<entry><para>Percent (or modulus operator)</para></entry>
				<entry><para>Per mille</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>Left and right arrows</para></entry>
				<entry><para>Move cursor one character</para></entry>
				<entry><para>Move cursor to beginning or end</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>Up and down arrows</para></entry>
				<entry><para>Cycle through expression history</para></entry>
				<entry><para>-</para></entry>
				<entry><para>-</para></entry>
			</row>
		</tbody>
	</tgroup>
</table>
</para>
<para>
<guibutton>DEL</guibutton> deletes one character to the right or, if the cursor is at the end of the expression, to the left of the cursor (right-click always deletes the character to the left of the cursor). Long press on the button will continuously delete.
</para>
<para>
<guibutton>EXP</guibutton> inserts the shorthand notation (E or e) for ten raised to the power of x. This only applies to digits (<quote>2E6</quote> equals <quote>2 × 10^6</quote>, <quote>xEy &ne; x × 10^y</quote>). If whole or part of the current expression is selected, <quote>×10^</quote> will instead be inserted after the wrapped selection. If current input base is not 10, than the selected number base will be used as base (e.g. <quote>×16^</quote> for hexadecimal input).
</para>
<para>
<guibutton>ANS</guibutton> inserts the first answer variable. This variable always contains the last calculated result. This will be updated after each calculation (unlike when using the answer() function with a positive argument).
</para>
<para>
The <quote>(x)</quote> button (<keycombo><keycap>Ctrl</keycap><keycap>(</keycap></keycombo>) places opening and closing parentheses around the selected text in the expression entry. If no text is selected either the expression to the right of the cursor (if the cursor is at the beginning of the expression or if there is an operator or left parenthesis to the left of the cursor) or to the left of the cursor is put inside parentheses. If the expression is empty, as well as in some other cases (to avoid broken expression), empty parentheses are inserted.
</para>
<para>
The arrow buttons works a bit differently than the other. The direction of the action will depend on which half of the button that is pressed (the right side of the button, with the arrow pointing to the right, will move the insert cursor when step forward). Long press on the button will continuously move the cursor (or continuously cycle through the expression history).
</para>
<para>
The characters used as decimal point and argument separator varies between different locales. The argument separator is used for separation of arguments to functions that takes more than one argument.
</para>
<para>
Below follows a list of the buttons on the left side (including their menus and associated actions), from left the right, top to bottom.
<table id="qalculate-TBL-keypad-left" frame="topbot" colsep="1">
	<title>Left Keypad</title> 
	<tgroup cols="2" colsep="1" rowsep="0">
		<colspec colname="COLSPEC0" align="center" colwidth="10%"/>
		<colspec colname="COLSPEC1"/>
		<colspec colname="COLSPEC2"/>
		<thead>
			<row valign="top">
				<entry colname="COLSPEC0"><para>Button</para></entry>
				<entry colname="COLSPEC1"><para>Action</para></entry>
				<entry colname="COLSPEC2"><para>Menu</para></entry>
			</row>
		</thead> 
                <tbody>
			<row valign="top">
				<entry><para>STO</para></entry>
				<entry><para>Stores the current result in a variable. See <xref linkend="qalculate-variable-creation"/></para></entry>
				<entry><para>A list of created variables. Left click to insert the variable. Right click for the option to edit or delete the variable, or store the current result in the variable.</para></entry>
			</row>
			<row valign="top">
				<entry><para>f(x)</para></entry>
				<entry><para>Creates a new function. See <xref linkend="qalculate-function-creation"/>.</para></entry>
				<entry><para>Created and recently used (accessed from this menu, the menubar or the function manager) functions. The last item opens the function manager.</para></entry>
			</row>
			<row valign="top">
				<entry><para>0xff</para></entry>
				<entry><para>Opens the convert number bases dialog.</para></entry>
				<entry><para>Bitwise operators</para></entry>
			</row>
			<row valign="top">
				<entry><para>a(x)<superscript>b</superscript></para></entry>
				<entry><para>Factorizes the result (or the current expression).</para></entry>
				<entry><para>Expansion of polynomials and expansion of partial fractions, integration and differentiation</para></entry>
			</row>
			<row valign="top">
				<entry><para>x!</para></entry>
				<entry><para>Factorial (e.g. <quote>5!=factorial(5)=5×4×3×2×1=120</quote>)</para></entry>
				<entry><para>Other factorial functions and functions related to combinatorics</para></entry>
			</row>
			<row valign="top">
				<entry><para>ln</para></entry>
				<entry><para>Natural logarithm function</para></entry>
				<entry><para>Other logarithmic functions</para></entry>
			</row>
			<row valign="top">
				<entry><para>&radic;</para></entry>
				<entry><para>Square root function</para></entry>
				<entry><para>Other root functions</para></entry>
			</row>
			<row valign="top">
				<entry><para>e</para></entry>
				<entry><para>The base of natural logarithms</para></entry>
				<entry><para>Exponential and complex exponential functions</para></entry>
			</row>
			<row valign="top">
				<entry><para>mod</para></entry>
				<entry><para>Modulus operator/function</para></entry>
				<entry><para><command>rem()</command>, <command>abs()</command>, <command>gcd()</command> and <command>lcm()</command> functions</para></entry>
			</row>
			<row valign="top">
				<entry><para>x&#772;</para></entry>
				<entry><para>Statistical mean function</para></entry>
				<entry><para>A selection of statistical functions, and <command>rand()</command> for random number generation</para></entry>
			</row>
			<row valign="top">
				<entry><para>&Sigma;</para></entry>
				<entry><para>Summation function</para></entry>
				<entry><para>&Pi;, <command>for()</command> and <command>if()</command> functions</para></entry>
			</row>
			<row valign="top">
				<entry><para>π</para></entry>
				<entry><para>Archimedes' constant (pi)</para></entry>
				<entry><para>Pythagoras, Euler's and golden ratio constants, and recently used variables/constants (accessed from this menu, the menubar or the variable manager) and/or a selection of physical constants. The last item opens the variable manager.</para></entry>
			</row>
			<row valign="top">
				<entry><para>sin</para></entry>
				<entry><para>Sine function</para></entry>
				<entry><para><command>sinh()</command>, <command>asin()</command> and <command>asinh()</command> functions, and angle unit selection</para></entry>
			</row>
			<row valign="top">
				<entry><para>cos</para></entry>
				<entry><para>Cosine function</para></entry>
				<entry><para><command>cosh()</command>, <command>acos()</command> and <command>acosh()</command> functions, and angle unit selection</para></entry>
			</row>
			<row valign="top">
				<entry><para>tan</para></entry>
				<entry><para>Tangent function</para></entry>
				<entry><para><command>tanh()</command>, <command>atan()</command> and <command>atanh()</command> functions, and angle unit selection</para></entry>
			</row>
			<row valign="top">
				<entry><para>i</para></entry>
				<entry><para>Imaginary unit (i<superscript>2</superscript> = −1) i</para></entry>
				<entry><para>Complex number functions</para></entry>
			</row>
			<row valign="top">
				<entry><para>z</para></entry>
				<entry><para>Unknown variable <emphasis>z</emphasis></para></entry>
				<entry><para>Assumptions for the <emphasis>z</emphasis> variable</para></entry>
			</row>
			<row valign="top">
				<entry><para>y</para></entry>
				<entry><para>Unknown variable <emphasis>y</emphasis></para></entry>
				<entry><para>Assumptions for the <emphasis>y</emphasis> variable</para></entry>
			</row>
			<row valign="top">
				<entry><para>x</para></entry>
				<entry><para>Unknown variable <emphasis>x</emphasis></para></entry>
				<entry><para>Assumptions for the <emphasis>x</emphasis> variable</para></entry>
			</row>
			<row valign="top">
				<entry><para>x =</para></entry>
				<entry><para>Equals operator (primarily used in equations)</para></entry>
				<entry><para>Equation solving related functions, and replacement of unknowns in the current result</para></entry>
			</row>
			<row valign="top">
				<entry><para>u</para></entry>
				<entry><para>Opens the unit manager</para></entry>
				<entry><para>Recently used units and/or a selection of common units, and a selection of prefixes</para></entry>
			</row>
			<row valign="top">
				<entry><para>kg</para></entry>
				<entry><para>Most recently used unit from the associated menu, or kilogram</para></entry>
				<entry><para>All SI base units and SI derived units with special names and symbols, plus litre</para></entry>
			</row>
			<row valign="top">
				<entry><para>&euro; (or local currency)</para></entry>
				<entry><para>Most recently used unit from the associated menu, or euro/local currency</para></entry>
				<entry><para>All current currency units (excludes currencies replaced by euro)</para></entry>
			</row>
			<row valign="top">
				<entry><para>x ➞</para></entry>
				<entry><para>Convert to operator (selection is unselected). The expression before right arrow or <quote>to</quote> (or the previous result if the expressions begins with <quote>to</quote>) is converted to the unit expression after <quote>to</quote>. See <xref linkend="qalculate-to"/>.</para></entry>
				<entry><para>Convert to base units, optimal unit, or optimal prefix. Below is a list of appropriate units (with common units appended) to convert the current result to. If the result does not include any units options to convert the result to different number bases, fraction and factors appear. The current expression (if modified) is calculated when the menu is opened.</para></entry>
			</row>
		</tbody>
	</tgroup>
</table>
</para>
<para>
<figure id="qalculate-FIG-programming-keypad">
	<title>Programming keypad</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/programming-keypad.png" format="PNG" width="617"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
The buttons on the left side can be replaced (using the top left button or <keycombo><keycap>Ctrl</keycap><keycap>P</keycap></keycombo>) by a set of buttons for quick access to functions particularly useful for programmers. In place of the menus over the keypad, the current result will be shown in binary, octal, decimal and hexadecimal number bases. The buttons are listed below, from left to right, top to bottom.
<table id="qalculate-TBL-programming-keypad" frame="topbot" colsep="1">
	<title>Programming Keypad</title> 
	<tgroup cols="2" colsep="1" rowsep="0">
		<colspec colname="COLSPEC0" align="center" colwidth="10%"/>
		<colspec colname="COLSPEC1"/>
		<colspec colname="COLSPEC2"/>
		<thead>
			<row valign="top">
				<entry colname="COLSPEC0"><para>Button</para></entry>
				<entry colname="COLSPEC1"><para>Left-click</para></entry>
				<entry colname="COLSPEC1"><para>Right-click or long press</para></entry>
			</row>
		</thead> 
		<tbody>
			<row valign="top">
				<entry><para>BIN</para></entry>
				<entry><para>Switches to binary number base for expressions and result display.</para></entry>
				<entry><para>Toggles binary number base for result display on/off.</para></entry>
			</row>
			<row valign="top">
				<entry><para>OCT</para></entry>
				<entry><para>Switches to octal number base for expressions and result display.</para></entry>
				<entry><para>Toggles octal number base for result display on/off.</para></entry>
			</row>
			<row valign="top">
				<entry><para>DEC</para></entry>
				<entry><para>Switches to decimal number base for expressions and result display.</para></entry>
				<entry><para>Toggles decimal number base for result display on/off.</para></entry>
			</row>
			<row valign="top">
				<entry><para>HEX</para></entry>
				<entry><para>Switches to hexadecimal number base for expressions and result display.</para></entry>
				<entry><para>Toggles hexadecimal number base for result display on/off.</para></entry>
			</row>
			<row valign="top">
				<entry><para>2→</para></entry>
				<entry><para>Toggles two's complement representation on/off for input of negative numbers.</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>→2</para></entry>
				<entry><para>Toggles two's complement representation on/off for display of negative numbers.</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>A</para></entry>
				<entry><para>Hexadecimal digit</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>B</para></entry>
				<entry><para>Hexadecimal digit</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>C</para></entry>
				<entry><para>Hexadecimal digit</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>D</para></entry>
				<entry><para>Hexadecimal digit</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>E</para></entry>
				<entry><para>Hexadecimal digit</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>F</para></entry>
				<entry><para>Hexadecimal digit</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>AND</para></entry>
				<entry><para>Bitwise AND operator (&amp;)</para></entry>
				<entry><para>Logical AND operator (&amp;&amp;)</para></entry>
			</row>
			<row valign="top">
				<entry><para>OR</para></entry>
				<entry><para>Bitwise OR operator (|)</para></entry>
				<entry><para>Logical OR operator (||)</para></entry>
			</row>
			<row valign="top">
				<entry><para>XOR</para></entry>
				<entry><para>Bitwise exclusive OR operator (xor)</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>NOT</para></entry>
				<entry><para>Bitwise NOT operator (~)</para></entry>
				<entry><para>Logical NOT operator (!)</para></entry>
			</row>
			<row valign="top">
				<entry><para>&lt;&lt;</para></entry>
				<entry><para>Bitwise left shift operator</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>&gt;&gt;</para></entry>
				<entry><para>Bitwise right shift operator</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>cmp</para></entry>
				<entry><para>Bitwise complement (NOT) function (specify bit width and signedness)</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>rot</para></entry>
				<entry><para>Bitwise rotation function</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>mod</para></entry>
				<entry><para>Modulus operator</para></entry>
				<entry><para>Remainder operator</para></entry>
			</row>
			<row valign="top">
				<entry><para>div</para></entry>
				<entry><para>Integer division operator</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>int</para></entry>
				<entry><para>Integer part function (<quote>int(-5.2) = -5</quote>)</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>frac</para></entry>
				<entry><para>Fractional part function (<quote>frac(-5.2) = -0.2</quote>)</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>x<superscript>-1</superscript></para></entry>
				<entry><para>Reciprocal (1/x) function</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>|x|</para></entry>
				<entry><para>Absolute value function (<quote>abs(-5) = 5</quote>)</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>√</para></entry>
				<entry><para>Square root function</para></entry>
				<entry><para>Cube root function</para></entry>
			</row>
			<row valign="top">
				<entry><para>ln</para></entry>
				<entry><para>Natural logarithm function</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>log<subscript>2</subscript></para></entry>
				<entry><para>Base-2 logarithm function</para></entry>
				<entry><para>Base-10 logarithm function</para></entry>
			</row>
			<row valign="top">
				<entry><para>exp</para></entry>
				<entry><para>Exponential function (e<superscript>x</superscript>)</para></entry>
				<entry><para>Base-2 exponential function (2<superscript>x</superscript>)</para></entry>
			</row>
			<row valign="top">
				<entry><para>x!</para></entry>
				<entry><para>Factorial (e.g. <quote>5!=factorial(5)=5×4×3×2×1=120</quote>)</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>a×b</para></entry>
				<entry><para>(Integer) factorizes the result (or the current expression).</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>fp</para></entry>
				<entry><para>Opens a window for conversion between decimal values and floating point formats.</para></entry>
				<entry><para>-</para></entry>
			</row>
			<row valign="top">
				<entry><para>a→1</para></entry>
				<entry><para><command>code()</command> function (returns numeric code of Unicode character)</para></entry>
				<entry><para><command>char()</command> function (for conversion of numeric code to Unicode character)</para></entry>
			</row>
			<row valign="top">
				<entry><para>u→d</para></entry>
				<entry><para>Function for conversion of Unix timestamp to date and time</para></entry>
				<entry><para>Function for conversion of date and time to Unix timestamp</para></entry>
			</row>
			<row valign="top">
				<entry><para>STO</para></entry>
				<entry><para>Stores the current result in a variable. See <xref linkend="qalculate-variable-creation"/></para></entry>
				<entry><para>Opens a menu with a list of created variables. Left click to insert the variable. Right click for the option to edit or delete the variable, or store the current result in the variable.</para></entry>
			</row>
		</tbody>
	</tgroup>
</table>
</para>
</sect1>
<sect1 id="qalculate-calculation-history">
<title>Calculation History</title>
<para>
The history view provides access to previous calculation results (50 rows are reloaded on restart). Previous expressions and results, as well as errors and warnings, are listed. The text of one or multiple entries can be copied to the clipboard using the <guibutton>Copy</guibutton> button to the right of the list.
<figure id="qalculate-FIG-calculation-history">
	<title>Calculation History</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/calculation-history.png" format="PNG" width="517"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
</para>
<para>Double click an item in the history list or use the <guibutton>Value</guibutton> or the <guibutton>Text</guibutton> button to paste the selected value or expression into the expression entry. The <guibutton>Value</guibutton> button inserts the actual value, using the answer() and expression() functions (for results and parsed expressions, respectively) with the current history index (indicated in the left column of the list), as argument, instead of the text (which might be inexact and is not guaranteed to be parsed correctly). This is not possible for the history entries of previous sessions. When an item is double clicked the actual value is used for results, but the text for expressions, allowing editing of the expression.
</para>
<para>
To the right of the list are also buttons for mathematical operations. These act on the selected history items (the <guibutton>+</guibutton> will calculate the sum of the selected values, while the <guibutton>−</guibutton> will calculated the difference between the first, uppermost, selected value and the rest, in order). If no value is marked the sign for the operator will be inserted into the expression entry (as the buttons on the keypad). If only one item is selected the buttons also use the current expression (the <guibutton>+</guibutton> button will append <quote>+ [value]</quote> to the current expression). The square root button will however only act on single values. When persistent keypad is active, the corresponding buttons on the right side of the keypad provide the same functionality.
</para>
<para>
Additional actions are available in the context menu of the history list. This includes options to copy the full text of one or multiple entries, search the history, delete or move entries, to clear the whole list, and to bookmark and/or protect entries from deletion when the list becomes too long or is cleared.
</para>
</sect1>
<sect1 id="minimal-window">
<title>Minimal Window</title>
<para>It is possible to minimize the footprint of the calculator window using <menuchoice><guimenu>File</guimenu><guimenuitem>Minimal Window</guimenuitem></menuchoice> or <keycombo><keycap>Ctrl</keycap><keycap>Space</keycap></keycombo>. This will hide everything but the expression entry and the equals button. The window is expanded to reveal to result, but the result display stays hidden while empty. Restore the window using the keyboard shortcut or the icon in lower right corner of the expression entry.</para>
<figure id="qalculate-FIG-minimal-window">
	<title>Minimal Window</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/minimal-window.png" format="PNG" width="390"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
</sect1>
<sect1 id="qalculate-menus">
<title>Menu Bar</title>
<para>
The menus in the menu bar provides access to most of the functionality of &app;. Their contents are listed and described below.
</para>
<table id="qalculate-TBL-file-menu" frame="topbot" colsep="1">
	<title>File Menu</title> 
	<tgroup cols="2" colsep="1" rowsep="0">
		<colspec colname="COLSPEC0" colwidth="25%"/>
		<colspec colname="COLSPEC1"/>
		<thead>
			<row valign="top">
				<entry colname="COLSPEC0"><para>Menu Item</para></entry>
				<entry colname="COLSPEC1"><para>Description</para></entry>
			</row>
		</thead> 
		<tbody>
			<row valign="top">
				<entry><para>New</para></entry>
				<entry><para>Submenu for creation of new objects. See <xref linkend="qalculate-TBL-new-menu"/>.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Import CSV File...</para></entry>
				<entry><para>Opens a dialog for import of a data file as a matrix or vectors.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Export CSV File...</para></entry>
				<entry><para>Opens a dialog for export of a matrix or vector to a data file.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Store Result... (<keycombo><keycap>Ctrl</keycap><keycap>S</keycap></keycombo>)</para></entry>
				<entry><para>Stores the current result as a variable. See <xref linkend="qalculate-variable-creation"/>.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Save Result Image...</para></entry>
				<entry><para>Saves the result display to a PNG image.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Save Definitions</para></entry>
				<entry><para>Saves all user definitions (variables, functions and units).</para></entry>
			</row>
			<row valign="top">
				<entry><para>Update Exchange Rates</para></entry>
				<entry><para>Downloads current exchange rates from the Internet.</para></entry>
			</row>						
			<row valign="top">
				<entry><para>Plot Functions/Data</para></entry>
				<entry><para>Opens the plot dialog. See <xref linkend="qalculate-plotting"/>.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Convert Number Bases (<keycombo><keycap>Ctrl</keycap><keycap>B</keycap></keycombo>)</para></entry>
				<entry><para>Opens the number bases converter. See <xref linkend="qalculate-convert-number-bases-dialog"/>.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Floating Point Conversion (IEEE 754)</para></entry>
				<entry><para>Opens a window for conversion between decimal values and floating point formats.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Calendar Conversion</para></entry>
				<entry><para>Opens a window for conversion of dates between different calendars.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Percentage Calculation Tool</para></entry>
				<entry><para>Opens a window for quick and easy percentage calculation.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Periodic Table</para></entry>
				<entry><para>Shows a periodic table, with property values which can be inserted in the expression, in a new window.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Minimal Window (<keycombo><keycap>Ctrl</keycap><keycap>Space</keycap></keycombo>)</para></entry>
				<entry><para>Hides everything but the expression entry, the result (when not empty), and the equals button.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Quit (<keycombo><keycap>Ctrl</keycap><keycap>Q</keycap></keycombo>)</para></entry>
				<entry><para>Exits &app;</para></entry>
			</row>
		</tbody>
	</tgroup>
</table>
<table id="qalculate-TBL-new-menu" frame="topbot" colsep="1">
	<title>New Menu</title> 
	<tgroup cols="2" colsep="1" rowsep="0">
		<colspec colname="COLSPEC0" colwidth="25%"/>
		<colspec colname="COLSPEC1"/>
		<thead>
			<row valign="top">
				<entry colname="COLSPEC0"><para>Menu Item</para></entry>
				<entry colname="COLSPEC1"><para>Description</para></entry>
			</row>
		</thead> 
                <tbody>
			<row valign="top">
				<entry><para>Variable</para></entry>
				<entry><para>Opens the variable edit dialog for creation of a new variable.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Matrix</para></entry>
				<entry><para>Opens a dialog for entry of a new matrix variable.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Vector</para></entry>
				<entry><para>Opens a dialog for entry of a new vector variable.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Unknown Variable</para></entry>
				<entry><para>Opens the variable edit dialog for creation of a new unknown variable.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Function</para></entry>
				<entry><para>Opens the function edit dialog for creation of a new function.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Data Set</para></entry>
				<entry><para>Opens the data set edit dialog for creation of a new data set.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Unit</para></entry>
				<entry><para>Opens the unit edit dialog for creation of a new unit.</para></entry>
			</row>
		</tbody>
	</tgroup>
</table>
<table id="qalculate-TBL-edit-menu" frame="topbot" colsep="1">
	<title>Edit Menu</title> 
	<tgroup cols="2" colsep="1" rowsep="0">
		<colspec colname="COLSPEC0" colwidth="25%"/>
		<colspec colname="COLSPEC1"/>
		<thead>
			<row valign="top">
				<entry colname="COLSPEC0"><para>Menu Item</para></entry>
				<entry colname="COLSPEC1"><para>Description</para></entry>
			</row>
		</thead> 
                <tbody>
			<row valign="top">
				<entry><para>Variables (<keycombo><keycap>Ctrl</keycap><keycap>M</keycap></keycombo>)</para></entry>
				<entry><para>Opens the variable manager. See <xref linkend="qalculate-managers"/>.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Functions (<keycombo><keycap>Ctrl</keycap><keycap>F</keycap></keycombo>)</para></entry>
				<entry><para>Opens the function manager. See <xref linkend="qalculate-managers"/>.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Units (<keycombo><keycap>Ctrl</keycap><keycap>U</keycap></keycombo>)</para></entry>
				<entry><para>Opens the unit manager. See <xref linkend="qalculate-managers"/>.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Data Sets</para></entry>
				<entry><para>Opens the data set manager.</para></entry>
			</row>			
			<row valign="top">
				<entry><para>Factorize</para></entry>
				<entry><para>Factorizes the current result. For multivariate rational polynomials, only square free factorization is fully supported.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Expand</para></entry>
				<entry><para>Expands the current result.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Expand Partial Fractions</para></entry>
				<entry><para>Applies partial fraction decomposition to the current result.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Set Unknowns...</para></entry>
				<entry><para>Opens a dialog where the values of unknown variables in the result can be set and the result recalculated.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Convert To Unit</para></entry>
				<entry><para>Submenu with units. Select a unit to convert the current result.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Set Prefix</para></entry>
				<entry><para>Submenu for choice of unit prefix in current result.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Convert To Unit Expression (<keycombo><keycap>Ctrl</keycap><keycap>T</keycap></keycombo>)</para></entry>
				<entry><para>Opens the convert to unit view for conversion of result to custom unit expression. See <xref linkend="qalculate-unit-conversion"/>.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Convert To Base Units</para></entry>
				<entry><para>Splits up unit(s) in the current result into base units.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Convert To Optimal Unit</para></entry>
				<entry><para>Tries to convert the units in the current result so that as few units as possible is used. Only SI units are used for conversion. If the original units are equally or more optimal, than the automatic alternative, they are kept. Currencies are converted to the local currency, unless deactivated in the preferences dialog.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Convert To Optimal SI Unit</para></entry>
				<entry><para>Tries to convert the units in the current result so that as few units as possible is used. Non-SI units are not kept, even if the number of units used increase, and the automatic alternative is prioritized. Currencies are converted to the local currency, unless deactivated in the preferences dialog.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Insert Date</para></entry>
				<entry><para>Opens a dialog for date selection (for insertion in the current expression).</para></entry>
			</row>
			<row valign="top">
				<entry><para>Insert Matrix</para></entry>
				<entry><para>Opens a dialog where you can create a matrix in a spreadsheet-like table and insert into the expression entry. If selected expression text is a matrix, then the matrix is edited.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Insert Vector</para></entry>
				<entry><para>Opens a dialog where you can create a vector in a spreadsheet-like table and insert into the expression entry. If selected expression text is a vector, then the vector is edited.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Copy Result (<keycombo><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>C</keycap></keycombo>)</para></entry>
				<entry><para>Copies the current result to the clipboard.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Copy Result as Unformatted ASCII</para></entry>
				<entry><para>Copies the current result with formatting removed and Unicode symbols replaced with corresponding ASCII characters.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Keyboard Shortcuts</para></entry>
				<entry><para>Opens a dialog for editing key bindings.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Customize Keypad Buttons</para></entry>
				<entry><para>Opens a dialog for customizing the labels and actions for the keypad buttons on the right side, and optionally adding additional columns of buttons.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Preferences</para></entry>
				<entry><para>Opens the preferences dialog, which controls settings for visual appearance and start/exit actions.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Open Settings Folders</para></entry>
				<entry><para>Opens the folder(s) containing the configuration files in the default file manager.</para></entry>
			</row>
		</tbody>
	</tgroup>
</table>
<table id="qalculate-TBL-mode-menu" frame="topbot" colsep="1">
	<title>Mode Menu</title>
	<tgroup cols="2" colsep="1" rowsep="0">
		<colspec colname="COLSPEC0" colwidth="25%"/>
		<colspec colname="COLSPEC1"/>
		<thead>
			<row valign="top">
				<entry colname="COLSPEC0"><para>Menu Item</para></entry>
				<entry colname="COLSPEC1"><para>Description</para></entry>
			</row>
		</thead> 
		<tbody>
			<row valign="top">
				<entry><para>Number Base</para></entry>
				<entry><para>Submenu with a list of number bases (binary, octal, decimal, duodecimal, hexadecimal, sexagesimal, time format, and other bases, and roman numerals) to select for result display, and a menu item (<keycombo><keycap>Ctrl</keycap><keycap>B</keycap></keycombo>) for opening a dialog to switch number bases in expression (input) and result (output).</para></entry>
			</row>
			<row valign="top">
				<entry><para>Numerical Display</para></entry>
				<entry><para>Submenu which selects numerical display mode. See <xref linkend="qalculate-mode"/>.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Rational Number Form</para></entry>
				<entry><para>Submenu which switches between display of rational numbers as fractions or decimal numbers. See <xref linkend="qalculate-mode"/>.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Interval Display</para></entry>
				<entry><para>Submenu with options that determines how intervals and results with associated uncertainty are shown. The adaptive option is the same as significant digits display unless an interval has been explicitly specified in the expression.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Unit Display</para></entry>
				<entry><para>Submenu which controls the display of units and prefixes. See <xref linkend="qalculate-mode"/>.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Abbreviate Names</para></entry>
				<entry><para>Toggles on/off use of abbreviation for unit, prefix, variable and function names in result display.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Enabled Objects</para></entry>
				<entry><para>Submenu which enables/disables variables, functions, units and unknowns (will not affect defined unknown variables and quoted unknowns), calculation of variables (if calculation of variables is not on, all variables will be treated as unknown), and units in variables for physical constants. Here you can also disable complex and infinite results.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Approximation</para></entry>
				<entry><para>Submenu which switches between different approximation modes.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Interval Calculation</para></entry>
				<entry><para>Submenu for selection of algorithm for interval calculation / uncertainty propagation.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Angle Unit</para></entry>
				<entry><para>Submenu which sets the default angle unit for trigonometric functions.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Assumptions</para></entry>
				<entry><para>Submenu which changes default assumptions for unknown variables.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Algebraic Mode</para></entry>
				<entry><para>Submenu with options to automatically expand or factorize the final result. In this menu, the option toggle on/off use of the assumption that unknown denominators not are zero is also found. This alternative makes it possible to avoid the situation where expressions such as <quote>(x-1)/(x-1)</quote> can not be further simplified because the denominator might be zero (if x equals 1).</para></entry>
			</row>
			<row valign="top">
				<entry><para>Parsing Mode</para></entry>
				<entry><para>Submenu with options to control how expressions are parsed (read/interpreted). There are three main modes to choose from. In addition the <quote>read precision</quote> option enables/disables interpretation of input numbers with decimals as approximate with a precision equal to the number of digits (after preceding zeroes), and <quote>limit implicit multiplication</quote> limits the use of implicit multiplication for parsing and display of expressions. For more information see <xref linkend="qalculate-implicit-multiplication"/>. Additionally RPN and chain syntax modes can be selected.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Precision</para></entry>
				<entry><para>Opens a dialog to change precision in calculations.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Decimals</para></entry>
				<entry><para>Opens a dialog to change displayed number of decimals.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Calculate As You Type</para></entry>
				<entry><para>When activated the current expression will be continuously calculated on each single change.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Chain Mode</para></entry>
				<entry><para>(De)activates chain mode. In chain mode the expression are, when operators are entered, transformed to mimic the behavior of traditional simple calculators in immediate execution mode. The result is equivalent to that of the chain syntax (see <xref linkend="qalculate-implicit-multiplication"/>). The result is updated each time an operator is entered.</para></entry>
			</row>
			<row valign="top">
				<entry><para>RPN Mode (<keycombo><keycap>Ctrl</keycap><keycap>R</keycap></keycombo>)</para></entry>
				<entry><para>(De)activates the Reverse Polish Notation stack (not RPN syntax). For details see <xref linkend="qalculate-rpn"/></para></entry>
			</row>
			<row valign="top">
				<entry><para>Meta Modes</para></entry>
				<entry><para>Provides a list of available meta modes for loading and menu items to save and delete modes.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Save Default Mode</para></entry>
				<entry><para>Saves the current calculator mode as the startup default.</para></entry>
			</row>
		</tbody>
	</tgroup>
</table>
<table id="qalculate-TBL-functions-menu" frame="topbot" colsep="1">
	<title>Functions Menu</title> 
	<tgroup cols="2" colsep="1" rowsep="0">
		<colspec colname="COLSPEC0" colwidth="25%"/>
		<colspec colname="COLSPEC1"/>
		<thead>
			<row valign="top">
				<entry colname="COLSPEC0"><para>Menu Item</para></entry>
				<entry colname="COLSPEC1"><para>Description</para></entry>
			</row>
		</thead> 
                <tbody>
			<row valign="top">
				<entry><para>(Recent functions list)</para></entry>
				<entry><para>Select a function to open the insert function dialog.</para></entry>
			</row>
			<row valign="top">
				<entry><para>(Function list)</para></entry>
				<entry><para>Select a function to open the insert function dialog.</para></entry>
			</row>
		</tbody>
	</tgroup>
</table>
<table id="qalculate-TBL-variables-menu" frame="topbot" colsep="1">
	<title>Variables Menu</title> 
	<tgroup cols="2" colsep="1" rowsep="0">
		<colspec colname="COLSPEC0" colwidth="25%"/>
		<colspec colname="COLSPEC1"/>
		<thead>
			<row valign="top">
				<entry colname="COLSPEC0"><para>Menu Item</para></entry>
				<entry colname="COLSPEC1"><para>Description</para></entry>
			</row>
		</thead> 
                <tbody>
			<row valign="top">
				<entry><para>(Recent variables list)</para></entry>
				<entry><para>Select a variable to insert it into the expression entry.</para></entry>
			</row>                
			<row valign="top">
				<entry><para>(Variable list)</para></entry>
				<entry><para>Select a variable to insert it into the expression entry.</para></entry>
			</row>
		</tbody>
	</tgroup>
</table>
<table id="qalculate-TBL-units-menu" frame="topbot" colsep="1">
	<title>Units Menu</title> 
	<tgroup cols="2" colsep="1" rowsep="0">
		<colspec colname="COLSPEC0" colwidth="25%"/>
		<colspec colname="COLSPEC1"/>
		<thead>
			<row valign="top">
				<entry colname="COLSPEC0"><para>Menu Item</para></entry>
				<entry colname="COLSPEC1"><para>Description</para></entry>
			</row>
		</thead> 
                <tbody>
                	<row valign="top">
				<entry><para>(Recent units list)</para></entry>
				<entry><para>Select a unit to insert it into the expression entry.</para></entry>
			</row>
			<row valign="top">
				<entry><para>(Unit list)</para></entry>
				<entry><para>Select a unit to insert it into the expression entry.</para></entry>
			</row>
		</tbody>
	</tgroup>
</table>
<table id="qalculate-TBL-help-menu" frame="topbot" colsep="1">
	<title>Help Menu</title> 
	<tgroup cols="2" colsep="1" rowsep="0">
		<colspec colname="COLSPEC0" colwidth="25%"/>
		<colspec colname="COLSPEC1"/>
		<thead>
			<row valign="top">
				<entry colname="COLSPEC0"><para>Menu Item</para></entry>
				<entry colname="COLSPEC1"><para>Description</para></entry>
			</row>
		</thead> 
                <tbody>
			<row valign="top">
				<entry><para>Contents (<keycap>F1</keycap>)</para></entry>
				<entry><para>Opens this help.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Report a Bug</para></entry>
				<entry><para>Opens the web interface for creation of bug reports.</para></entry>
			</row>
			<row valign="top">
				<entry><para>Check for Updates</para></entry>
				<entry><para>Checks if a new version of &app; is available.</para></entry>
			</row>
			<row valign="top">
				<entry><para>About</para></entry>
				<entry><para>Info about &app;</para></entry>
			</row>
		</tbody>
	</tgroup>
</table>

</sect1>
<sect1 id="qalculate-managers">
<title>Variable/Function/Unit Managers</title>
<para>
The variables, functions, and units windows provide a structural way of working with variables, functions and units (collectively referred to as objects). The windows for the three different objects are essentially similar. They can be opened from the edit menu, or using <keycombo><keycap>Ctrl</keycap><keycap>M</keycap></keycombo>, <keycombo><keycap>Ctrl</keycap><keycap>F</keycap></keycombo> and <keycombo><keycap>Ctrl</keycap><keycap>U</keycap></keycombo> for variables, functions and units respectively.
</para>
<figure id="qalculate-FIG-variable-manager">
	<title>Variable Manager</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/variable-manager.png" format="PNG" width="707"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
To the left is a category tree and beside that is a list of all objects in the selected category, including all subcategories. Objects without a category are put under <quote>Uncategorized</quote>. Objects created by the user can also be found under the category <quote>User variables</quote>, <quote>User functions</quote>, and <quote>User units</quote>, shown at the top of the list. Deactivated objects are only found in the <quote>Inactive</quote> top category. Below the categories and objects lists, a description of the selected object is shown.
</para>
<para>
The buttons on the right work on the selected object in the list. <guibutton>New</guibutton> opens a dialog for creation of a new object, while <guibutton>Edit</guibutton> opens the same dialog to edit the selected unit. <guibutton>Delete</guibutton> removes the object and <guibutton>(De)activate</guibutton> toggles recognition in expressions on/off. <guibutton>Insert</guibutton> in the variables and units windows adds the object to the current expression, while <guibutton>Calculate</guibutton> in the functions window opens a dialog for entering arguments and provides options for insertion of the function or direct calculation. The unit manager provide an additional button for conversion of the current result, the variable manager a button for export to a data file, and the function manager a button for applying functions with a single argument directly to the current expression.
</para>
<figure id="qalculate-FIG-function-manager">
	<title>Function Manager</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/function-manager.png" format="PNG" width="724"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
The function manager has a description box at the bottom, which shows the syntax, description and arguments of the selected function. 
</para>
<figure id="qalculate-FIG-unit-manager">
	<title>Unit Manager</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/unit-manager.png" format="PNG" width="682"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
The unit manager has an area for quick conversion between units. This converts between the selected unit in the list and the selected unit in the menu. Both the menu and the list filters the units as you type. Units are converted by specification of a quantity, in the entry next to the unit to convert from, followed by <keycap>Enter</keycap>.
</para>
<para>
For more information about variables, functions and units, see <xref linkend="qalculate-variables"/>,  <xref linkend="qalculate-functions"/> and <xref linkend="qalculate-units"/>.
</para>
</sect1>
<sect1 id="qalculate-convert-number-bases-dialog">
<title>Convert Number Bases Dialog</title>
<para>
The number bases dialog, accessible from the <guimenu>File Menu</guimenu>, is an efficient and convenient tool for conversion between binary, octal, decimal, duodecimal, hexadecimal and Roman numbers. This dialog contains entries for each number base. When a number is typed in any of the entries, the others are automatically updated to display the current number in their format. Numbers, or expressions, entered follow the same rules as expressions in the main expression entry.
<figure id="qalculate-FIG-convert-number-bases">
	<title>Convert Number Bases Dialog</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/convert-number-bases.png" format="PNG" width="626"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
</para>
</sect1>
</chapter>

<chapter id="qalculate-expressions">
<title>Expressions</title>
<para>
Expressions are mathematical statements. Mathematical questions are asked through expressions, which contains objects tied together with operators. The result of an expression may also be an expression, if the result is not a single object. Apples and oranges can be mixed, but the result will hold them apart. &app; knows algebra. 
</para>
<sect1 id="qalculate-expression-objects">
<title>Objects</title>
<para>
In &app; mathematical entities, such as numbers and variables, are referred to as objects. The recognized object types are listed below.
</para>
<para>
<variablelist>
	<varlistentry>
		<term>Numbers</term>
		<listitem><para>
		These are the regular numbers composed by digits 0-9 and a decimal sign — a dot, or a comma if it is the default decimal point in the locale/language used. If comma is used as decimal sign, the dot is still kept as an alternative decimal sign, if not explicitly turned off in the preferences dialog with <guibutton>Ignore dots in number</guibutton> (to allow it to be used as thousand separator instead). Numbers include integers, real numbers, and complex numbers. The imaginary part of complex numbers is written as a regular number followed by the special variable <quote>i</quote> (can be changed to a <quote>j</quote>, placed in front of the imaginary part, in the preferences dialog), which represents the square root of -1 (e.g. <quote>2 + 3i</quote>). Spaces between digits are ignored (<quote>5  5 = 55</quote>). <quote>E</quote> (or <quote>e</quote>) can be considered as a shortcut for writing many zeroes and is equivalent to multiplication by 10 raised to the power of the right-hand value (e.g. <quote>5E3 = 5000</quote>).</para>
		<para>Sexagesimal numbers (and time) can be entered directly using colons (e.g. <quote>5:30 = 5.5</quote>). A number immediately preceded by <quote>0b</quote>, <quote>0o</quote>, <quote>0d</quote> or <quote>0x</quote> is interpreted as a number with base 2, 8, 12 or 16, respectively (if the default base is 10, e.g. <quote>0x3f = 63</quote>). The number base can also be selected, either by using the <command>base()</command>, <command>bin()</command>, <command>oct()</command>, <command>hex()</command> and <command>roman()</command> functions, or by setting the base used for all numbers in the whole expression from <menuchoice><guimenu>Mode</guimenu><guisubmenu>Number Base</guisubmenu><guimenuitem>Select Result and Expression Base...</guimenuitem></menuchoice>. For details about supported number bases see <xref linkend="qalculate-TBL-number-bases"/>.
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Intervals</term>
		<listitem><para>
		A number interval can be entered using the <command>interval()</command> function (specifies the upper and lower limit of the interval), the <command>uncertainty()</command> function (specifies relative or absolute uncertainty), or using <quote>±</quote> or <quote>+/-</quote>, specifying the width of the interval after the mid value (e.g. <quote>5±1 = uncertainty(5, 1, 0) = 5±20% = uncertainty(5, 0.2) = interval(4, 6)</quote>. If activated, concise notation can also be used, e.g. <quote>1.2345(67) = 1.2345±0.0067</quote>. If the read precision option is activated, decimal numbers are interpreted as an interval between the numbers that are normally rounded to the entered number (e.g. <quote>1.1 = 1.1±0.05</quote>). If interval calculation using variance formula is activated (default), the interval represents the standard uncertainty (deviation) of the value.
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Vectors and Matrices</term>
		<listitem><para>
		A matrix is a two-dimensional rectangular array of mathematical objects. Vectors are matrices with only one row or column, and thus one-dimensional sequences of objects. Vectors and matrices are generated by <command>vector()</command>, <command>matrix()</command> and similar functions, or using a syntax in the form of <quote>[1 2 3 4]</quote> and <quote>[1 2; 3 4]</quote>, with columns separated by space or comma and rows separated by semi-colon, or <quote>(1, 2, 3, 4)</quote> and <quote>((1, 2), (3, 4))</quote>. Vectors with a sequence of numbers can be input using <quote>...</quote>  (e.g. <quote>1...4</quote>), or colon (e.g. <quote>[1:4]</quote>, or <quote>[1:1:4]</quote> where the second value specifies the increment). Vectors are generally considered as matrices with one row (row vector) in operations that expect a matrix (e.g. matrix multiplication).</para><para>Matrices and vectors with many elements are easier to handle if stored in variables. A single element of vector variable can be selected using the <command>element()</command> function, or by placing the index (first index is 1) in parenthesis, e.g. <quote>v(2)</quote> or <quote>v[2]</quote> (the latter syntax can also be used for vector returning functions).</para></listitem>
	</varlistentry>	
	<varlistentry>
		<term>Variables/Constants</term>
		<listitem><para>
		See <xref linkend="qalculate-variables"/>.
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Functions</term>
		<listitem><para>
		See <xref linkend="qalculate-functions"/>.
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Units and Prefixes</term>
		<listitem><para>
		&app; understands abbreviated, plural and singular forms of unit names and prefixes. Prefixes must be put immediately before the unit to be interpreted as prefixes — <quote>5 mm = 0.005 m</quote>, but <quote>5 m m = 5 m^2</quote>. Also, for convenience units allow the power operator to be left out. A number following immediately after a unit is interpreted as an exponent (e.g. <quote>5 m2 = 5 m^2</quote>). This does not apply to currencies, as they might be put in front of the quantity. More information in <xref linkend="qalculate-units"/>.
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Unknowns</term>
		<listitem><para>
		Unknowns are text strings without any associated value. These are temporary unknown variables with default assumptions. Unknowns can also be explicitly entered by placing a backslash (<quote>\</quote>) before a single character (e.g. <quote>5\a + 2\b</quote>) or using quotation marks (<quote>"</quote> or <quote>'</quote>) before and after a text string (e.g. <quote>5 "apples" + 2 "bananas"</quote>). If unknowns are activated (<menuchoice><guimenu>Mode</guimenu><guimenu>Enabled Objects</guimenu><guimenuitem>Unknowns</guimenuitem></menuchoice>) and &app; finds a character that are not associated with any variable, function or unit in an expression, then it will be regarded as an unknown variable. See <xref linkend="qalculate-variables"/>.
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Date and Time</term>
		<listitem><para>
		Date/time values are specified using quoted text string (quotation marks are not needed for function arguments), using standard date and time format (YYYY-MM-DDTHH:MM:SS). Some local formats are also supported, but not recommended. The local time zone is used, unless a time zone is specified at the end of the time string (Z/UTC/GMT or +/-HH:MM). Date/time supports a small subset of arithmetic operations. The time units represents calendar time, instead of average values, when added or subtracted to a date.
		</para></listitem>
	</varlistentry>	
	<varlistentry>
		<term>Text</term>
		<listitem><para>
		This category represent a number of different function argument types, such as regular text and file names. They can, but do not need to be put in quotes except when containing the argument separator (<quote>,</quote> or <quote>;</quote>).
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Comments</term>
		<listitem><para>
		All text after a hashtag (e.g. <quote>(5×2)/2 #calculating triangle area</quote>) is treated as a comment, which are added to the history. Use double hashtags (<quote>##</quote>) at the beginning of the expression to add a comment as a separate history item at the top.
		</para></listitem>
	</varlistentry>
</variablelist>
</para>
<para>
To avoid confusion, functions, units, variables and unknown variables can independently be disabled.
</para>
<para>
Variables, functions and units are all accessible in the menus and in the variable, function and unit managers, If their names are not remembered. Functions accessed this way have some extra conveniences. If the function has at least one argument, a dialog will pop up where arguments can be entered and a description of the function and its arguments is available. 
</para>
<para>
&app; can handle most commonly used symbols for certain variables, functions and units, even though most are difficult to find on a keyboard. These include π for pi, √ for sqrt, € for euro, and so on. Most importantly it is possible to copy these symbols when used in the result.
</para>
<para>
For more information about variables, functions and units, see <xref linkend="qalculate-variables"/>,  <xref linkend="qalculate-functions"/> and <xref linkend="qalculate-units"/>.
</para>
</sect1>
<sect1 id="qalculate-expression-operators">
<title>Operators</title>
<para>
The following operators are defined in &app; and may be used in expressions. Word operators (such as AND) must be surrounded by space (e.g. <quote>5 mod 2</quote>, not <quote>5mod2</quote>.
</para>
<table id="qalculate-TBL-operators" frame="topbot" colsep="1">
	<title>Operators</title> 
	<tgroup cols="5" rowsep="1">
		<colspec colname="COLSPEC0"/>
		<colspec colname="COLSPEC1" align="center"/>
		<colspec colname="COLSPEC2" colwidth="60%"/>
		<colspec colname="COLSPEC3" align="center"/>
		<colspec colname="COLSPEC4" align="right"/>
		<thead>
			<row valign="top">
				<entry colname="COLSPEC0"><para>Operation</para></entry>
				<entry colname="COLSPEC1"><para>Symbol</para></entry>
				<entry colname="COLSPEC2"><para>Description</para></entry>
				<entry colname="COLSPEC3"><para>Example</para></entry>
				<entry colname="COLSPEC4"><para>Result</para></entry>
			</row>
		</thead> 
		<tbody>
			<row valign="top">
				<entry><para>Addition</para></entry>
				<entry align="center"><para>+, plus</para></entry>
				<entry><para>Adds the right value to the left value.</para></entry>
				<entry align="center"><para>1 + 1</para></entry>
				<entry align="right"><para>2</para></entry>
			</row>
			<row valign="top">
				<entry><para>Subtraction</para></entry>
				<entry align="center"><para>−, minus</para></entry>
				<entry><para>Subtracts the right value from the left value.</para></entry>
				<entry align="center"><para>1 − 1</para></entry>
				<entry align="right"><para>0</para></entry>
			</row>
			<row valign="top">
				<entry><para>Multiplication</para></entry>
				<entry align="center"><para>×, ⋅, *, times</para></entry>
				<entry><para>Multiplies the left value by the right value.</para></entry>
				<entry align="center"><para>2 × 2</para></entry>
				<entry align="right"><para>4</para></entry>
			</row>
			<row valign="top">
				<entry><para>Division</para></entry>
				<entry align="center"><para>/, per</para></entry>
				<entry><para>Divides the left value by the right value.</para></entry>
				<entry align="center"><para>2 / 2</para></entry>
				<entry align="right"><para>1</para></entry>
			</row>
			<row valign="top">
				<entry><para>Remainder</para></entry>
				<entry align="center"><para>%, rem</para></entry>
				<entry><para>Returns the remainder after (truncated) division.  The result will have the same sign as the dividend.</para></entry>
				<entry align="center"><para>3%2</para></entry>
				<entry align="right"><para>1</para></entry>
			</row>
			<row valign="top">
				<entry><para>Modulo</para></entry>
				<entry align="center"><para>%%, mod</para></entry>
				<entry><para>Returns the remainder after (floored) division.  The result will have the same sign as the divisor.</para></entry>
				<entry align="center"><para>3 mod -2</para></entry>
				<entry align="right"><para>-1</para></entry>
			</row>
			<row valign="top">
				<entry><para>Integer Division</para></entry>
				<entry align="center"><para>//, \, div</para></entry>
				<entry><para>Divides the left value by the right value and rounds the result towards zero.</para></entry>
				<entry align="center"><para>5 // 2</para></entry>
				<entry align="right"><para>2</para></entry>
			</row>
			<row valign="top">
				<entry><para>Exponentiation</para></entry>
				<entry align="center"><para>^, **</para></entry>
				<entry><para>Raises the left value by the right value. Can also be typed as <quote>**</quote>. Note that x^y^z equals x^(y^z), and not (x^y)^z. Note also that for non-integer exponents with negative bases, the principal root is returned and not the real root (<quote>(-8)^(1/3)</quote> equals <quote>1 + 1.73i</quote> instead of -2). To calculate the real root for negative values, use the <command>cbrt()</command> and <command>root()</command> functions.</para></entry>
				<entry align="center"><para>2^3</para></entry>
				<entry align="right"><para>8</para></entry>
			</row>
			<row valign="top">
				<entry><para>10^x</para></entry>
				<entry align="center"><para>E</para></entry>
				<entry><para>Multiplies the left value with 10 raised to the power of the right value. Equivalent to the exponential number format in result display. E is as much an operator as part of numbers.</para></entry>
				<entry align="center"><para>1E3</para></entry>
				<entry align="right"><para>1000</para></entry>
			</row>
			<row valign="top">
				<entry><para>Factorial</para></entry>
				<entry align="center"><para>!</para></entry>
				<entry><para>Returns the factorial of the value to the left of the operator. If the operator is repeated the corresponding multifactorial is returned.</para></entry>
				<entry align="center"><para>5!</para></entry>
				<entry align="right"><para>120</para></entry>
			</row>
			<row valign="top">
				<entry><para>Parenthesis</para></entry>
				<entry align="center"><para>( and )</para></entry>
				<entry><para>Evaluates the expression in parenthesis first.</para></entry>
				<entry align="center"><para>5 × (1 + 1)</para></entry>
				<entry align="right"><para>10</para></entry>
			</row>
			<row valign="top">
				<entry><para>Parallel sum</para></entry>
				<entry align="center"><para>∥, ||</para></entry>
				<entry><para>Returns the reciprocal value of a sum of reciprocal values. || is interpreted as parallel if units are used, otherwise as logical OR.</para></entry>
				<entry align="center"><para>10 Ω || 6 Ω</para></entry>
				<entry align="right"><para>3.75 Ω</para></entry>
			</row>
			<row valign="top">
				<entry><para>Equals</para></entry>
				<entry align="center"><para>=</para></entry>
				<entry><para>Returns true if the left value equals the right value. Unknown variables (e.g. x) are isolated if the expression does not evaluate as true or false.</para></entry>
				<entry align="center"><para>1 = 2, 5x = 5</para></entry>
				<entry align="right"><para>1, x=1</para></entry>
			</row>
			<row valign="top">
				<entry><para>Not equals</para></entry>
				<entry align="center"><para>≠, !=</para></entry>
				<entry><para>Returns true if the left value does not equals the right value. Unknown variables (e.g. x) are isolated if the expression does not evaluate as true or false.</para></entry>
				<entry align="center"><para>1 != 2, x + 2 != 5</para></entry>
				<entry align="right"><para>1, x != 3</para></entry>
			</row>
			<row valign="top">
				<entry><para>Less than</para></entry>
				<entry align="center"><para>&lt;</para></entry>
				<entry><para>Returns true if the left value is less than the right value. Unknown variables (e.g. x) are isolated if the expression does not evaluate as true or false.</para></entry>
				<entry align="center"><para>1 &lt; 2</para></entry>
				<entry align="right"><para>1</para></entry>
			</row>
			<row valign="top">
				<entry><para>Greater than</para></entry>
				<entry align="center"><para>&gt;</para></entry>
				<entry><para>Returns true, if the left value is greater than the right value. Unknown variables (e.g. x) are isolated if the expression does not evaluate as true or false.</para></entry>
				<entry align="center"><para>1 &gt;2 </para></entry>
				<entry align="right"><para>0</para></entry>
			</row>
			<row valign="top">
				<entry><para>Less than or equal</para></entry>
				<entry align="center"><para>≤, &lt;=</para></entry>
				<entry><para>Returns true if the left value is less than or equal the right value. Unknown variables (e.g. x) are isolated if the expression does not evaluate as true or false.</para></entry>
				<entry align="center"><para>1 &lt;= 2</para></entry>
				<entry align="right"><para>1</para></entry>
			</row>
			<row valign="top">
				<entry><para>Greater than or equal</para></entry>
				<entry align="center"><para>≥, &gt;=</para></entry>
				<entry><para>Returns true if the left value is greater than or equal the right value. Unknown variables (e.g. x) are isolated if the expression does not evaluate as true or false.</para></entry>
				<entry align="center"><para>1 ≥ 2, x + 5 ≥ 7</para></entry>
				<entry align="right"><para>0, x ≥ 2</para></entry>
			</row>
			<row valign="top">
				<entry><para>Logical NOT</para></entry>
				<entry align="center"><para>!, not</para></entry>
				<entry><para>Returns true if the value to the right is false.</para></entry>
				<entry align="center"><para>!(1&gt;2)</para></entry>
				<entry align="right"><para>1</para></entry>
			</row>
			<row valign="top">
				<entry><para>Logical OR</para></entry>
				<entry align="center"><para>||, or</para></entry>
				<entry><para>Returns true if the right or left value is true.</para></entry>
				<entry align="center"><para>1&gt;2 || 2&gt;1</para></entry>
				<entry align="right"><para>true</para></entry>
			</row>
			<row valign="top">
				<entry><para>Logical XOR</para></entry>
				<entry align="center"><para>⊕, xor</para></entry>
				<entry><para>Returns for true if one, but not both, of the right or left value is true.</para></entry>
				<entry align="center"><para>1&gt;2 ⊕ 2&gt;1</para></entry>
				<entry align="right"><para>true</para></entry>
			</row>
			<row valign="top">
				<entry><para>Logical NOR</para></entry>
				<entry align="center"><para>nor</para></entry>
				<entry><para>Returns true if both the right and left value is false.</para></entry>
				<entry align="center"><para>1&gt;2 nor 2&gt;1</para></entry>
				<entry align="right"><para>false</para></entry>
			</row>
			<row valign="top">
				<entry><para>Logical AND</para></entry>
				<entry align="center"><para>&amp;&amp;, and</para></entry>
				<entry><para>Returns true if both the right and left value is true.</para></entry>
				<entry align="center"><para>1&gt;2 &amp;&amp; 2&gt;1</para></entry>
				<entry align="right"><para>false</para></entry>
			</row>
			<row valign="top">
				<entry><para>Logical NAND</para></entry>
				<entry align="center"><para>nand</para></entry>
				<entry><para>Returns true if the right or left value is false.</para></entry>
				<entry align="center"><para>1&gt;2 nand 2&gt;1</para></entry>
				<entry align="right"><para>true</para></entry>
			</row>
			<row valign="top">
				<entry><para>Bitwise NOT</para></entry>
				<entry align="center"><para>¬, ~</para></entry>
				<entry><para>Equivalent to -1 − x.</para></entry>
				<entry align="center"><para>~(0010 | 1100)</para></entry>
				<entry align="right"><para>-1111</para></entry>
			</row>
			<row valign="top">
				<entry><para>Bitwise Shift Left</para></entry>
				<entry align="center"><para>&lt;&lt;</para></entry>
				<entry><para>Shifts the bits of the left value x steps to the left, where x is the value on the right. Implemented as a shortcut for <command>shift()</command></para></entry>
				<entry align="center"><para>0011 &lt;&lt; 1</para></entry>
				<entry align="right"><para>0110</para></entry>
			</row>
			<row valign="top">
				<entry><para>Bitwise Shift Right</para></entry>
				<entry align="center"><para>&gt;&gt;</para></entry>
				<entry><para>Shifts the bits of the left value x steps to the right, where x is the value on the right. Implemented as a shortcut for <command>shift()</command></para></entry>
				<entry align="center"><para>0011 &lt;&lt; 1</para></entry>
				<entry align="right"><para>0001</para></entry>
			</row>
			<row valign="top">
				<entry><para>Bitwise OR</para></entry>
				<entry align="center"><para>∨, |</para></entry>
				<entry><para>If a bit is 1 in one of the numbers set it to 1, otherwise 0. Also functions as elementwise logical operator on vectors.</para></entry>
				<entry align="center"><para>0010 | 1100</para></entry>
				<entry align="right"><para>1110</para></entry>
			</row>
			<row valign="top">
				<entry><para>Bitwise XOR</para></entry>
				<entry align="center"><para>⊻, ^^, xor</para></entry>
				<entry><para>If a bit is 1 in one of the numbers and not in the other, set it to 1, otherwise 0. Can normally also be used as logical XOR. &#8891; can be input using <keycombo><keycap>Ctrl</keycap><keycap>^</keycap></keycombo> (or just <keycap>^</keycap> if selected in preferences) on the keyboard.</para></entry>
				<entry align="center"><para>1010 &#8891; 1100</para></entry>
				<entry align="right"><para>0110</para></entry>
			</row>
			<row valign="top">
				<entry><para>Bitwise AND</para></entry>
				<entry align="center"><para>∧, &amp;</para></entry>
				<entry><para>If a bit is 1 in both numbers set it to 1, otherwise 0. Also functions as elementwise logical operator on vectors.</para></entry>
				<entry align="center"><para>1010 &amp; 0011</para></entry>
				<entry align="right"><para>0010</para></entry>
			</row>
			<row valign="top">
				<entry><para>Dot Product</para></entry>
				<entry align="center"><para>., dot</para></entry>
				<entry><para>Returns the dot product for two vectors.</para></entry>
				<entry align="center"><para>[1, 2, 3].[4, 5, 6]</para></entry>
				<entry align="right"><para>32</para></entry>
			</row>
			<row valign="top">
				<entry><para>Cross Product</para></entry>
				<entry align="center"><para>⨯, cross</para></entry>
				<entry><para>Returns the cross product for two vectors.</para></entry>
				<entry align="center"><para>[1, 2, 3] cross [4, 5, 6]</para></entry>
				<entry align="right"><para>[-1, 6, -3]</para></entry>
			</row>
			<row valign="top">
				<entry><para>Elementwise Multiplication</para></entry>
				<entry align="center"><para>.×, .*</para></entry>
				<entry><para>Multiplies each element of a vector/matrix with the corresponding element in another vector/matrix, or a scalar.</para></entry>
				<entry align="center"><para>[1, 2, 3].*[4, 5, 6]</para></entry>
				<entry align="right"><para>[4, 10, 18]</para></entry>
			</row>
			<row valign="top">
				<entry><para>Elementwise Division</para></entry>
				<entry align="center"><para>./</para></entry>
				<entry><para>Divides each element of a vector/matrix by the corresponding element in another vector/matrix, or a scalar.</para></entry>
				<entry align="center"><para>[2, 4, 6]./2</para></entry>
				<entry align="right"><para>[1, 2, 3]</para></entry>
			</row>
			<row valign="top">
				<entry><para>Elementwise Exponentiation</para></entry>
				<entry align="center"><para>.^</para></entry>
				<entry><para>Raises each element of a vector/matrix by the corresponding element in another vector/matrix, or a scalar.</para></entry>
				<entry align="center"><para>[1, 2, 3].^2</para></entry>
				<entry align="right"><para>[1, 4, 9]</para></entry>
			</row>
			<row valign="top">
				<entry><para>Transpose</para></entry>
				<entry align="center"><para>.'</para></entry>
				<entry><para>Returns the transpose of the matrix to the left of the operator.</para></entry>
				<entry align="center"><para>[[1, 2, 3], [3, 4, 5]].'</para></entry>
				<entry align="right"><para>[[1, 3], [2, 4], [3, 5]]</para></entry>
			</row>
			<row valign="top">
				<entry><para>Combination</para></entry>
				<entry align="center"><para>comb</para></entry>
				<entry><para>Same as <command>comb()</command> function.</para></entry>
				<entry align="center"><para>5 comb 2</para></entry>
				<entry align="right"><para>10</para></entry>
			</row>
			<row valign="top">
				<entry><para>Permutations</para></entry>
				<entry align="center"><para>perm</para></entry>
				<entry><para>Same as <command>perm()</command> function.</para></entry>
				<entry align="center"><para>5 perm 2</para></entry>
				<entry align="right"><para>20</para></entry>
			</row>
			<row valign="top">
				<entry><para>Save as Variable/Function</para></entry>
				<entry align="center"><para>:=, =</para></entry>
				<entry><para>Saves the value or expression to the right of the operator as a variable or function (as <command>save()</command> function). If colon is omitted, the expression is calculated before it is assigned to the variable.</para></entry>
				<entry align="center"><para>var1:=5</para><para>func1():=x+y</para><para>var1=ln(5)+2</para></entry>
				<entry align="right"><para></para></entry>
			</row>
		</tbody>
	</tgroup>
</table>
<para>
The multiplication sign can generally be left out. This is not true for numbers (<quote>5(5) = 25</quote> but <quote>5  5 = 55</quote>). Expressions can also generally be written with or without spaces with the same result (<quote>2xsin(2)</quote> equals <quote>2 x sin(2)</quote> which equals <quote>2 × x × sin(2)</quote>), but be careful. The vast number of functions and units means that without separating spaces, the result might not be obvious. To avoid confusion &app; can limit the use of implicit multiplication (<menuchoice><guimenu>Mode</guimenu><guimenuitem>Limit Implicit Multiplication</guimenuitem></menuchoice>), so that space, operator or parenthesis must be put between functions, units and variables (in this mode <quote>esqrt(5)</quote> does not equal <quote>e × sqrt(5)</quote>). Also note that unit prefixes must be put immediately before the unit, to be interpreted as prefixes (<quote>5 mm = 0.005 m</quote>, but <quote>5 m m = 5m^2</quote>). You can see how the expression was interpreted in the history window.
</para>
<para>
Usually, mathematical expressions are written as normally expected. Standard operator precedence apply. Expressions are evaluated according to the following priorities:
<orderedlist>
	<listitem><para>Parenthesis</para></listitem>
	<listitem><para>E (10^x)</para></listitem>
	<listitem><para>Exponentiation (^, .^)</para></listitem>
	<listitem><para>Functions (e.g. <quote>sqrt(2)</quote>)</para></listitem>
	<listitem><para>Bitwise NOT (~)</para></listitem>
	<listitem><para>Logical NOT (!)</para></listitem>
	<listitem><para>Multiplication, division, integer division, remainder, modulo (*, /, //, %, %%, .*, ./, ., ⨯)</para></listitem>
	<listitem><para>Parallel sum (∥)</para></listitem>
	<listitem><para>Addition and subtraction (+, −)</para></listitem>
	<listitem><para>Bitwise NOT (~)</para></listitem>
	<listitem><para>Bitwise Shift (&lt;&lt;, &gt;&gt;)</para></listitem>
	<listitem><para>Comparison (&gt;, &lt;, =, &gt;=, &lt;=)</para></listitem>
	<listitem><para>Bitwise AND (&amp;)</para></listitem>
	<listitem><para>Bitwise XOR (⊻)</para></listitem>
	<listitem><para>Bitwise OR (|)</para></listitem>
	<listitem><para>Logical AND (&amp;&amp;)</para></listitem>
	<listitem><para>Logical NAND</para></listitem>
	<listitem><para>Logical NOR</para></listitem>
	<listitem><para>Logical OR (||)</para></listitem>
	<listitem><para>Logical XOR (⊕)</para></listitem>
</orderedlist>
</para>
</sect1>
<sect1 id="qalculate-implicit-multiplication">
<title>Implicit Multiplication and Parsing Modes</title>
<para>
The evaluation of short/implicit multiplication, without any multiplication sign (e.g. <quote>5x</quote>, <quote>5(2+3)</quote>), differs depending on the parsing mode. In the conventional mode implicit multiplication does not differ from explicit multiplication (<quote>12/2(1+2) = 12/2×3 = 18</quote>, <quote>5x/5y = 5 × x/5 × y = xy</quote>). In the <quote>parse implicit multiplication first</quote> mode, implicit multiplication is parsed before explicit multiplication (<quote>12/2(1+2) = 12/(2 × 3) = 2</quote>, <quote>5x/5y = (5 × x)/(5 × y) = x/y</quote>). The default adaptive mode works as the <quote>parse implicit multiplication first</quote> mode, unless spaces are found (<quote>1/5x = 1/(5 × x)</quote>, but <quote>1/5 x = (1/5) × x</quote>). In the adaptive mode unit expressions are parsed separately (<quote>5 m/5 m/s = (5 × m)/(5 × (m/s)) = 1 s</quote>). Function arguments without parentheses are an exception, where implicit multiplication in front of variables and units is parsed first regardless of mode (<quote>sqrt 2x = sqrt(2x)</quote>).
</para>
<para>
If the limit implicit multiplication option is activated, the use of implicit multiplication when parsing expressions and displaying results will be limited to avoid confusion. For example, if this mode is not activated and <quote>integrte(5x)</quote> is accidently typed instead of <quote>integrate(5x)</quote>, the expression is interpreted as <quote>int(e × e × (5 × x) × gr × t)</quote> (displayed in history window). The result will then without any error be <quote>int(2.3940139x × km^2)</quote> instead of <quote>2.5x^2</quote>. If limit implicit multiplication is activated, the mistyped expression would instead show an error telling that <quote>integrte</quote> is not a valid variable, function or unit (unless unknowns is enabled in which case the result will be <quote>5 "integrate" × x</quote>). When implicit multiplication is limited, variables, functions and units must be separated by a space, operator or parenthesis (<quote>xy</quote> does not equal <quote>x × y</quote>).
</para>
<para>
In addition there are two special parsing modes — RPN syntax (for details see <xref linkend="qalculate-rpn"/>) and chain syntax. The chain syntax interprets expressions in a manner similar to the immediate execution mode of a traditional calculator. Instead of using the standard order of operations, the expression is simply calculated from left to right (e.g. <quote>1 + 2 × 3 = (1 + 2) × 3 = 9</quote> instead of <quote>1 + 2 × 3 = 1 + (2 × 3) = 7</quote>). Functions, with a single argument, apply to the value immediate to the left of the function name (e.g. <quote>1 + 2 sin = 1 + sin(2)</quote>), unless parentheses are used.
</para>
</sect1>
<sect1 id="qalculate-to">
<title>The <quote>to</quote> (and <quote>where</quote>) operators</title>
<para>
Putting <quote> to </quote> (or a right arrow, e.g. <quote>-></quote>) followed by an expression at the end of the mathematical expression is mainly used for unit conversion (see <xref linkend="qalculate-unit-conversion"/>). There are however also some convenient commands that can be typed after <quote> to </quote>. Here is a list of possible <quote>to</quote> values:
<variablelist>
<varlistentry>
<term>A unit or unit expression</term>
<listitem><para>Convert to a unit or a unit expression (e.g. <quote>5 ft + 2 in to meter = 1.5748 m</quote> or <quote>50 mph to km/h ≈ 80 km/h</quote>). Prepend with a question mark (?) to request the optimal prefix. Modifiers in front of the question mark selects the type of prefixes used — 'b' for binary prefixes, 'd' for decimal prefixes, and 'a' for all decimal prefixes including centi, deci, etc. (e.g. <quote>8 × 1024 bits to b?bytes = 1 kibibyte</quote>). Prepend with + or - to force/disable use of mixed units (e.g. <quote>5 m to + ft ≈ 5 yd + 1 ft + 4.9 in</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>A physical constant or a variable</term>
<listitem><para>Convert to variable as unit (e.g. <quote>500 km/ms to c ≈ 1.7 c</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>base</term>
<listitem><para>Convert to base units (e.g. <quote>1 lux to base = 1 cd/m<superscript>2</superscript></quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>optimal</term>
<listitem><para>Convert to optimal unit (e.g. <quote>(10 J)/(2 s) to optimal = 5 W</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>prefix</term>
<listitem><para>Convert to optimal prefix (e.g. <quote>€5000 to prefix = k€5</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>mixed</term>
<listitem><para>Convert to mixed units (e.g. <quote>90 s to mixed = 1 min + 30 s</quote>.</para></listitem>
</varlistentry>
<varlistentry>
<term>bin / binary</term>
<listitem><para>Show as binary number (e.g. <quote>sqrt(900) to bin = 0001 1110</quote>). Append an integer to specify the number of bits (e.g. <quote>4 to bin16 = 0000 0000 0000 0100</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>oct / octal</term>
<listitem><para>Show as octal number (e.g. <quote>52 to octal = 64</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>duo / duodecimal</term>
<listitem><para>Show as duodecimal number (e.g. <quote>152 to duo = 108</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>hex / hexadecimal</term>
<listitem><para>Show as hexadecimal number (e.g. <quote>623 to hex = 026F</quote>). Append an integer to specify the number of bits (e.g. <quote>4 to hex16 = 0004</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>sexa / sexa2 / sexa3 / sexagesimal</term>
<listitem><para>Show as sexagesimal number (e.g. <quote>7.33 to sexagesimal = 7°19′48″</quote>). For sexa2, arcseconds are hidden, and for sexa3 arcseconds are rounded.</para></listitem>
</varlistentry>
<varlistentry>
<term>longitude / longitude2 / latitude / latitude2</term>
<listitem><para>Show as sexagesimal latitude/longitude (e.g. <quote>-7.33 to latitude = 7°19′48″S</quote>). longitude2/latitude2 only shows degrees and arcminutes (e.g. <quote>-7.33 to latitude2 = 7°19.8′S</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>bijective</term>
<listitem><para>Show as bijective base-26 number (e.g. <quote>731 to bijective = ABC</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>binary16 / fp16, binary32 / float / fp32, binary64 / double / fp64, fp80, binary128 / fp128</term>
<listitem><para>Show as binary representation of IEEE 754 16-bit (half precision), 32-bit (single precision), 64-bit (double precision), 80-bit (x86 extended format), or 128-bit (quadruple precision) floating-point number.</para></listitem>
</varlistentry>
<varlistentry>
<term>time</term>
<listitem><para>Show in time format (e.g. <quote>7.25 to time = 7:15</quote>.</para></listitem>
</varlistentry>
<varlistentry>
<term>roman</term>
<listitem><para>Show as Roman numerals (e.g. <quote>1984 to roman = MCMLXXXIV</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>Unicode</term>
<listitem><para>Show as Unicode character(s) (uses UTF-32 for conversion, e.g. <quote>0x178 to Unicode = Ÿ</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>base #</term>
<listitem><para>Show using the specified base (e.g. <quote>523 to base 20 = 163</quote> or <quote>circumference(1) to base pi = 20</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>bases</term>
<listitem><para>Show as binary, octal, decimal, duodecimal, hexadecimal and Roman number (opens convert bases dialog with the mathematical expression).</para></listitem>
</varlistentry>
<varlistentry>
<term>rectangular / cartesian</term>
<listitem><para>Show complex number in rectangular form (e.g. <quote>0.28i − 2 to complex = 0.28i − 2</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>exponential</term>
<listitem><para>Show complex number in exponential form (e.g. <quote>0.28i − 2 to exponential ≈ 2e^(3i)</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>polar</term>
<listitem><para>Show complex number in polar form (e.g. <quote>0.28i − 2 to polar ≈ 2(cos(3) + i × sin(3))</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>angle / phasor</term>
<listitem><para>Show complex number in angle/phasor notation (e.g. <quote>0.28i − 2 to angle ≈ 2∠3</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>cis</term>
<listitem><para>Show complex number in cis form (e.g. <quote>0.28i − 2 to angle ≈ 2 cis 3</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>fraction</term>
<listitem><para>Show as mixed or simple (prepend with <quote>-</quote>) fraction (<quote>1.25 to fraction = 1 + 1/4</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>1/#</term>
<listitem><para>Show as mixed or simple (prepend with <quote>-</quote>) fraction with a specific denominator (<quote>2.7 to 1/3 ≈ 2 + 2/3</quote>, <quote>2.7 to -1/3 ≈ 8/3</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>partial fraction</term>
<listitem><para>Show expanded partial fractions (e.g. <quote>1 / (x<superscript>2</superscript> + 2x − 3) to partial fraction = 1 ∕ (4x − 4) − 1 ∕ (4x + 12)</quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>factors</term>
<listitem><para>Show factorized (algebraic or integer factorization, e.g. <quote>3 645 678 to factors = 857 × 709 × 3 × 2</quote> or <quote>x<superscript>2</superscript> + 4x + 4 to factors = (x + 2)<superscript>2</superscript></quote>).</para></listitem>
</varlistentry>
<varlistentry>
<term>calendars</term>
<listitem><para>Show date in different calendars (opens calendar conversion dialog).</para></listitem>
</varlistentry>
<varlistentry>
<term>UTC</term>
<listitem><para>Show date and time using UTC time zone.</para></listitem>
</varlistentry>
<varlistentry>
<term>UTC+/-hh[:mm]</term>
<listitem><para>Show date and time using specified time zone (e.g. UTC+08).</para></listitem>
</varlistentry>
</variablelist>
</para>
<para>
If <quote>to</quote> is not preceded by an expression, the previous result will be converted.
</para>
<para>
Similarly <quote>where</quote> (or alternatively <quote>/.</quote>) can be used at the end (but before <quote>to</quote>), for variable assignments, function replacements, etc. (e.g. <quote>x+y where x=1 and y=2</quote>, <quote>x^2=4 where x>0</quote>, and <quote>sin(5) where sin()=cos()</quote>). Variables assignments can also be placed before the expression, separated by comma, e.g. <quote>x=1, y=2, x+y</quote>, but this syntax is more strict.
</para>
<para>
Note that <quote>to</quote> and <quote>where</quote> can only be applied to the whole expression. Everything before the operator is always treated as the expression to convert (or apply replacement to), and everything after as the conversion/replacement expression, regardless of any parentheses.
</para>
</sect1>
</chapter>

<chapter id="qalculate-mode">
<title>Calculator Modes</title>
<para>
&app; 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 <menuchoice><guimenu>Mode</guimenu><guisubmenu>Meta Modes</guisubmenu></menuchoice> for quick access. The Preset and Default meta modes are always available and represents the state when &app; 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.
</para>
<variablelist>
	<varlistentry>
		<term>Number Bases</term>
		<listitem><para>
			Non-decimal bases can be selected for display of numbers in the result and parsing of numbers in expressions. This include regular number bases (binary, octal, hexadecimal, sexagesimal) as well as sexagesimal time format and roman numerals. Other number bases, as well as base for expression input, can be selected from a dialog window accessed from <menuchoice><guimenu>Mode</guimenu><guisubmenu>Number Base</guisubmenu><guimenuitem>Other...</guimenuitem></menuchoice> or <menuchoice><guimenu>Mode</guimenu><guisubmenu>Number Base</guisubmenu><guimenuitem>Select Result and Expression Base...</guimenuitem></menuchoice>.
			<table id="qalculate-TBL-number-bases" frame="topbot" colsep="1">
				<title>Supported Number Bases</title> 
				<tgroup cols="2" colsep="1" rowsep="0">
					<colspec colname="COLSPEC0"/>
					<colspec colname="COLSPEC1"/>
					<colspec colname="COLSPEC2"/>
					<thead>
						<row valign="top">
							<entry colname="COLSPEC0"><para>Radix</para></entry>
							<entry colname="COLSPEC1"><para>Digits</para></entry>
							<entry colname="COLSPEC2"><para>Comments</para></entry>
						</row>
					</thead> 
					<tbody>
						<row valign="top">
							<entry><para>2-10</para></entry>
							<entry><para>1-10</para></entry>
							<entry><para></para></entry>
						</row>
						<row valign="top">
							<entry><para>12</para></entry>
							<entry><para>1-10, ↊/X/A/a, ↋/E/B/b</para></entry>
							<entry><para>Supports all functions, variables and units that do not conflict with digits.</para></entry>
						</row>
						<row valign="top">
							<entry><para>11-36</para></entry>
							<entry><para>1-10, A-Z (case insensitive)</para></entry>
							<entry><para>Supports all functions, variables and units that do not conflict with digits.</para></entry>
						</row>
						<row valign="top">
							<entry><para>37-62</para></entry>
							<entry><para>1-10, A-Z, a-z</para></entry>
							<entry><para>Supports all functions, variables and units that do not conflict with digits.</para></entry>
						</row>
						<row valign="top">
							<entry><para>> 62</para></entry>
							<entry><para>Unicode characters (<quote>0</quote> = 62) or escaped values (<quote>\523</quote> = 523, <quote>\x7f</quote> = 127)</para></entry>
							<entry><para>Does not support operators, functions, variables or units. Result display only uses escaped values except for with base 1114112 (the <quote>Unicode</quote> base).</para></entry>
						</row>
						<row valign="top">
							<entry><para>Negative bases (e.g. -2)</para></entry>
							<entry><para>Same as corresponding positive base</para></entry>
							<entry><para>Result display only supports negative integer bases.</para></entry>
						</row>
						<row valign="top">
							<entry><para>Non-integer bases (e.g. √2)</para></entry>
							<entry><para>Same as corresponding integer base (rounded away from zero)</para></entry>
							<entry><para>Result display only supports real bases.</para></entry>
						</row>
					</tbody>
				</tgroup>
			</table>
			The convert number bases dialog (see <xref linkend="qalculate-convert-number-bases-dialog"/>) and the programming keypad (see <xref linkend="qalculate-TBL-programming-keypad"/>) provides efficient conversion between common bases. For output of a single value to a specific number base use of the <quote>to</quote>-operator is recommended (see <xref linkend="qalculate-to"/>). For input of a single number in a specific base, the <command>base()</command> function, which in addition supports non-numerical bases, or base prefixes (<quote>0b</quote>, <quote>0o</quote>, <quote>0d</quote>, and <quote>0x</quote> for base 2, 8, 12, and 16, respectively) can be used.
			</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Numerical Display</term>
		<listitem><para>
			These modes mainly control when numbers are displayed exponentially (e.g. <quote>2.62E3</quote> which equals <quote>2620</quote>). 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.
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Indicate Repeating Decimals</term>
		<listitem><para>
			If this option is on, &app; will not round infinitely repeating digit sequences, if the digits in the sequence fits the maximum number of decimals. Instead <quote>…</quote> will be displayed after the repeated digits and the result indicated as exact (compare <quote>9/11 ≈ 0,81818182</quote> with <quote>9/11 = 0,81 81…</quote>).
			</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Rounding</term>
		<listitem><para>
			By default approximately displayed numbers are rounded towards nearest decimal (e.g. <quote>2.64 ≈ 2.6</quote>, <quote>2.67 ≈ 2.7</quote>), and away from zero if the number is halfway between two values (e.g. <quote>2.65 ≈ 2.7</quote>, <quote>−2.65 ≈ −2.7</quote>). This can be changed by activating <guimenuitem>Round Halfway Numbers to Even</guimenuitem> (e.g. <quote>2.55 ≈ 2.6</quote>, <quote>2.65 ≈ 2.6</quote>) or <guimenuitem>Truncate Numbers</guimenuitem> (if activated, numbers are always rounded towards zero, e.g. <quote>2.67 ≈ 2.6</quote>).
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Show Ending Zeroes</term>
		<listitem><para>
			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.
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Negative Exponents</term>
		<listitem><para>
			If negative exponents is activated, division is shown as a negative power (e.g. <quote>x × y^-1</quote> instead of <quote>x / y</quote>). 
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Sort Minus Last</term>
		<listitem><para>
			This option decides if minus signs should be avoided in the first positions of the result expression.
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Complex Number Form</term>
		<listitem><para>
			Complex number can be displayed in rectangular/cartesian (e.g. <quote>5i + 2</quote>), exponential (e.g. <quote>5.39 × e^1.19</quote>),  polar form (e.g. <quote>5.39 × (cos(1.19) + i × sin(1.19))</quote>), or angle/phasor notation (e.g. <quote>5.39∠1.19</quote>). 
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Rational Number Form</term>
		<listitem><para>
			This controls if rational numbers are displayed as fractions or not. The exact decimal fraction mode displays the number as a simple fraction, if the rational number does not have an exact decimal representation which can be displayed using the number of digits allowed by the current precision. The rational number <quote>4/3</quote> is displayed as <quote>1.3333333</quote> (or <quote>1.333…</quote> if indicate repeating decimals is activated) in decimal fractions mode, as <quote>4/3</quote> in both exact decimal fractions and simple fractions mode, and as <quote>1 + 1/3</quote> in mixed fractions mode.
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Unit Display</term>
		<listitem><para>
			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 divisible by three (centi, deci, deca and hecto), as well the new SI prefixes adopted in 2022 (ronna, quetta, ronto, and quecto), are not used automatically. If denominator prefixes are not explicitly enabled, prefixes will only be set for the numerator in a fractional unit expression (e.g. <quote>1 Mg/m</quote> or <quote>1 kg/mm</quote>), unless there is no unit in the numerator. Binary prefixes are never used automatically, unless activated for information units (bits, bytes, etc.) in the preferences dialog.
		</para>
		<para>
			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 <guimenuitem>Convert to Optimal SI unit</guimenuitem> 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. <quote>60.2 minutes = 1 hour to 12 seconds</quote>.
		</para>
		<para>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 <quote>(5x × m)/(y × s)</quote> and <quote>5x/y m/s</quote>).
		</para>
		</listitem>
	</varlistentry>
	<varlistentry>
		<term>Abbreviate Names</term>
		<listitem><para>
			The display of unit, prefix, variable and function names can be controlled by selecting to display abbreviations or full length names (e.g. <quote>5 cm</quote> or <quote>5 centimeters</quote>). Both abbreviations and long names can however always be entered in expressions.
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Approximation</term>
		<listitem><para>
			When always exact mode is on, the calculation will not go further than what can be calculated exactly (e.g. <quote>sqrt(2 + 3) = sqrt(5)</quote>). The  default <quote>Try Exact</quote> mode, will calculate the result exact as far as possible and then approximately. Approximate mode will directly calculate an approximate result, thus being a bit faster but giving a less correct approximate indication (<quote>sin(pi/2)</quote> 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 <xref linkend="qalculate-interval-arithmetic"/>).
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Assumptions</term>
		<listitem><para>
			This controls the default assumptions for unknown variables without explicitly defined assumptions. See <xref linkend="qalculate-variables"/>.
			The assume denominators non-zero alternative makes it possible to avoid the situation where expressions such as <quote>(x-1)/(x-1)</quote> 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.
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Parsing Mode</term>
		<listitem><para>
			These options control 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 <xref linkend="qalculate-implicit-multiplication"/>.
			If the read precision option is activated, decimal numbers are interpreted as approximate with precision equal to the number of digits (e.g. <quote>1.1 × 3.20 = 1.1±0.05 × 3.20±0.005 ≈ 3.5±0.2</quote>).
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Precision</term>
		<listitem><para>
			Precision specifies the default number of significant digits displayed and determines the precision used for approximate calculations. The internal precision is higher than the one specified, but will nevertheless not completely protect against loss of significance/catastrophic cancellation (and you will not be alerted unless interval arithmetic is activated).
		</para></listitem>
	</varlistentry>
	<varlistentry>
		<term>Decimals</term>
		<listitem><para>
			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).
		</para></listitem>
	</varlistentry>	
</variablelist>
<sect1 id="qalculate-rpn">
<title>The RPN Mode</title>
<para>
The Reverse Polish Notation mode can be activated from <menuchoice><guimenu>Mode</guimenu><guimenuitem>RPN Mode</guimenuitem></menuchoice>, <keycombo><keycap>Ctrl</keycap><keycap>R</keycap></keycombo> 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 <ulink url="http://en.wikipedia.org/wiki/Reverse_Polish_notation">RPN article at Wikipedia</ulink>.
</para>
<para>
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.
</para>
<para>
For example, <command>5 ENTER 3 + 2 /</command> 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 <quote>(5 + 3)/2</quote>.
</para>
<para>
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. <command>5 ENTER 2 ENTER rem</command> equals <quote>rem(5, 2)</quote>). Functions with a vector argument use all stack registers (unless the top value is a vector). This is quite useful for statistical functions (e.g. <command>5 ENTER 2 ENTER 3 ENTER 4 ENTER harmmean</command> calculates the harmonic mean of 5, 2, 3, and 4 and leaves the result, 3.1169, as the only value on the stack).
</para>
<para>
When the RPN stack is enabled, full expressions can still be entered (you can add e.g. <quote>5x + 3 + 23 + sin(2)</quote> directly to the stack). The buttons on the keypad do not insert operators and functions in the expression entry, but instead apply them to the stack. This is also true for the keys on the keyboard, unless deactivated in the preferences (<menuchoice><guimenu>Edit</guimenu><guimenuitem>Preferences</guimenuitem></menuchoice>, <guilabel>Use only keypad keys for RPN</guilabel>). <keycap>Enter</keycap> calculates the current expression 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. If the expression only contains an operator or a single function without arguments, the operator/function is applied to the stack.
</para>
<figure id="qalculate-FIG-rpn-mode">
	<title>RPN Mode</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/rpn-mode.png" format="PNG" width="493"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
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.</para>
<para>
On the right are buttons for manipulation of the stack. The buttons move the selected value up (<keycombo><keycap>Ctrl</keycap><keycap>Up</keycap></keycombo>) or down (<keycombo><keycap>Ctrl</keycap><keycap>Down</keycap></keycombo>), move it to the top (<keycombo><keycap>Ctrl</keycap><keycap>Right</keycap></keycombo>), copy it (<keycombo><keycap>Ctrl</keycap><keycap>Shift</keycap><keycap>C</keycap></keycombo>), edit it, or remove it (<keycombo><keycap>Ctrl</keycap><keycap>Delete</keycap></keycombo>), 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 top value of the stack. The button between copy and delete enters the top value from before the last numeric operation (<keycombo><keycap>Ctrl</keycap><keycap>Left</keycap></keycombo>). The last button removes all values from the stack (<keycombo><keycap>Ctrl</keycap><keycap>Shift</keycap><keycap>Delete</keycap></keycombo>).
</para>
<para>
On the left are buttons for applying mathematical operations to the stack. The top left buttons applies addition, subtraction, multiplication, division, and exponentiation to the top two values. If only one value is available addition, multiplication, and exponentiation uses this value twice, while the subtraction button negates the value and the division button calculates the reciprocal. The buttons below negates the top value, calculates the reciprocal, and calculates the square root of the top value. The last button calculates the sum of all values on the stack. Changes in the display of results only affects the first value on the stack.
</para>
<para>
Reverse Polish Notation can also be used directly in expression. This can be activated or deactivated separately from the RPN stack (<menuchoice><guimenu>Mode</guimenu><guimenuitem>Parsing Mode</guimenuitem><guimenuitem>RPN Syntax</guimenuitem></menuchoice>). 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 <quote>(5 + 3)/2</quote>, as in the example above, with RPN syntax you should enter the expression <quote>5 3 + 2 /</quote>. 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.
</para>
</sect1>
</chapter>
<chapter id="qalculate-interval-arithmetic">
<title>Propagation of Uncertainty and Interval Arithmetic</title>
<para>
Two different algorithms for calculation of intervals or propagation of uncertainties are supported (selectable from <menuchoice><guimenu>Mode</guimenu><guimenu>Interval Calculation</guimenu></menuchoice>). This applies to numbers, defined using the <command>interval()</command> function or <quote>±</quote> notation, or with <quote>read precision</quote> enabled, and variables, including physical constants, with specified standard uncertainty. The uncertainty will be calculated separately for non-differentiable functions.
</para>
<para>
By default the variance formula is used. Intervals are with this method treated as values with measurement uncertainties (the value 5±0.01 has a standard deviation of 0.01). The final uncertainty, or error, is estimated using partial derivatives, as shown below. For expressions involving complex numbers, the imaginary uncertainty are calculated separately.
</para>
<figure id="qalculate-FIG-variance-formula">
	<title>Variance Formula</title>
	<mediaobject>
		<imageobject>
			<imagedata fileref="figures/variance-formula.svg" format="SVG" width="350"/>
		</imageobject>
	</mediaobject>
</figure>
<para>Alternatively interval arithmetic can be used. Intervals are treated as an absolute range of values and the result represents all possible values for every value within all ranges in the expression. For monotonic functions the endpoints in the result corresponds to the function values for the endpoints of the input (e.g. <quote>interval(x, y)^3=interval(x^3, y^3)</quote>).
</para> 
<para>
Interval arithmetic is also used implicitly, regardless of selected interval calculation algorithm, for all approximate calculations to keep track of precision changes, and gracefully handle for example catastrophic cancellation (in subtraction two nearly equal numbers). The behavior can be (de)activated using <menuchoice><guimenu>Mode</guimenu><guimenu>Approximation</guimenu><guimenuitem>Interval Arithmetic</guimenuitem></menuchoice>.
</para>
<para>
Some non-invertible functions (including bessel and airy functions) do not properly support interval arithmetic and only the function values for the endpoints of the interval are calculated. Trigonometric functions returns 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 for non-trivial expression (especially involving complex numbers) return an interval that is too wide.
</para>
<para>
The result is by default shown as an ordinary number with the number of significant digits determined by the size of the uncertainty (<quote>2.11±0.03 = 2.1</quote>), or the width of interval, unless the interval is too wide. If the <command>interval()</command> function has been used in the expression the result is by default displayed as an interval, and if <quote>±</quote> notation (or the <command>uncertainty()</command> function) has been used, it will also be used in the result. The default behavior can be changed from<menuchoice><guimenu>Mode</guimenu><guimenu>Interval Display</guimenu></menuchoice>. The midpoint alternative displays the value halfway between the lower and upper limit of the interval (<quote>interval(2.075, 2.15) = 2.1125</quote>). Note that, for the plus/minus notation, the same midpoint (note that when interval arithmetic is enabled this does not necessarily equal the result for the midpoint of intervals in the expression) is displayed in front of the plus/minus symbol. In plus/minus notation, the uncertainty is displayed with two significant digits, with the exception that all digits before the decimal separator are always shown.
</para>
</chapter>
<chapter id="qalculate-variables">
<title>Variables</title>
<para>
Variables are used to conveniently store a fixed value/result under a name. Variables can store everything that a result may contain, including numbers, units, variables, unsolved expressions and functions etc.
</para>
<para>
There are two different kinds of variables: known and unknown. Known variables represent a fixed value, usually a number, while unknown variables represent a range or type of values (e.g. a non-negative integer). 
</para>
<para>
Some common constants that can only be approximately represented by a real number, such as pi and e, are special known variables. They are not fixed but are recalculated each time precision changes, thereby not compromising the arbitrary precision of &app;.
</para>
<para>
The <command>ans</command> variable always contains the most recent result. For multiple results of an equation, this variable contains a vector of solutions (access the first solution using <quote>ans(1)</quote>).
</para>
<para>
The unknown variables x, y and z are predefined. They cannot be deleted, but changed. By default they use the default assumptions.
</para>
<para>
For a complete list of available variables see <xref linkend="qalculate-definitions-variables"/> or the variable manager.
</para>
<sect1 id="qalculate-variable-creation">
<title>Variable creation/editing</title>
<figure id="qalculate-FIG-store-variable">
	<title>Store Result</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/store-variable.png" format="PNG" width="284"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
The easiest way to create a known variable is to store the current result. This can be done by clicking the <guibutton>STO</guibutton> button or selecting <menuchoice><guimenu>File</guimenu><guimenuitem>Store Result...</guimenuitem></menuchoice>. Type a name for the variable in the dialog that pops up. The name is used in expressions (e.g. <quote>var_1 + 5</quote> if the variable is named <quote>var_1</quote>). Temporary variables (placed in the <quote>Temporary</quote> category) disappear when &app; is closed.
</para>
<para>
Known variables can also be created from scratch by selecting <menuchoice><guimenu>File</guimenu><guisubmenu>New</guisubmenu><guimenuitem>Variable</guimenuitem></menuchoice>  or by clicking <guibutton>New</guibutton> in the variable manager. The value is entered in the text field below the name. Any mathematical expression is allowed as value (e.g. <quote>π m</quote> or <quote>sin(2) + ln(3)</quote>).
</para>
<para>
It is possible to specify multiple names, and various properties of these names, by clicking the icon on the right side of the name field.
</para>
<para>
The second page of the dialog provides fields for entry of descriptive name (shown as title in menus), category, and description.
</para>
<figure id="qalculate-FIG-edit-variable">
	<title>New Variable</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/edit-variable.png" format="PNG" width="349"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
Alternatively values can be stored in variables using the <command>save()</command> function, or the associated <quote>:=</quote>/<quote>=</quote> operators (e.g. <quote>save(v1, 5)</quote> or <quote>v1:=5</quote>, <quote>save(v1, ln(5)+2,,,1)</quote> or <quote>v1=ln(5)+2</quote>).
</para>
<para>
The dialog for creation of unknown variables is accessed by selecting <menuchoice><guimenu>File</guimenu><guisubmenu>New</guisubmenu><guimenuitem>Unknown Variable</guimenuitem></menuchoice>. Instead of a value, an assumed type and sign can then be selected.
</para>
<para>
Edit a variable by clicking <guibutton>Edit</guibutton> in the variable manager, or using the context menu (right-click) of the corresponding menu item in the menu of the <guibutton>STO</guibutton>.
</para>
<para>
The special <guibutton>MR</guibutton> (<guibutton>=</guibutton> right-click) variable is updated using the classic <guibutton>MC</guibutton> (<guibutton>AC</guibutton> right-click), <guibutton>MS</guibutton> ((<guibutton>=</guibutton> middle-click), <guibutton>M+</guibutton> (<guibutton>+</guibutton> right-click), and <guibutton>M−</guibutton> (<guibutton>DEL</guibutton> middle-click) operations.
</para>
</sect1>
<sect1 id="qalculate-vectors-matrices">
<title>Vectors and Matrices</title>
<para>
Vectors and matrices are most effectively used stored in a variable. &app; provides separate tools for these variables. They use a different dialog, where each element can be edited separately as in a spreadsheet. As with other variables, click <guibutton>Edit</guibutton> in the variable manager to edit a matrix/vector variable, but to create a new, select <menuchoice><guimenu>File</guimenu><guisubmenu>New</guisubmenu><guimenuitem>Matrix</guimenuitem></menuchoice> or <menuchoice><guimenu>File</guimenu><guisubmenu>New</guisubmenu><guimenuitem>Vector</guimenuitem></menuchoice>.
</para>
<figure id="qalculate-FIG-edit-matrix">
	<title>Matrix/Vector Edit Dialog</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/edit-matrix.png" format="PNG" width="521"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
In this dialog, name, category and descriptive name are typed in as usual, but instead of a single value field, multiple values are entered using a table. The number of rows and columns are selected using the controls above the table. In a vector this only determines how many cells that are shown in the table and empty cells will be ignored. For matrices, each cell in the table is an element in the matrix.
</para>
<para>
Matrices and vectors can also be loaded from data files. These files must be plain text files with values organized in separated rows and columns. Select <menuchoice><guimenu>File</guimenu><guimenuitem>Import CSV File...</guimenuitem></menuchoice> and a dialog window pops up. First select the file to import and then specify whether it shall be imported as a matrix or vectors. A name, descriptive name and category can optionally be typed in. If the name field is empty, the file name will be used instead. After that, the row in the file where the data starts should be specified, as well as whether this first row contains column headings. Finally the delimiter, used to separate columns in the file, must be selected. Click <guibutton>OK</guibutton> and variables will be generated from the file. If vectors are to be generated and the file contains more than one column, the name will be used as a subcategory and each variable will add the column heading (or <quote>Column 1</quote>, <quote>Column 2</quote>, ...) to the name and the descriptive name.
</para>
<figure id="qalculate-FIG-import-csv">
	<title>Import CSV Dialog</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/import-csv.png" format="PNG" width="332"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
The <command>load()</command> function can be used to access a CSV file directly in an expression. The reversed action is also available with <command>export()</command>, or the dialog accessed with <menuchoice><guimenu>File</guimenu><guimenuitem>Export CSV File...</guimenuitem></menuchoice> or from the variable manager.
</para>
</sect1>
</chapter>

<chapter id="qalculate-functions">
<title>Functions</title>
<para>
Functions are essentially mathematical formulas. They are used to store expressions with variable values, arguments. To execute a function, the values for a number of arguments need to specified. These arguments are then inserted into the expression, making it possible to calculate.
</para>
<para>
Functions are normally entered in an expression by writing the name followed by arguments, separated by commas (or semicolons in languages with comma as decimal point), in parenthesis, thus following the syntax <command>name(arg1, arg2, ...)</command>. &app; will give a helpful error message if the arguments are not correct.
</para>
<figure id="qalculate-FIG-insert-function">
	<title>Insert function dialog</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/insert-function.png" format="PNG" width="644"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
The insert function dialog presents an easy way to insert a function and its arguments.
</para>
<para>
Although it can lower the readability of an expression, it is perfectly legal to skip the parenthesis and put the arguments after a space, and end with a space or operator. This is most useful in short expressions with single argument functions (e.g. <quote>sqrt 5</quote>).
</para>
<para>
Argument types include:
<itemizedlist>
	<listitem><para>Free — anything</para></listitem>
	<listitem><para>Number — a numeric value</para></listitem>
	<listitem><para>Integer — a whole number</para></listitem>
	<listitem><para>Symbol — a defined or undefined unknown variable</para></listitem>
	<listitem><para>Text — a free text string</para></listitem>
	<listitem><para>Date — a date in local or standard format (Year-Month-Day, recommended)</para></listitem>
	<listitem><para>Vector</para></listitem>
	<listitem><para>Matrix</para></listitem>
	<listitem><para>Boolean — 0 for false, 1 for true</para></listitem>
	<listitem><para>Object — the name of a variable, function or unit</para></listitem>
	<listitem><para>Variable — the name of a variable</para></listitem>
	<listitem><para>Function — the name of a function</para></listitem>
	<listitem><para>Unit — the name of a unit</para></listitem>
	<listitem><para>File — the path to a file</para></listitem>
	<listitem><para>Angle — an angle used in trigonometric functions, meaning a number and an angle unit. If no angle unit is included the default is used.</para></listitem>
</itemizedlist>
</para>
<para>
The argument can be restricted by further conditions. For example that a number must be positive.
</para>
<para>
Most arguments (primarily number arguments) can be replaced by a vector. The function will then be calculated for each vector element and a new vector will be returned. If more than one argument are supplied to a function that takes exactly one argument, each argument will be treated as elements of a vector.
</para>
<sect1 id="qalculate-available-functions">
<title>Available Functions</title>
<para>
Here the main function categories and some of their members are described, to give an overview of available functions. For information about separate functions and a complete list of all available functions see <xref linkend="qalculate-definitions-functions"/> or the function manager.
<variablelist>
<varlistentry>
<term>Algebra</term>
<listitem><para>
Contains <command>sum()</command> and <command>product()</command>, which corresponds to the sum and product signs. <command>solve()</command> solves equations (e.g. <quote>solve(x × 2 = 8)</quote> returns <quote>4</quote> meaning that x equals 4). Use <command>solve2()</command> and <command>multisolve()</command> to solve multiple equations with multiple variables.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Calculus</term>
<listitem><para>
Includes <command>diff()</command>, which calculates the derivative of an expression with optional arguments <quote>with respect to</quote> (default x) and <quote>order</quote> (default 1), and a limited integration function.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Combinatorics</term>
<listitem><para>
Contains functions such as <command>perm()</command> for permutations, <command>comb()</command> for combinations, and <command>factorial()</command>.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Complex Numbers</term>
<listitem><para>
Contains functions useful for calculations with complex numbers, including <command>arg()</command> for principal argument and <command>conj()</command> for conjugate.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Data Sets</term>
<listitem><para>
A data set consists of a set of properties and objects, which can be accessed by a function which takes two arguments — object and property. The function returns the object's value for the selected property.
For example, the data in the <quote>Elements</quote> data set is accessed with the <command>atom()</command> function, with the element (referenced using atomic symbol, number or name) and property (e.g. weight) as arguments.
The special property <quote>info</quote> displays all properties of the object in a dialog window.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Date &amp; Time</term>
<listitem><para>
Includes <command>days()</command> and <command>yearfrac()</command> which returns the number of days and fractional years, respectively, between two dates. 
</para></listitem>
</varlistentry>
<varlistentry>
<term>Exponents &amp; Logarithms</term>
<listitem><para>
Standard logarithmic and exponential functions. <command>ln()</command> calculates the natural logarithm of a number, while <command>log()</command> allows a choice of base as the second argument. The <command>cbrt()</command> and <command>root()</command> functions only calculates real roots. For roots of odd degree the root functions give a different answer than the exponential operator, <quote>^</quote>, for negative values (<quote>cbrt(-8) = -(8)^(1/3) = -2</quote>, but <quote>(-8)^(1/3) = 1 + 1.73i</quote>).
</para></listitem>
</varlistentry>
<varlistentry>
<term>Economics</term>
<listitem><para>
This essentially includes most of the financial functions that are usually found in spreadsheet applications.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Elements</term>
<listitem><para>
This category includes functions to retrieve data such as atomic weight. The <command>atom()</command> function opens a window with available data of an element. These functions accept the number, symbol or name of the element as argument. The data are loaded on demand.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Geometry</term>
<listitem><para>
Category with formulas mostly for calculation of circumference, area and volume of geometric shapes.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Logical</term>
<listitem><para>
Some procedural functions mainly for use in other functions. These include <command>if()</command>, which tests a conditional expression and returns a value depending on if the expression evaluates true or false, and <command>for()</command>, which processes a value while a condition is true.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Matrices &amp; Vectors</term>
<listitem><para>
These are functions that generate, access and process matrices and vectors. The <command>vector()</command> function generates a vector from a variable number of arguments for elements, while <command>matrix()</command> first needs the number of rows and columns and then the elements from left to right. Matrices can also be imported directly from a CSV file with <command>load()</command>. 
</para>
<para>
Separate elements at a specified row and column are accessed with <command>element()</command>. Other functions include <command>det()</command> for calculation of the determinant of a matrix and <command>inverse()</command> which returns the inverse of the given matrix, as well as functions such as <command>sort()</command> and <command>rank()</command>.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Miscellaneous</term>
<listitem><para>
A category for functions that do not fit elsewhere. 
</para></listitem>
</varlistentry>
<varlistentry>
<term>Number Theory</term>
<listitem><para>
Contains subcategories arithmetic, number bases, and rounding, in addition to functions such as <command>abs()</command>, which returns the absolute value of a number (<quote>|</quote> can also be used; e.g. <quote>|-5| = abs(-5) = 5</quote>, and <command>gcd()</command>, the greatest common divisor. <command>round()</command> is the standard rounding function. The functions for number bases translates a text string, representing an expression with numbers in a different base, to a decimal number. Includes <command>bin()</command> for binary numbers, <command>hex()</command> for hexadecimal numbers, <command>oct()</command> for octal numbers and <command>base()</command> for numbers in a any other base.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Special Functions</term>
<listitem><para>
Includes <command>beta()</command>, <command>gamma()</command> and similar functions, as well as Riemann zeta (<command>zeta()</command>) and Kronecker delta (<command>kronecker()</command>).
</para></listitem>
</varlistentry>
<varlistentry>
<term>Statistics</term>
<listitem><para>
Contains a lot of functions for descriptive statistics and some statistical tests. Data sets are stored as vectors. Generally, functions with a vector/data set as last argument can take elements/samples as a variable number of arguments directly instead of in a vector (e.g. <quote>mean(1, 2, 3)</quote> equals <quote>mean(vector(1, 2, 3))</quote>). Also contains the <command>rand()</command> function, which returns a pseudo random number between 0 and 1 (with no argument, or zero), or a random integer between one and the specified number.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Trigonometry</term>
<listitem><para>
Trigonometric functions, including <command>sin()</command>, <command>cos()</command>, <command>tan()</command>, <command>sec()</command>, <command>csc()</command>, <command>cot()</command>, and hyperbolic and inverse versions of those. These functions take as argument an angle. If the default angle unit (<menuchoice><guimenu>Mode</guimenu><guisubmenu>Angle Unit</guisubmenu></menuchoice>) is set to none, the argument must have an angle unit appended (degrees, radians or gradians), otherwise the default unit will be appended automatically (and removed from result of inverse functions).
</para></listitem>
</varlistentry>
<varlistentry>
<term>Utilities</term>
<listitem><para>
Various utility functions. Most are only useful in definition of other functions. The <command>save()</command> function can however be a quick way of storing a value in a variable, and <command>csum()</command> can be a powerful tool for data processing. This category also contains some functions, such as <command>char()</command> and <command>ascii()</command>, that might be useful for programmers. <command>replace()</command> provides an easy way of replacing unknown variables by known expressions in a value (e.g. <quote>replace(5x^2 + x, x, 3)</quote> equals <quote>5 × 3^2 + 3</quote>).
</para></listitem>
</varlistentry>
</variablelist>
</para>
</sect1>
<sect1 id="qalculate-function-creation">
<title>Function creation/editing</title>
<para>
Functions are a bit more complex than variables, but can nevertheless be relatively easily created. Select <menuchoice><guimenu>File</guimenu><guisubmenu>New</guisubmenu><guimenuitem>Function</guimenuitem></menuchoice>, or click the <guibutton>f(x)</guibutton> on the keypad or <guibutton>New</guibutton> in the function manager and a function edit dialog pops up.
</para>
<para>
The function edit dialog is divided in three pages, where the first page contains the only required properties — name and an expression. x, y and z with or without (default) a backslash are used as argument placeholders in the expression.
</para>
<figure id="qalculate-FIG-edit-function">
	<title>Function Edit Dialog</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/edit-function.png" format="PNG" width="349"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
First enter a name, used to reference the function in an expression. Then enter an expression below.
</para>
<para>
The expression of a function is basically a normal expression with placeholders for arguments. The expression <quote>x^4</quote> creates a function which calculates the fourth power of a single argument. If you name it for example <quote>sqsq</quote>, <quote>sqsq(2)</quote> will calculate <quote>2^4</quote>.
</para>
<para>
The argument placeholders consist of a backslash and a letter — x, y, z for the 1st, 2nd and 3rd arguments and a to u for argument 4 to 24. The backslash can however be omitted, but avoids any possible conflict with existing variables, units and functions used in the expression. The argument symbols are replaced by entered arguments when a function is calculated. They also decide the number of arguments that a function requires. For example the function for triangle area (<quote>base × height / 2</quote>) has the name triangle and the expression <quote>(\x × \y)/2</quote>, which gives that <quote>triangle(2, 3)</quote> equals <quote>(2 × 3) / 2</quote> and returns <quote>3</quote> as result. An argument can be used more than one time and all arguments must not necessarily be in order in the expression.
</para>
<para>
Additionally, optional arguments can be put in the expression with upper-case (X, Y, Z, ...) instead of lower-case letters (x, y, z, ...). The default value should be put in curly brackets after the letter (e.g. <quote>\X{2}</quote>). The default value may be omitted and is then zero. All additional arguments after an optional argument must also be optional.
</para>
<figure id="qalculate-FIG-edit-function-details">
	<title>Function Edit Dialog</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/edit-function-details.png" format="PNG" width="349"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
A required condition, sub-functions, and argument definitions can optionally be specified in the second page (<quote>Details</quote>).
</para>
<para>
The condition specifies an expression which must evaluate true before the function is calculated. This follows the same conventions as function expressions. For example, if the value of the second argument must be higher than the first, <quote>\y &gt; \x</quote> may be entered as a condition.
</para>
<para>
Sub-functions can be useful for complex functions, they use the same syntax as the main expression, and are references using a backslash followed by a number (e.g. <quote>\1</quote> for the first sub-function). The sub-function can be inserted in the main expression as a precalculated value or intact (meaning that the subfunction might be recalculated for each occurrence in the main expression).
</para>
<para>
Name, type, and required conditions can be specified for each argument.
</para>
<para>
The third page allows entering of category, descriptive name (shown as title in menus) and description. The function can also be hidden from menus with the corresponding check box, which can be useful for functions only used in other functions.
</para>
<para>
Global, system-wide functions can not actually be changed by the user, but if one of these functions is edited, they are deactivated and seemingly replaced by a new function. Some functions are however hard-coded and cannot be changed by the user. Once the user function is removed or deactivated the original function is automatically reactivated.
</para>
</sect1>
</chapter>

<chapter id="qalculate-units">
<title>Units</title>
<para>
Units give numbers meaning in the real world. They specify what is measured by the numbers and the scale used. &app; fully incorporates units in calculations and includes all standard SI units as well as many non-standard local units.
For a complete list of available units see <xref linkend="qalculate-definitions-units"/> or the unit manager.
</para>
<sect1 id="qalculate-currency">
<title>Currency</title>
<para>
Among units, &app; has support for currencies with up-to-date exchange rates. Currencies are normally referenced with the standard three letter code due to name clashes, but a number of currency unit can also be accessed through their regular name and symbol. U.S. dollars can, for example, be referenced both as USD and dollar/dollars or the $ symbol, unless the same name and/or symbol are used by the local currency. 
</para>
<para>The exchange rates can be updated manually using <menuchoice><guimenu>File</guimenu><guimenuitem>Update Exchange Rates</guimenuitem></menuchoice>, or automatically at specific intervals (by default once every week, but this can be changed in the preferences dialog), when needed (when currencies are converted).
</para>
</sect1>
<sect1 id="qalculate-unit-conversion">
<title>Conversion</title>
<para>
Expressions can be converted to a specific unit directly in the expression entry with the <quote>to</quote> operator (right arrows, including <quote>-></quote> are also supported), which converts the left-hand expression (or the previous result) to a specified unit (e.g. <quote>5 feet + 2 inches to cm</quote> converts the result of <quote>5 feet + 2 inches</quote> to centimeters). Unit expressions may contain units, prefixes, exponents, multiplication and division. By default, no prefix will be added to units typed without prefix, but this behavior can be modified by putting a question mark in front of the unit expression (<quote>6 561 ft to m ≈ 2000 m</quote> but <quote>6 561 ft to ?m ≈ 2 km</quote>). Type <quote>to optimal</quote> to get optimal unit, <quote>to base</quote> for base units, or <quote>to mixed</quote> to force the use of mixed units (see below). Note that the conversion is always applied to the whole left-hand expression, ignoring any unmatched parentheses. The <quote>to</quote> operator can also be used for other types of result transformations (see <xref linkend="qalculate-to"/>).
</para>
<para>
Alternatively the unit conversion view can be used. It is opened using <guilabel>Conversion</guilabel>, <keycombo><keycap>Ctrl</keycap><keycap>O</keycap></keycombo>, <menuchoice><guimenu>Edit</guimenu><guimenuitem>Convert To Unit Expression...</guimenuitem></menuchoice> or <keycombo><keycap>Ctrl</keycap><keycap>T</keycap></keycombo> (the last two options moves the focus to the unit expression entry). Enter a unit expression in the text entry and press <keycap>Enter</keycap> (or click <guibutton>Convert</guibutton>), or select a unit from the list. An appropriate unit category will automatically be selected from units in the current result. If <guibutton>Continuous expression</guibutton> is checked subsequent results will automatically be converted (if the conversion view is open), and if <guibutton>Add prefix</guibutton> is checked the optimal prefix will be set for unit expressions without any prefix. A unit can be inserted directly into the expression entry from the list using middle click or the context menu.
<figure id="qalculate-FIG-unit-conversion">
	<title>Unit Conversion View</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/convert-unit.png" format="PNG" width="508"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
</para>
<para>
The result context menu and the menu associated with the <guibutton>to (x ➞)</guibutton> keypad button also provides a list of units for conversion.
</para>
<para>
The final way to convert the result to another unit is to use <menuchoice><guimenu>Edit</guimenu><guisubmenu>Convert To Unit</guisubmenu></menuchoice> menu or to press <guibutton>Convert Result</guibutton> in the unit manager, which also provides quick conversion of a value between two selected units. <menuchoice><guimenu>Edit</guimenu><guisubmenu>Set Prefix</guisubmenu></menuchoice> can be used to select a prefix.
</para>
<para>
It is also possible to let &app; automagically convert the result to appropriate units with <menuchoice><guimenu>Edit</guimenu><guisubmenu>Convert To Optimal Unit</guisubmenu></menuchoice> or <menuchoice><guimenu>Edit</guimenu><guisubmenu>Convert To Base Units</guisubmenu></menuchoice> (or the corresponding options in the result context menu). If instead the corresponding choice is selected from <menuchoice><guimenu>Mode</guimenu><guimenu>Unit Display</guimenu></menuchoice> (or the result context menu), each result will automatically be converted until the choice is deactivated (<menuchoice><guimenu>Mode</guimenu><guimenu>Unit Display</guimenu><guisubmenu>No Automatic Conversion</guisubmenu></menuchoice>).
</para>
<para>
By default (controlled by <menuchoice><guimenu>Mode</guimenu><guisubmenu>Unit Display</guisubmenu><guimenuitem>Convert To Mixed Units</guimenuitem></menuchoice>) certain units, such as time units and many imperial/U.S. customary units, are automatically converted to mixed units (e.g. <quote>60.2 minutes = 1 hour to 12 seconds</quote>). When explicitly converting to a specific unit the integer value of the selected unit is preserved (<quote>1.51 h to min = 90 min + 36 s</quote>) and mixed units is not used if otherwise the unit would not be present in the result (<quote>6 in to ft = 0.5 ft</quote>). This behavior can be modified by prepending the unit with a plus or minus sign (e.g. <quote>174 cm to +in ≈ 5 ft + 8,5 in</quote>, <quote>1.51 h to -min = 90.6 min</quote>).
</para>
</sect1>
<sect1 id="qalculate-unit-creation">
<title>Unit creation/editing</title>
<para>
There are three different unit classes in &app; — base units, named derived units, and (unnamed) derived units. Base units are standard units that form the basis for all other units. Meters and seconds are typical base units. Derived units are defined in relation to other units. Named derived units are defined in relation to a single other unit, with an optional exponent (e.g. hour is defined as a named derived unit that equals 60 minutes which in turn is defined in relation to seconds). Unnamed derived units are defined by a unit expression with one or multiple units (e.g. <quote>J/s</quote>). They are primarily useful as basis for named derived units (e.g. W = J/s), and for simplified conversion and entry of the specified unit expression.
</para>
<para>
Select <menuchoice><guimenu>File</guimenu><guisubmenu>New</guisubmenu><guimenuitem>Unit</guimenuitem></menuchoice>, or click <guibutton>New</guibutton> in the unit manager, and the unit edit dialog pops up. 
<figure id="qalculate-FIG-edit-unit">
	<title>Unit Edit Dialog (General)</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/edit-unit.png" format="PNG" width="349"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
Base units and named derived units normally have three different name forms defined for use in expressions — abbreviation (e.g. <quote>m</quote>), singular (<quote>meter</quote>) and plural (<quote>meters</quote>). Unnamed derived units only have an internal name, which is used to reference the unit in definitions of other units, but which should not be used in mathematical expressions.
</para>
<para>In addition category and descriptive name can be specified to keep the units well organized. A unit can be hidden from unit menus with the corresponding check box (this is primarily useful for some unnamed derived units which are only defined as basis for named derived units).
</para>
<para>
Depending on the unit class, different elements in the relation page of the dialog will be enabled.
<figure id="qalculate-FIG-edit-unit-relation">
	<title>Unit Edit Dialog (Relation)</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/edit-unit-relation.png" format="PNG" width="349"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
</para>
<para>
For named derived units, base unit, exponent and relation must all be specified (although the exponent and relation may both be left as <quote>1</quote>). The base unit can be of any unit class and it is recommended that named derived units are defined in relation to the closest unit (e.g. 1 ft = 3 hands, 1 hand = 4 in, and 1 in = 0.0254 m). The relation is usually just a number that tells how large quantity of the base unit is needed to get the derived unit (derived unit = relation × base unit<superscript>exponent</superscript>).
</para>
<para>
It is possible to create units with non-linear relation to the base unit. Replace the factor with <quote>\x</quote> and the exponent with <quote>\y</quote> (e.g. <quote>\x + 273.15</quote> for degrees Celsius with Kelvin as base unit). For non-linear relations the reverse relation (for conversion back from the base unit) should also be specified (<quote>\x - 273.15</quote> for degrees Celsius).
</para>
<para>
Base unit mixing can be enabled (by default) for named derived units. This is used for units such as feet and minutes, which are often combined with other units instead of using decimals (e.g. <quote>5.25 ft = 5 ft + 3 in</quote>, <quote>250 s = 4 min + 10 s</quote>). This behavior can be fine-tuned using the priority and minimum base unit number properties.
</para>
<para>
For unnamed derived units a unit expression, with one or multiple units, must be specified in the base units field. This expressions may only contain units, prefixes, exponents, multiplication and division (e.g. <quote>km/h</quote>). 
</para>
</sect1>
</chapter>

<chapter id="qalculate-plotting">
<title>Plotting</title>
<para>
Plotting in &app; is done through an external program, <application>Gnuplot</application>. Thus <application>Gnuplot</application> needs to be installed separately, and found in the executable search path, for plotting to work.
</para>
<para>
To plot functions or data sets, select <menuchoice><guimenu>File</guimenu><guimenuitem>Plot Functions/Data</guimenuitem></menuchoice>, which brings up the plot dialog. The plot dialog consists of three tabs/pages — the first for the data, the second for the function range and sampling rate, and the last for control of function sampling and appearance.  
</para>
<figure id="qalculate-FIG-plot-data">
	<title>Plot Data</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/plot-data.png" format="PNG" width="358"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
Plot functions are normal expressions that represent f(x) in y=f(x) (e.g. <quote>sin(x)</quote>). The x can be specified as a different unknown variable (x, y, z) or a quoted text string (actually any mathematical expression which will then be matched in the plot expression and replaced by the values on the x axis) in the variable entry below the function/data list.
</para>
<para>
To plot a data set, enter an expression that results in a matrix or vector. Select <interface>Vector/Matrix</interface> below and vectors will appear as one series and matrices will appear with each column or row (if selected) as a series, If the paired matrix option instead is selected, the first column/row of the matrix will constitute the y-values and the second the x-values.
</para>
<para>
Type in an expression, press <keycap>Enter</keycap> and a new window will open with the plot. The title of the series, the diagram style and smoothing of the line can also be set. The series modified must be selected in the list and to apply changes click <guibutton>Apply</guibutton>. More series that will appear in the same plot window can be added. If the scale of the y values differ, series can be put on a secondary y-axis.
</para>
<caution>
	<para>
Even though &app; does all the calculations before handing over the data to <application>Gnuplot</application>, the resulting data must only consist of pure numbers, as <application>Gnuplot</application> knows nothing about the functions, variables, units, etc. of &app;.
	</para>
</caution>
<para>
For functions, the function range — min and max x value, and the number of values or the size of the step between each y value calculated — can be specified in the function range page.
</para>
<figure id="qalculate-FIG-plot-settings">
	<title>Plot Settings</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/plot-settings.png" format="PNG" width="358"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
A title can be set to appear at the top of the plot, as well as labels for the x and y axis. The appearance can also be controlled by selecting or disabling legend placement, displaying/hiding the grid and borders on the top and the right side of the diagram and choosing color or monochrome graphics. The x and y scales can be made logarithmic by clicking the box on the right and filling in a desired logarithmic base.
</para>
<para>
To update the plot window, click <guibutton>Apply</guibutton> at the bottom of the dialog.
</para>
<figure id="qalculate-FIG-gnuplot">
	<title>Gnuplot</title>
	<screenshot>
		<mediaobject>
			<imageobject>
				<imagedata fileref="figures/gnuplot.png" format="PNG" width="555"/>
			</imageobject>
		</mediaobject>
	</screenshot>
</figure>
<para>
The plot can be saved as an image file. Click <guibutton>Save</guibutton> and select a file name and folder. The extension of the file name will decide the file type (.png for PNG image, .svg for SVG, .ps for postscript, .eps for encapsulated postscript, .tex for LaTeX, and .fig for XFig). Default is to save as a PNG image.
</para>
</chapter>

&appendixa;
&appendixb;
&appendixc;
&examples;

</book>

