QALC(1)

โœจ qalc โ€” the calculator that ate ๐Ÿ’…

okay bestie, gather round, because this is the manual page for qalc, the command-line calculator from the Qalculate! family, and honestly? She's that girl. ๐Ÿ‘‘


๐ŸŒธ NAME ๐ŸŒธ

qalc โ€” a powerful and easy to use command line calculator. no cap, that's literally the official description.


โญ SYNOPSIS โญ

qalc [options] [expression]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

Qalculate! is a multi-purpose cross-platform desktop calculator. It is simple to use but provides power and versatility normally reserved for complicated math packages, as well as useful tools for everyday needs (such as currency conversion and percent calculation).

So basically, she's giving effortless AND overachiever. ๐ŸŒˆ

Features include:

  • a large library of customizable functions
  • unit calculations and conversion
  • physical constants
  • symbolic calculations (including integrals and equations)
  • arbitrary precision
  • uncertainty propagation
  • interval arithmetic
  • plotting
  • a user-friendly interface

qalc is the command line interface of Qalculate!. So she's the cooler, textier sibling. iykyk. ๐Ÿ’–


๐Ÿ’… OPTIONS ๐Ÿ’…

  • -b, --base base โ€” set the number base for results and, optionally, expressions
  • -c, --color โ€” use colors to highlight different elements of expressions and results (she's aesthetic โœจ)
  • --defaults โ€” load default settings
  • -e, --exrates โ€” update exchange rates ๐Ÿ’ธ
  • -f, --file file โ€” execute commands from a file first
  • -h, --help โ€” display a list of command line options and exit
  • -i, --interactive โ€” start in interactive mode
  • -l, --list [search term] โ€” display a list of all user-defined or matching variables, functions, units, and prefixes, and exit
  • --list-functions [search term] โ€” display a list of all or matching functions and exit
  • --list-prefixes [search term] โ€” display a list of all or matching prefixes and exit
  • --list-units [search term] โ€” display a list of all or matching units and exit
  • *--list-variables [search term*]* โ€” display a list of all or matching variables and exit
  • -m, --time milliseconds โ€” terminate calculation and display of result after specified amount of time โฐ (she's on a schedule)
  • -n, --nodefs โ€” do not load any functions, units, or variables from file
  • --nocurrencies โ€” do not load any global currencies from file
  • --nodatasets โ€” do not load any global data sets from file
  • --nofunctions โ€” do not load any global functions from file
  • --nounits โ€” do not load any global units from file
  • --novariables โ€” do not load any global variables from file
  • -p [base] โ€” start in programming mode (same as -b "base base" -s "xor^", with base conversion)
  • -s, --set "option value" โ€” as set command in interactive program session (ex. --set "base 16")
  • -t, --terse โ€” reduce output to just the result of the input expression (no small talk fr fr)
  • -/+u8 โ€” switch unicode support on/off
  • -v, --version โ€” show application version and exit
๐Ÿ’ก heads up bestie: the program will start in interactive mode if no expression and no file is specified (or interactive mode is explicitly selected).

๐ŸŽ€ COMMANDS ๐ŸŽ€

  • approximate โ€” Equivalent to set approximation try exact.
  • assume assumptions โ€” Set default assumptions for unknown variables (unknown, non-zero, positive, negative, non-positive, non-negative + number, real, rational, integer, boolean).
  • base base โ€” Sets the result number base (equivalent to set base).
  • clear โ€” Clears the screen. bye clutter ๐Ÿงน
  • clear history โ€” Clears the expression history.
  • delete name โ€” Removes the user-defined variable or function with the specified name. Example: delete var1.
  • exact โ€” Equivalent to set approximation exact.
  • expand โ€” Expands the current result.
  • exrates โ€” Downloads current exchange rates from the Internet. ๐ŸŒ
  • factor โ€” Factorizes the current result.
  • find, list [name] โ€” Displays a list of variables, functions and units. Enter with argument 'currencies', 'functions', 'variables', 'units', or 'prefixes' to show a list of all currencies, functions, variables, units, or prefixes. Enter a search term to find matching variables, functions, units, and/or prefixes. If command is called with no argument all user-definied objects are listed. Example: list functions. Example: find dinar. Example: find variables planck.
  • function name expression โ€” Creates a function with the specified name and expression. Use '\x', '\y', '\z', '\a', etc. for arguments in the expression. The function is persistent unless the command is invoked from file or in result only mode. Example: function func1 5*\x.
  • help [command]
  • history โ€” Lists the expression history. ๐Ÿ“œ
  • info name โ€” Displays information about a function, variable, unit, or prefix. Example: info sin.
  • keep/unkeep name โ€” Make the temporary user-defined variable or function with the specified name non-temporary. Example: keep var1.
  • MC/MS/M+/M- โ€” Memory operations (memory clear, memory store, memory plus, memory minus). Recall the memory using the MR/MRC variable.
  • mode โ€” Displays the current mode.
  • partial fraction โ€” Applies partial fraction decomposition to the current result.
  • save, store name [category] [title] โ€” Saves the current result in a variable with the specified name. You may optionally also provide a category (default "Temporary") and a title. If name equals "mode" or "definitions", the current mode and definitions, respectively, will be saved. Example: store var1.
  • save definitions
  • save mode
  • set option value
  • to, convert, -> unit / "to"-command โ€” Converts the previous result. Equivalent to using "to" at the end of an expression. Example: to m/s Example: to bin
  • variable name expression โ€” Create a variable with the specified name and expression. The variable is persistent unless the command is invoked from file or in result only mode. Example: variable var1 pi / 2.
  • quit/exit โ€” Terminates the program. ๐Ÿ˜ญ sad but slay

๐Ÿ”ฅ Commands for RPN mode ๐Ÿ”ฅ

  • rpn state โ€” (De)activates the Reverse Polish Notation stack and syntax. "syntax" activates only the RPN syntax and "stack" enables the RPN stack. "on" (1) and "off" (0) (de)activates both.
  • stack โ€” Displays the RPN stack.
  • clear stack โ€” Clears the entire RPN stack.
  • copy [index] โ€” Duplicates a value on the RPN stack to the top of the stack. If no index is specified, the top of the stack is duplicated. Index 1 is the top of stack and negative index values count from the bottom of the stack.
  • move index 1 [index 2] โ€” Changes the position of a value on the RPN stack. Index 1 is the top of stack and negative index values count from the bottom of the stack. Example: move 2 4
  • pop [index] โ€” Removes the top of the RPN stack or the value at the specified index. Index 1 is the top of stack and negative index values count from the bottom of the stack.
  • rotate [direction] โ€” Rotates the RPN stack up (default) or down.
  • swap [index 1] [index 2] โ€” Swaps position of values on the RPN stack. If no index is specified, the values on the top of the stack (index 1 and index 2) will be swapped and if only one index is specified, the value at this index will be swapped with the top value. Index 1 is the top of stack and negative index values count from the bottom of the stack. Example: swap 2 4
๐Ÿซถ tiny but mighty rule: when a line begins with '/', the text that follows is always interpreted as a command.

๐Ÿงš KEYBINDINGS ๐Ÿงš

  • Tab (Ctrl+I) โ€” shows a list of functions, variables, and units that matches the last object in the current expression, or, if cursor is at beginning of line or after operator, inserts the previous result (either with text of value, or as a temporary variable for approximate or long values)
  • Ctrl+A โ€” saves the current result in a temporary variable
  • Ctrl+D โ€” terminates the program ๐Ÿ’€
  • Ctrl+E โ€” switches between approximation modes (exact, try exact, auto)
  • Ctrl+F โ€” switches between fraction modes (simple, decimal, auto)
  • Ctrl+L โ€” clears the screen

okay bestie, this is the big one ๐Ÿ’– all of these get changed either with the set command (like set base 16) or with the -s, --set command line option (like qalc -s "base 16"). The possible values are right there in the parentheses, and 1 and 0 can be used instead of on and off, yes and no. If you just... don't give a value, a value of 1 is generally assumed. And the default is the one with the * on it, periodt. ๐Ÿ‘‘


๐ŸŽ€ Algebraic mode ๐ŸŽ€

  • algebra mode, alg โ€” (1* = expand, 2 = factorize). This decides whether your expression comes out factorized or not after the calculation.
  • assume nonzero denominators, nzd โ€” (on*, off). Determines if unknown values will be assumed non-zero, so like x/x=1. ๐Ÿ’…
  • warn nonzero denominators, warnnzd โ€” (on*, off). Shows you a message after a value has been assumed non-zero, so no surprises bestie.
  • assumptions, asm โ€” (unknown*, non-zero, positive, negative, non-positive, non-negative + number, real*, rational, integer, boolean). Default assumptions for unknown variables.

๐ŸŒธ Calculation ๐ŸŒธ

  • angle unit, angle โ€” (0 = none, 1* = radians, 2 = degrees, 3 = gradians, 4 = custom). Default angle unit for trigonometric functions.
  • approximation, appr โ€” (-1* = auto, 0 = exact, 1 = try exact, 2 = approximate, 3 = dual). How approximate variables and calculations are handled. Heads up: in exact mode, approximate values will not be calculated.
  • interval arithmetic, ia โ€” (on*, off). If you turn this on, interval arithmetic determines the final precision of calculations (it avoids wrong results after loss of significance) with approximate functions and/or irrational numbers.
  • interval calculation, ic โ€” (1* = variance formula, 2 = interval arithmetic). Determines the method used for interval calculation / uncertainty propagation.
  • precision, prec โ€” (> 0) default 10*. Specifies the default number of significant digits displayed and determines the precision used for approximate calculations.

๐Ÿฆ‹ Enabled objects ๐Ÿฆ‹

  • calculate functions, calcfunc โ€” (on*, off)
  • calculate variables, calcvar โ€” (on*, off)
  • complex numbers, cplx โ€” (on*, off)
  • functions, func โ€” (on*, off)
  • infinite numbers, inf โ€” (on*, off)
  • units โ€” (on*, off)
  • unknowns โ€” (on, off*). Interpret undefined symbols in expressions as unknown variables.
  • variables, var โ€” (on*, off)
  • variable units, varunits โ€” (on*, off). If activated, physical constants include units (e.g. c = 299 792 458 mโˆ•s).

๐Ÿ’œ Generic display options ๐Ÿ’œ

  • abbreviations, abbr โ€” (on*, off). Use abbreviated names for units and variables.
  • color โ€” (0 = off, 1* = default, 2 = light). Use colors to highlight different elements of expressions and results.
  • division sign, divsign โ€” (0* = /, 1 = division slash, 2 = division sign)
  • excessive parentheses, expar โ€” (on, off*)
  • minus last, minlast โ€” (on*, off). Always place negative values last.
  • multiplication sign, mulsign โ€” (0 = *, 1 = multiplication dot, 2* = multiplication x, 3 = middle dot)
  • short multiplication, shortmul โ€” (on*, off)
  • spacious, space โ€” (on*, off). Add extra space around operators.
  • spell out logical, spellout โ€” (on*, off)
  • unicode, uni โ€” (on*, off). Display Unicode characters.
  • unicode exponents, uniexp โ€” (0 = off, 1* = on, 2 = units). Display exponents 0-9 using Unicode superscript characters.
  • vertical space, vspace โ€” (on*, off). Add empty lines before and after result.

๐Ÿ”ฅ Numerical display ๐Ÿ”ฅ

  • base โ€” (-1114112 - 1114112, bin, oct, dec*, hex, sexa, time, roman)
  • base display, basedisp โ€” (0 = none, 1* = normal, 2 = alternative)
  • binary bits, bits โ€” (0* = auto, >= 2)
  • complex form, cplxform โ€” (0* = rectangular, 1 = exponential, 2 = polar, 3 = cis, 4 = angle)
  • decimal comma โ€” (locale*, off, on). Determines the default decimal separator.
  • digit grouping, group โ€” (0* = off, 1 = standard, 2 = locale)
  • digits โ€” (-1* = auto, >= 2). Specifies the number of displayed significant digits (by default determined by precision).
  • exp display, edisp โ€” (E*, e, 10). Determines how scientific notation is displayed (e.g. 3E6, 3e6, or 3 * 10^6).
  • fractions, fr โ€” (-1* = auto, 0 = off, 1 = exact, 2 = on, 3 = mixed, 4 = long, 5 = dual, 1/n). Determines how rational numbers are displayed (e.g. 5/4 = 1 + 1/4 = 1.25). Careful bestie: 'long' removes limits on the size of the numerator and denonimator.
  • hexadecimal two's, hextwos โ€” (on, off*). Enables two's complement representation for display of negative hexadecimal numbers.
  • imaginary j, imgj โ€” (on, off*). Use 'j' (instead of 'i') as default symbol for the imaginary unit.
  • interval display, ivdisp โ€” (0* = adaptive, 1 = significant, 2 = interval, 3 = plusminus, 4 = midpoint, 5 = lower, 6 = upper, 7 = concise, 8 = relative)
  • lowercase numbers, lownum โ€” (on, off*). Use lowercase letters for number bases > 10.
  • max decimals, maxdeci โ€” (-1* = off, >= 0)
  • min decimals, mindeci โ€” (-1* = off, >= 0)
  • repeating decimals, repdeci โ€” (0 = off*, 1 = ellipsis, 2 = overline). If activated, 1/6 is displayed as '0.1 666...', otherwise as '0.166667'. ๐Ÿซถ
  • rounding โ€” (0* = half away from zero, 1 = half to even, 2 = toward zero, 3 = half to odd, 4 = half toward zero, 5 = half up, 6 = half down, 7 = half random, 8 = away from zero, 9 = up, 10 = down). Determines how approximate numbers are rounded.
  • scientific notation, exp โ€” (0 = off, -1* = auto, -3 = engineering, 1 = pure, 3 = scientific, >= 0, <= -2). Determines how scientific notation is used (e.g. 5 543 000 = 5.543E6). A value >= 0 specifies the minimum exponent used. A value <= -2 specifies the multiplier used for the exponent.
  • show ending zeroes, zeroes โ€” (on*, off). If actived, zeroes are kept at the end of approximate numbers.
  • two's complement, twos โ€” (on*, off). Enables two's complement representation for display of negative binary numbers.
  • duodecimal symbols, duosyms โ€” (on, off*). Use special symbols for digits 10 and 11 in numbers with base 12.

๐Ÿงš Parsing ๐Ÿงš

  • caret as xor, xor^ โ€” (on, off*). Use ^ as bitwise exclusive OR operator.
  • concise uncertainty, concise โ€” (on, off*). Allow input of uncertainty using concise notation.
  • decimal comma โ€” (locale*, off, on). Determines the default decimal separator.
  • hexadecimal two's input, hextwosin โ€” (on, off*). Enables two's complement representation for input of negative hexadecimal numbers. All hexadecimal numbers starting with 8 or higher are negative, unless binary bits is set. ๐Ÿ’€
  • ignore comma โ€” (on, off*). Allows use of ',' as thousands separator.
  • ignore dot โ€” (on, off*). Allows use of '.' as thousands separator.
  • imaginary j, imgj โ€” (on, off*). Use 'j' (instead of 'i') as default symbol for the imaginary unit.
  • input base, inbase โ€” (-1114112 - 1114112, bin, oct, dec*, hex, roman)
  • limit implicit multiplication, limimpl โ€” (on, off*)
  • parsing mode, syntax โ€” (0* = adaptive, 1 = implicit first, 2 = conventional, 3 = chain, 4 = rpn). See syntax section.
  • read precision, readprec โ€” (0* = off, 1 = always, 2 = when decimals). If activated, numbers are interpreted as approximations with precision equal to the number of significant digits (3.20 = 3.20+/-0.005).
  • simplified percentage, percent โ€” (on*, off). Interpret addition/subtraction of percentage as percentage increase/decrease of the first term (100 + 10% = 110).
  • two's input, twosin โ€” (on, off*). Enables two's complement representation for input of negative binary numbers. All binary numbers starting with 1 are negative, unless binary bits is set. ๐Ÿ’€

๐Ÿ“ Units ๐Ÿ“

  • all prefixes, allpref โ€” (on, off*). Enables automatic use of hecto, deca, deci, and centi.
  • autoconversion, conv โ€” (0 = none, 1* = optimal, 2 = base, 3 = optimalsi, 4 = mixed). Controls automatic unit conversion of the result. 'optimalsi' always converts non-SI units, while 'optimal' only converts to unit expressions with less units and exponents.
  • binary prefixes, binpref โ€” (on, off*). If activated, binary prefixes are used by default for information units.
  • currency conversion, curconv โ€” (on*, off). Enables automatic conversion to the local currency when optimal unit conversion is enabled.
  • default currency, currency
  • denominator prefixes, denpref โ€” (on*, off). Enables automatic use of prefixes in the denominator of unit expressions.
  • place units separately, unitsep โ€” (on*, off). If activated, units are separated from variables at the end of the result.
  • prefixes, pref โ€” (on*, off). Enables automatic use of prefixes in the result.
  • show negative exponents, negexp โ€” (on, off*). Use negative exponents instead of division for units in result (m/s = m*s^-1).
  • sync units, sync โ€” (on*, off)
  • temperature calculation, temp โ€” (0* = hybrid, 1 = absolute, 2 = relative). Determines how expressions with temperature units are calculated (hybrid acts as absolute if the expression contains different temperature units, otherwise as relative).
  • update exchange rates, upxrates โ€” (-1* = ask, 0 = never, > 0 = days)

๐ŸŒˆ Other ๐ŸŒˆ

  • calculate as you type, autocalc โ€” (on, off*). Activates continuous calculation of the currently edited expression.
  • clear history โ€” (yes, no*). Do not save expression history on exit.
  • completion โ€” (0 = off, 1* = select multiple, 2 = select, 3 = list multiple, 4 = list). Determines completion action when pressing tab key. "select" shows a numbered list of matches and waits for an item to be selected by entering a number, while "list" returns directly to the expression without input. "select multiple" and "list multiple" completes the word directly if there is only one match.
  • ignore locale โ€” (yes, no*). Ignore system language and use English (requires restart).
  • language
  • prompt
  • rpn โ€” (on, off*). Activates the Reverse Polish Notation stack.
  • save config โ€” (yes*, no). If disabled qalc.cfg is never automatically updated.
  • save definitions โ€” (yes*, no). Save functions, units, and variables on exit.
  • save mode โ€” (yes*, no). Save settings on exit.
  • sigint action, sigint โ€” (0 = kill, 1* = exit, 2 = interrupt). Determines how the SIGINT signal (Ctrl+C) is handled.

โญ SYNTAX โญ

Mathematical entities:

๐Ÿ”ข Numbers

Bestie these are just regular numbers, made of digits 0-9 plus a decimal sign โ€” that's a dot, or a comma if that's the default decimal point in whatever locale/language you're running. And heads up: if comma is your decimal sign, the dot is still kept around as an alternative decimal sign, unless you explicitly deactivate it. Numbers cover integers, real numbers, and complex numbers. For complex ones, the imaginary part is a regular number followed by the special variable "i" (which can be changed to a "j"), and that little guy represents the square root of -1. Spaces between digits? Ignored, like, completely โ€” 5 5 = 55. And E (or e) is your shortcut for writing out a million zeroes, equivalent to multiplying by 10 raised to the power of the right-hand value, so 5E3 = 5000 ๐Ÿ’…

Sexagesimal numbers (and time!) can be typed directly with colons โ€” 5:30 = 5.5. And if a number is immediately preceded by 0b, 0o, 0d or 0x, it's interpreted as a number with base 2, 8, 12 or 16 respectively, like 0x3f = 63. Iconic.

๐ŸŽ€ Intervals

A number interval can be entered using the interval() function, the uncertainty() function, or just using ยฑ or +/- โ€” for example 5ยฑ1 = uncertainty(5, 0.2) = interval(4, 6). If the read precision option is activated, decimal numbers get interpreted as an interval between the numbers that are normally rounded to the entered number (so 1.1 = 1.1ยฑ0.05). And if interval calculation using variance formula is activated (which is the default), the interval represents the standard uncertainty (deviation) of the value. Slay.

๐Ÿฆ‹ Vectors and Matrices

A matrix is a two-dimensional rectangular array of mathematical objects. Vectors are matrices with only one row or column, so basically one-dimensional sequences of objects. You generate vectors and matrices with various functions, or with syntax like [1 2 3 4] and [1 2; 3 4] โ€” columns separated by space or comma, rows separated by semi-colon โ€” or the alternate flavor (1, 2, 3, 4) and ((1, 2), (3, 4)). Want a vector with a sequence of numbers? Use "..." (like 1...4), or a colon (like [1:4], or [1:1:4] where that second value specifies the increment). And to select a single element of a vector, put the index (first index is 1!) in parenthesis after a variable or function โ€” v(1) or f[1]. Cute.

๐Ÿ’œ Variables/Constants

Check the list of variables in the GUI manual, or with the command list variables.

๐Ÿ’– Functions

Check the list of functions in the GUI manual, or with the command list functions.

๐ŸŒธ Units and Prefixes

Check the list of units and prefixes in the GUI manual, or with the command list units. Abbreviated, plural and singular forms of unit names and prefixes are generally allowed. Prefixes must be put immediately before the unit to be interpreted as prefixes โ€” for example 5 mm = 0.005 m, but 5 m m = 5 m^2 (the space matters, girl). For convenience units allow the power operator to be left out, like 5 m2 = 5 m^2, with currencies excluded.

๐Ÿ’… Unknowns

Unknowns are text strings without any associated value. They're temporary unknown variables with default assumptions. You can also enter them explicitly by placing a backslash (\) before a single character (like 5\a + 2\b) or by using quotation marks before and after a text string (like 5 "apples" + 2 "bananas"). If unknowns are activated, characters without any associated variable, function or unit in an expression will be regarded as an unknown variable.

โฐ Date and Time

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, and the time units represent calendar time, instead of average values, when added or subtracted to a date.

๐Ÿ“ Text

This category represents a number of different function argument types, such as regular text and file names. They can be put in quotes, but they don't need to be โ€” except when containing the argument separator.

๐Ÿ™ˆ Comments

All text after a hashtag is treated as a comment, like (5*2)/2 #calculating triangle area.


๐Ÿ”ฅ Operations and operators

Word operators such as AND must be surrounded by space, just so you know.

  • Addition (+)
  • Subtraction (-)
  • Multiplication (*)
  • Division (/)
  • Remainder (%, rem) and modulo (%%, mod) โ€” returns the remainder after division.
  • Integer division (//, div) โ€” rounds the result of division towards zero.
  • Exponentiation (^, **) โ€” 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 ((-8)^(1/3) equals 1 + 1.73i, and not -2). To calculate the real root for negative values, use the cbrt() and root() functions.
  • 10^x (E)
  • Parenthesis ((, ))
  • Parellel sum (โˆฅ, ||) โ€” returns the reciprocal value of a sum of reciprocal values. || is interpreted as parallel if units are used, otherwise as logical OR.
  • Logical operators (!, NOT, ||, OR, &&, AND, XOR, NOR, NAND)
  • Bitwise operators (~, |, &, <<, >>, XOR)
  • Comparison operators (=, !=, <, <=, >, >=) โ€” returns 1 if expression is true and 0 if false. The x variable is isolated if the expression does not evaluate as true or false. Primarily used for equations and inequalities.
  • Dot product (.)
  • Element-wise operators (.*, ./, .^)
  • Set operators (โˆช, โˆฉ, โˆ–, โŠ–, โˆˆ, โˆ‰, โˆ‹, โˆŒ, โŠŠ, โІ, โŠ‹, โЇ)
  • Save operator (:=, =) โ€” saves the expression to the right of the operator as a variable or function (e.g. var1:=5, func1():=x+y, var1=ln(5)+2). If the colon is omitted the expression is calculated before it is assigned to the variable.

Evaluation priority order, in order, no skipping:

  1. parenthesis
  2. 10^x
  3. exponentiation
  4. functions
  5. bitwise NOT
  6. logical NOT
  7. multiplication/division/remainder
  8. parallel sum
  9. addition/subtraction
  10. bitwise NOT
  11. bitwise shift
  12. comparisons
  13. bitwise AND
  14. bitwise XOR
  15. bitwise OR
  16. logical AND
  17. logical OR

The evaluation of short/implicit multiplication without any multiplication sign (think 5x, 5(2+3)) differs depending on the parsing mode. In the conventional mode implicit multiplication does not differ from explicit multiplication (12/2(1+2) = 12/2*3 = 18, 5x/5y = 5 * x/5 * y = xy). In the parse implicit multiplication first mode, implicit multiplication is parsed before explicit multiplication (12/2(1+2) = 12/(2 * 3) = 2, 5x/5y = (5 * x)/(5 * y) = x/y). The default adaptive mode works as the parse implicit multiplication first mode, unless spaces are found (1/5x = 1/(5 * x), but 1/5 x = (1/5) * x). In the adaptive mode unit expressions are parsed separately (5 m/5 m/s = (5 * m)/(5 * (m/s)) = 1 s). Function arguments without parentheses are an exception, where implicit multiplication in front of variables and units is parsed first regardless of mode (sqrt 2x = sqrt(2x)).

In chain mode, expressions are calculated from left to right, ignoring standard order of operations, like the immediate execution mode of a traditional calculator (1+2*3 = (1+2)*3 = 9).

The "to"-operator is used for unit conversion and manipulation of how the result is presented. Place " to " or a right arrow (e.g. "->", but not ">") followed by one of the expressions/commands listed below, at the end of an expression.

๐ŸŒˆ Unit conversion

  • a unit or unit expression (e.g. meter or km/h)
    • prepend with ? to request the optimal prefix
    • prepend with b? to request the optimal binary prefix
    • prepend with + or - to force/disable use of mixed units
  • a variable or physical constant (e.g. c)
  • base (convert to base units)
  • optimal (convert to optimal unit)
  • prefix (convert to optimal prefix)
  • mixed (convert to mixed units, e.g. hours + minutes)

โœจ Number base conversion

  • bin, binary (show as binary number)
  • bin# (show as binary number with specified number of bits)
  • oct, octal (show as octal number)
  • duo, duodecimal (show as duodecimal number)
  • hex, hexadecimal (show as hexadecimal number)
  • hex# (show as hexadecimal number with specified number of bits)
  • sexa, sexa2, sexa3, sexagesimal (show as sexagesimal number; sexa2 hides and sexa3 rounds arcseconds)
  • latitude, latitude2, longitude, longitude2 (show as sexagesimal latitude/longitude; latitude2 and longitude2 hide arcseconds)
  • bijective (shown in bijective base-26)
  • fp16, fp32, fp64, fp80, fp128 (show in binary floating-point format)
  • bcd (show as binary-coded decimal)
  • roman (show as roman numerals)
  • time (show in time format)
  • unicode
  • base # (show in specified number base)
  • bases (show as binary, octal, decimal and hexadecimal number)

๐Ÿ’ซ Complex format

  • rectangular, cartesian (show complex numbers in rectangular form)
  • exponential (show complex numbers in exponential form)
  • polar (show complex numbers in polar form)
  • cis (show complex numbers in cis form)
  • angle, phasor (show complex numbers in angle/phasor notation)

๐ŸŒธ Time and date conversion

  • UTC (show date and time in UTC time zone)
  • UTC+/-hh[:mm] (show date and time in specified time zone)
  • calendars

๐ŸŽ€ Fractions

  • fraction, 1/n (show result as mixed fraction)
  • decimals (show result as decimal fraction)
  • 1/# (show as mixed fraction with specified denominator)
    • prepend with - to show as simple fraction

โญ Scientific notation

  • sci, scientific (show result with scientific notation)
  • eng, engineering (show result with engineering notation)
  • simple (show result with non-scientific notation)

๐Ÿ‘‘ Other conversion commands

  • factors (factorize result)

Similarly you can slap where (or, same energy, /.) at the end โ€” just make sure it's before to โ€” and that's how you do variable assignments, function replacements, all of it. Like: x+y where x=1 and y=2, x^2=4 where x>0, and sin(5) where sin()=cos(). ๐Ÿ’ซ

You can also put variable assignments up front, separated by commas, like x=1, y=2, x+y โ€” but ngl that syntax is way more strict, so mind your business with it. ๐Ÿ™ˆ

Heads up bestie: to and where only ever apply to the whole expression. Everything before the operator is always treated as the expression you're converting (or applying the replacement to), and everything after it is the conversion/replacement expression โ€” no matter how many parentheses you throw at it. Periodt.

โœจ EXAMPLES โœจ

Quick note before we dive in: a semicolon can always be swapped for a comma โ€” but only if comma isn't already doing decimal or thousands-separator duty. ๐Ÿซถ

<div>

๐Ÿงฎ Basic functions and operators

Watch these glow up:

sqrt 4  = sqrt(4)
        = 4^(0.5)
        = 4^(1/2)
        = 2
sqrt(25; 16; 9; 4)
        = [5  4  3  2]
sqrt(32)
        = 4 * sqrt(2) (in exact mode)
cbrt(-27)
        = root(-27; 3)
        = -3 (real root)
(-27)^(1/3)
        = 1.5 + 2.5980762i (principal root)
ln 25   = log(25; e)
        = 3.2188758
log2(4)/log10(100)
        = log(4; 2)/log(100; 10)
        = 1
5!      = 1 * 2 * 3 * 4 * 5
        = 120
5\2 (integer division)
        = 5//2
        = trunc(5/2)
        = 2
5 mod 3 = mod(5; 3)
        = 2
52 to factors
        = 2^2 * 13
25/4 * 3/5 to fraction
        = 3 + 3/4
gcd(63; 27)
        = 9
sin(pi/2) - cos(pi)
        = sin(90 deg) - cos(180 deg)
        = 2
sum(x; 1; 5)
        = 1 + 2 + 3 + 4 + 5 = 15
sum(\i^2+sin(\i); 1; 5; \i)
        = 1^2 + sin(1) + 2^2 + sin(2) + ... = 55.176162
product(x; 1; 5)
        = 1 * 2 * 3 * 4 * 5 = 120
var1:=5 store value 5 in variable var1
5^2 #this is a comment
        = 25
sinh(0.5) where sinh()=cosh()
        = cosh(0.5) = 1.1276260
plot(x^2; -5; 5)
        plots the function y=x^2 from -5 to 5

๐Ÿ“ Units

Conversion math is literally so satisfying, no cap:

5 dm3 to L = 5 dm^3 to L
        = 5 L
20 miles / 2h to km/h
        = 16.09344 km/h
1.74 to ft = 1.74 m to ft
        = 5 ft + 8.5039370 in
1.74 m to -ft
        = 5.7086614 ft
100 lbf * 60 mph to hp
        = 16 hp
50 ฮฉ * 2 A
        = 100 V
50 ฮฉ * 2 A to base
        = 100 kg*m^2*s^-3*A^-1
10 N / 5 Pa
        = (10 N)/(5 Pa) = 2 m^2
5 m/s to s/m
        = 0.2 s/m
500 EUR - 20% to USD
        = 451.04 USD
500 megabit/s * 2 h to b?byte
        = 419.09516 gibibytes

๐ŸŒŒ Physical constants

Ten out of ten, the constants are already loaded for you bestie:

k_e / G * a_0
        = (coulombs_constant / newtonian_constant) * bohr_radius
        = 7.126e9 kg*H*m^-1
planck โˆ• (compton_wavelength * c)
        = 9.1093837e-31 kg
5 ns * rydberg to c
        = 6.0793194E-8c
atom(Hg; weight) + atom(C; weight) * 4 to g
        = 4.129e-22 g
(G * planet(earth; mass) * planet(mars; mass))/(54.6e6 km)^2
        = 8.58e16 N (gravitational attraction between earth and mars)

๐ŸŽ€ Uncertainty and interval arithmetic

If you turn interval arithmetic on, the result shows up in parenthesis. Cute, right? ๐Ÿ’…

sin(5+/-0.2)^2/2+/-0.3
        = 0.460ยฑ0.088 (0.46+/-0.12)
(2+/-0.02 J)/(523+/-5 W)
        = 3.824+/-0.053 ms (3.82+/-ยฑ0.075 ms)
interval(-2; 5)^2
        = interval(-8.2500000; 12.750000) (interval(0; 25))

๐Ÿ”ค Algebra

Symbolic math said "I got you":

(5x^2 + 2)/(x - 3)
        = 5x + 15 + 47/(x - 3)
(\a + \b)(\a - \b) = ("a" + "b")("a" - "b")
        = 'a'^2 - 'b'^2
(x + 2)(x - 3)^3
        = x^4 - 7x^3 + 9x^2 + 27x - 54
factorize x^4 - 7x^3 + 9x^2 + 27x - 54
        = x^4 - 7x^3 + 9x^2 + 27x - 54 to factors
        = (x + 2)(x - 3)^3
cos(x)+3y^2 where x=pi and y=2
        = 11
gcd(25x; 5x^2)
        = 5x
1/(x^2+2x-3) to partial fraction
        = 1/(4x - 4) - 1/(4x + 12)
x+x^2+4 = 16
        x = 3 or x = -4
x^2/(5 m) - hypot(x; 4 m) = 2 m where x > 0
        x = 7.1340411 m
cylinder(20cm; x) = 20L
        x = (1 / (2pi)) m
        x = 16 cm (height of 20 L cylinder with radius 20 cm)
asin(sqrt(x)) = 0.2
        x = sin(0.2)^2
        x = 0.039469503
x^2 > 25x
        = x > 25 or x < 0
solve(x = y+ln(y); y)
        = lambertw(e^x)
solve2(5x=2y^2; sqrt(y)=2; x; y)
        = 32/5
multisolve([5x=2y+32, y=2z, z=2x]; [x, y, z])
        = [-32/3  -128/3  -64/3]
dsolve(diff(y; x) - 2y = 4x; 5)
        = 6e^(2x) - 2x - 1

โˆซ Calculus

Derivatives, integrals, limits โ€” the whole vibe check passed:

diff(6x^2)
        = 12x
diff(sinh(x^2)/(5x) + 3xy/sqrt(x))
        = (2/5) * cosh(x^2) - sinh(x^2)/(5x^2) + (3y)/(2 * sqrt(x))
integrate(6x^2)
        = 2x^3 + C
integrate(6x^2; 1; 5)
        = 248
integrate(sinh(x^2)/(5x) + 3xy/sqrt(x))
        = 2x * sqrt(x) * y + Shi(x^2) / 10 + C
integrate(sinh(x^2)/(5x) + 3xy/sqrt(x); 1; 2)
        = 3.6568542y + 0.87600760
limit(ln(1 + 4x)/(3^x - 1); 0)
        = 4 / ln(3)

๐ŸงŠ Matrices and vectors

She does linear algebra too, it's giving main character:

[1, 2, 3; 4, 5, 6]
        = ((1; 2; 3); (4; 5; 6))
        = [1  2  3; 4  5  6] (2x3 matrix)
1...5   = (1:5) = (1:1:5)
        = [1  2  3  4  5]
(1; 2; 3) * 2 - 2
        = [(1 * 2 - 2), (2 * 2 - 2), (3 * 2 - 2)]
        = [0  2  4]
[1 2 3].[4 5 6]
        = dot([1 2 3]; [4 5 6])
        = 32 (dot product)
cross([1 2 3]; [4 5 6])
        = [-3  6  -3] (cross product)
[1 2 3; 4 5 6].*[7 8 9; 10 11 12]
        = hadamard([1 2 3; 4 5 6]; [7 8 9; 10 11 12])
        = [7  16  27; 40  55  72] (hadamard product)
[1 2 3; 4 5 6] * [7 8; 9 10; 11 12]
        = [58  64; 139  154] (matrix multiplication)
[1 2; 3 4]^-1
        = inverse([1 2; 3 4])
        = [-2  1; 1.5  -0.5]

๐Ÿ“Š Statistics

Numbers? Analyzed. Data? Read. ๐Ÿ“

mean(5; 6; 4; 2; 3; 7)
        = 4.5
stdev(5; 6; 4; 2; 3; 7)
        = 1.87
quartile([5 6 4 2 3 7]; 1)
        = percentile((5; 6; 4; 2; 3; 7); 25)
        = 2.9166667
normdist(7; 5)
        = 0.053990967
spearman(column(load(test.csv); 1); column(load(test.csv); 2))
        = -0.33737388 (depends on the data in the CSV file)

๐Ÿ•ฐ๏ธ Time and date

Time zone math without the mental breakdown, we love to see it:

10:31 + 8:30 to time
        = 19:01
10h 31min + 8h 30min to time
        = 19:01
now to utc
        = "2020-07-10T07:50:40Z"
"2020-07-10T07:50CET" to utc+8
        = "2020-07-10T14:50:00+08:00"
"2020-05-20" + 523d
        = addDays(2020-05-20; 523)
        = "2021-10-25"
today - 5 days
        = "2020-07-05"
"2020-10-05" - today
        = days(today; 2020-10-05)
        = 87
timestamp(2020-05-20)
        = 1 589 925 600
stamptodate(1 589 925 600)
        = "2020-05-20T00:00:00"
"2020-05-20" to calendars
        returns date in Hebrew, Islamic, Persian, Indian, Chinese,
        Julian, Coptic, and Ethiopian calendars

๐Ÿ”ข Number bases

Base conversions are iconic and I will not be taking questions:

52 to bin
        = 0011 0100
52 to bin16
        = 0000 0000 0011 0100
52 to oct
        = 064
52 to hex
        = 0x34
0x34    = hex(34)
        = base(34; 16)
        = 52
523<<2&250 to bin
        = 0010 1000
52.345 to float
        = 0100 0010 0101 0001 0110 0001 0100 1000
float(01000010010100010110000101001000)
        = 1715241/32768
        = 52.345001
floatError(52.345)
        = 1.2207031e-6
52.34 to sexa
        = 52ยฐ20'24"
1978 to roman
        = MCMLXXVIII
52 to base 32
        = 1K
sqrt(32) to base sqrt(2)
        = 100000

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

The manual for the graphical user interface lives at https://qalculate.github.io/manual/index.html โ€” and bestie, it's packed. It goes way deeper on the syntax and the elements supported in mathematical expressions, all the various options, and it has a complete list of functions, variables, and units. Go read it, fr fr. ๐Ÿ“šโœจ


๐Ÿ› BUGS ๐Ÿ›

Found a bug? Please report it at https://github.com/Qalculate/libqalculate/issues. Do it for the culture. ๐Ÿ’–


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

Hanna Knutsson <hanna.knutsson@protonmail.com>. Absolute legend, we stan. ๐Ÿซถ


And that's a wrap on the whole page bestie!! This one's from the QALC(1) manual โ€” source/version QALC(1), dated 13 July 2020. Now go do some math, you're gonna ate it. ๐Ÿ’…โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from