1QALC(1) General Commands Manual QALC(1)
2
3
4
6 qalc - Powerful and easy to use command line calculator
7
9 qalc [options] [expression]
10
12 Qalculate! is a multi-purpose cross-platform desktop calculator. It is
13 simple to use but provides power and versatility normally reserved for
14 complicated math packages, as well as useful tools for everyday needs
15 (such as currency conversion and percent calculation). Features include
16 a large library of customizable functions, unit calculations and con‐
17 version, physical constants, symbolic calculations (including integrals
18 and equations), arbitrary precision, uncertainty propagation, interval
19 arithmetic, plotting, and a user-friendly interface. qalc is the com‐
20 mand line interface of Qalculate!.
21
23 -b, --base base
24 set the number base for results and, optionally, expressions
25
26 -c, --color
27 use colors to highlight different elements of expressions and
28 results
29
30 --defaults
31 load default settings
32
33 -e, --exrates
34 update exchange rates
35
36 -f, --file file
37 execute commands from a file first
38
39 -h, --help
40 display this help and exits
41
42 -i, --interactive
43 start in interactive mode
44
45 -l, --list [search term]
46 displays a list of all user-defined or matching variables,
47 functions, units, and prefixes.
48
49 --list-functions [search term]
50 displays a list of all or matching functions.
51
52 --list-prefixes [search term]
53 displays a list of all or matching prefixes.
54
55 --list-units [search term]
56 displays a list of all or matching units.
57
58 --list-variables [search term]
59 displays a list of all or matching variables.
60
61 -m, --time milliseconds
62 terminate calculation and display of result after specified
63 amount of time
64
65 -n, --nodefs
66 do not load any functions, units, or variables from file
67
68 --nocurrencies
69 do not load any global currencies from file
70
71 --nodatasets
72 do not load any global data sets from file
73
74 --nofunctions
75 do not load any global functions from file
76
77 --nounits
78 do not load any global units from file
79
80 --novariables
81 do not load any global variables from file
82
83 -p [base]
84 start in programming mode (same as -b "base base" -s "xor^",
85 with base conversion)
86
87 -s, --set "option value"
88 as set command in interactive program session (ex. --set "base
89 16")
90
91 -t, --terse
92 reduce output to just the result of the input expression
93
94 -/+u8 switch unicode support on/off
95
96 -v, --version
97 show application version and exit
98
99 The program will start in interactive mode if no expression and no file
100 is specified (or interactive mode is explicitly selected).
101
103 approximate
104 Equivalent to set approximation try exact.
105
106 assume assumptions
107 Set default assumptions for unknown variables (unknown, non-
108 zero, positive, negative, non-positive, non-negative + number,
109 real, rational, integer, boolean).
110
111 base base
112 Sets the result number base (equivalent to set base).
113
114 clear Clears the screen
115
116 clear history
117 Clears the expression history
118
119 delete name
120 Removes the user-defined variable or function with the speci‐
121 fied name.
122 Example: delete var1.
123
124 exact Equivalent to set approximation exact.
125
126 expand Expands the current result.
127
128 exrates Downloads current exchange rates from the Internet.
129
130 factor Factorizes the current result.
131
132 find, list [name]
133 Displays a list of variables, functions and units. Enter with
134 argument 'currencies', 'functions', 'variables', 'units', or
135 'prefixes' to show a list of all currencies, functions, vari‐
136 ables, units, or prefixes. Enter a search term to find matching
137 variables, functions, units, and/or prefixes. If command is
138 called with no argument all user-definied objects are listed.
139 Example: list functions.
140 Example: find dinar.
141 Example: find variables planck.
142
143 function name expression
144 Creates a function with the specified name and expression. Use
145 '\x', '\y', '\z', '\a', etc. for arguments in the expression.
146 Example: function func1 5*\x.
147
148 help [command]
149
150 info Displays information about a function, variable, unit, or pre‐
151 fix.
152 Example: info sin.
153
154 MC/MS/M+/M-
155 Memory operations (memory clear, memory store, memory plus,
156 memory minus). Recall the memory using the MR/MRC variable.
157
158 mode Displays the current mode.
159
160 partial fraction
161 Applies partial fraction decomposition to the current result.
162
163 save, store name [category] [title]
164 Saves the current result in a variable with the specified name.
165 You may optionally also provide a category (default "Tempo‐
166 rary") and a title. If name equals "mode" or "definitions",
167 the current mode and definitions, respectively, will be saved.
168 Example: store var1.
169
170 save definitions
171
172 save mode
173
174 set option value
175
176 to, convert, -> unit/"to"-command
177 Converts the previous result. Equivalent to using "to" at the
178 end of an expression. Example: to m/s
179 Example: to bin
180
181 variable name expression
182 Create a variable with the specified name and expression.
183 Example: variable var1 pi / 2.
184
185 quit/exit
186 Terminates the program.
187
188 Commands for RPN mode:
189
190 rpn state
191 (De)activates the Reverse Polish Notation stack and syntax.
192 "syntax" activates only the RPN syntax and "stack" enables the
193 RPN stack.
194
195 stack Displays the RPN stack.
196
197 clear stack
198 Clears the entire RPN stack.
199
200 copy [index]
201 Duplicates a value on the RPN stack to the top of the stack. If
202 no index is specified, the top of the stack is duplicated. In‐
203 dex 1 is the top of stack and negative index values count from
204 the bottom of the stack.
205
206 move index 1 index 2
207 Changes the position of a value on the RPN stack. Index 1 is
208 the top of stack and negative index values count from the bot‐
209 tom of the stack.
210 Example: move 2 4
211
212 pop [index]
213 Removes the top of the RPN stack or the value at the specified
214 index. Index 1 is the top of stack and negative index values
215 count from the bottom of the stack.
216
217 rotate [direction]
218 Rotates the RPN stack up (default) or down.
219
220 swap [index 1] [index 2]
221 Swaps position of values on the RPN stack. If no index is spec‐
222 ified, the values on the top of the stack (index 1 and index 2)
223 will be swapped and if only one index is specified, the value
224 at this index will be swapped with the top value. Index 1 is
225 the top of stack and negative index values count from the bot‐
226 tom of the stack.
227 Example: swap 2 4
228
229 When a line begins with '/', the text that follows is always inter‐
230 preted as a command.
231
233 Tab shows a list of functions, variables, and units that matches
234 the last object in the current expression
235
236 Ctrl+D terminates the program
237
238 Ctrl+E switches between approximation modes (exact, try exact, auto)
239
240 Ctrl+F switches between fraction modes (simple, decimal, auto)
241
242 Ctrl+A saves the current result in a temporary variable
243
244 Ctrl+L clears the screen
245
247 These settings are changed using the set command (e.g. set base 16) or
248 the -s, --set command line option (e.g. qalc -s "base 16"). Possible
249 values are shown in parenthesis. 1 and 0 can be used instead of on and
250 off, yes and no. If the value is left out, a value of 1 is generally
251 assumed. The default value is marked with '*'.
252
253 Algebraic mode:
254
255 algebra mode, alg (1* = expand, 2 = factorize)
256 Determines if the expression is factorized or not after calcu‐
257 lation.
258
259 assume nonzero denominators, nzd (on*, off)
260 Determines if unknown values will be assumed non-zero (x/x=1).
261
262 warn nonzero denominators, warnnzd (on*, off)
263 Display a message after a value has been assumed non-zero.
264
265 assumptions, asm (unknown*, non-zero, positive, negative, non-positive,
266 non-negative + number, real*, rational, integer, boolean)
267 Default assumptions for unknown variables.
268
269 Calculation:
270
271 angle unit, angle (0 = none, 1* = radians, 2 = degrees, 3 = gradians)
272 Default angle unit for trigonometric functions.
273
274 approximation, appr (-1* = auto, 0 = exact, 1 = try exact, 2 = approxi‐
275 mate, 3 = dual)
276 How approximate variables and calculations are handled. In ex‐
277 act mode approximate values will not be calculated.
278
279 interval arithmetic, ia (on*, off)
280 If activated, interval arithmetic determines the final preci‐
281 sion of calculations (avoids wrong results after loss of sig‐
282 nificance) with approximate functions and/or irrational num‐
283 bers.
284
285 interval calculation, ic (1* = variance formula, 2 = interval arith‐
286 metic)
287 Determines the method used for interval calculation / uncer‐
288 tainty propagation.
289
290 precision, prec (> 0) 10*
291 Specifies the default number of significant digits displayed
292 and determines the precision used for approximate calculations.
293
294 Enabled objects:
295
296 calculate functions, calcfunc (on*, off)
297
298 calculate variables, calcvar (on*, off)
299
300 complex numbers, cplx (on*, off)
301
302 functions, func (on*, off)
303
304 infinite numbers, inf (on*, off)
305
306 units (on*, off)
307
308 unknowns (on, off*)
309 Interpret undefined symbols in expressions as unknown vari‐
310 ables.
311
312 variables, var (on*, off)
313
314 variable units, varunit (on*, off)
315 If activated physical constants include units (e.g. c =
316 299 792 458 m∕s).
317
318 Generic display options:
319
320 abbreviations, abbr (on*, off)
321 Use abbreviated names for units and variables.
322
323 color (0 = off, 1* = default, 2 = light)
324 Use colors to highlight different elements of expressions and
325 results.
326
327 division sign, divsign (0* = /, 1 = division slash, 2 = division sign)
328
329 excessive parentheses, expar (on, off*)
330
331 minus last, minlast (on, off*)
332 Always place negative values last.
333
334 multiplication sign, mulsign (0 = *, 1 = multiplication dot, 2* = mul‐
335 tiplication x, 3 = middle dot)
336
337 short multiplication, shortmul (on*, off)
338
339 spacious, space (on*, off)
340 Add extra space around operators.
341
342 spell out logical, spellout (on*, off)
343
344 unicode, uni (on*, off)
345 Display Unicode characters.
346
347 vertical space, vspace (on*, off)
348 Add empty lines before and after result.
349
350 Numerical display:
351
352 base (-1114112 - 1114112, bin, oct, dec*, hex, sexa, time, roman)
353
354 base display, basedisp (0 = none, 1* = normal, 2 = alternative)
355
356 complex form, cplxform (0* = rectangular, 1 = exponential, 2 = polar, 3
357 = cis, 4 = angle)
358
359 decimal comma (locale*, off, on)
360 Determines the default decimal separator.
361
362 digit grouping, group (0* = off, 1 = standard, 2 = locale)
363
364 fractions, fr (-1* = auto, 0 = off, 1 = exact, 2 = on, 3 = mixed, 4 =
365 long, 5 = dual)
366 Determines how rational numbers are displayed (e.g. 5/4 = 1 +
367 1/4 = 1.25). 'long' removes limits on the size of the numerator
368 and denonimator.
369
370 hexadecimal two's, hextwos (on, off*)
371 Enables two's complement representation for display of negative
372 hexadecimal numbers.
373
374 imaginary j, imgj (on, off*)
375 Use 'j' (instead of 'i') as default symbol for the imaginary
376 unit.
377
378 interval display, ivdisp (0* = adaptive, 1 = significant, 2 = interval,
379 3 = plusminus, 4 = midpoint, 5 = upper, 6 = lower)
380
381 lowercase e, lowe (on, off*)
382 Use lowercase e for E-notation (5e2 = 5 * 10^2).
383
384 lowercase numbers, lownum (on, off*)
385 Use lowercase letters for number bases > 10.
386
387 max decimals, maxdeci (-1 = off*, >= 0)
388
389 min decimals, mindeci (-1 = off*, >= 0)
390
391 rounding (0 = standard*, 1 = even, 2 = truncate)
392 Determines whether how approximate numbers are rounded (round
393 halfway numbers away from zero or towards the nearest even
394 digit, or round all numbers towards zero).
395
396 scientific notation, exp (0 = off, -1 = auto*, -3 = engineering, 1 =
397 pure, 3 = scientific, >= 0)
398 Determines how scientific notation is used (e.g. 5 543 000 =
399 5.543E6).
400
401 show ending zeroes, zeroes (on*, off)
402 If actived, zeroes are kept at the end of approximate numbers.
403
404 two's complement, twos (on*, off)
405 Enables two's complement representation for display of negative
406 binary numbers.
407
408 Parsing:
409
410 caret as xor, xor^ (on, off*)
411 Use ^ as bitwise exclusive OR operator.
412
413 decimal comma (locale*, off, on)
414 Determines the default decimal separator.
415
416 ignore comma (on, off*)
417 Allows use of ',' as thousands separator.
418
419 ignore dot (on, off*)
420 Allows use of '.' as thousands separator.
421
422 imaginary j, imgj (on, off*)
423 Use 'j' (instead of 'i') as default symbol for the imaginary
424 unit.
425
426 input base, inbase (-1114112 - 1114112, bin, oct, dec*, hex, roman)
427
428 limit implicit multiplication, limimpl (on, off*)
429
430 parsing mode, syntax (0* = adaptive, 1 = implicit first, 2 = conven‐
431 tional, 3 = chain, 4 = rpn)
432 See syntax section.
433
434 read precision, readprec (0* = off, 1 = always, 2 = when decimals)
435 If activated, numbers are interpreted as approximate with pre‐
436 cision equal to the number of significant digits (3.20 =
437 3.20+/-0.005).
438
439 Units:
440
441 all prefixes, allpref (on, off*)
442 Enables automatic use of hecto, deca, deci, and centi.
443
444 autoconversion, conv (0 = none, 1 = optimal*, 2 = base, 3 = optimalsi,
445 4 = mixed)
446 Controls automatic unit conversion of the result. 'optimalsi'
447 always converts non-SI units, while 'optimal' only converts to
448 more optimal unit expressions, with less units and exponents.
449
450 binary prefixes, binpref (on, off*)
451 If activated, binary prefixes are used by default for informa‐
452 tion units.
453
454 currency conversion, curconv (on*, off)
455 Enables automatic conversion to the local currency when optimal
456 unit conversion is enabled.
457
458 denominator prefixes, denpref (on*, off)
459 Enables automatic use of prefixes in the denominator of unit
460 expressions.
461
462 place units separately, unitsep (on*, off)
463 If activated, units are separated from variables at the end of
464 the result.
465
466 prefixes, pref (on*, off)
467 Enables automatic use of prefixes in the result.
468
469 show negative exponents, negexp (on, off*)
470 Use negative exponents instead of division for units in result
471 (m/s = m*s^-1).
472
473 sync units, sync (on*, off)
474
475 temperature units, temp (0 = hybrid*, 1 = absolute, 2 = relative)
476 Determines how expressions with temperature units are calcu‐
477 lated (hybrid acts as absolute if the expression contains dif‐
478 ferent temperature units, otherwise as relative).
479
480 update exchange rates, upxrates (-1 = ask*, 0 = never, > 0 = days)
481
482 Other:
483
484 clear history (yes, no*)
485 Do not save expression history on exit.
486
487 ignore locale (yes, no*)
488 Ignore system language and use English (requires restart).
489
490 rpn (on, off*)
491 Activates the Reverse Polish Notation stack.
492
493 save definitions (yes*, no)
494 Save functions, units, and variables on exit.
495
496 save mode (yes*, no)
497 Save settings on exit.
498
499 sigint action, sigint (0 = kill*, 1 = exit, 2 = interrupt)
500 Determines how the SIGINT signal (Ctrl+C) is handled.
501
503 Mathematical entities:
504
505 Numbers
506 These are the regular numbers composed by digits 0-9 and a deci‐
507 mal sign — a dot, or a comma if it is the default decimal point
508 in the locale/language used. If comma is used as decimal sign,
509 the dot is still kept as an alternative decimal sign, if not ex‐
510 plicitly deactivated. Numbers include integers, real numbers,
511 and complex numbers. The imaginary part of complex numbers are
512 written with as regular number followed by the special variable
513 "i" (can be changed to a "j"), which represents the square root
514 of -1. Spaces between digits are ignored ("5 5 = 55"). "E" (or
515 "e") can be considered as a shortcut for writing many zeroes and
516 is equivalent to multiplication by 10 raised to the power of the
517 right-hand value (e.g. "5E3 = 5000"). Sexagesimal numbers (and
518 time) can be entered directly using colons (e.g. "5:30 = 5.5").
519 A number immediately preceded "0b", "0o", "0d" or "0x" are in‐
520 terpreted as a number with base 2, 8, 12 or 16, respectively
521 (e.g. "0x3f = 63").
522
523 Intervals
524 A number interval can be entered using the interval() function,
525 the uncertainty() function, or using "±" or "+/-" (e.g. 5±1 =
526 uncertainty(5, 0.2) = interval(4, 6)). If the read precision op‐
527 tion is activated, decimal numbers are interpreted as an inter‐
528 val between the numbers that are normally rounded to the entered
529 number (e.g. 1.1 = 1.1±0.05). If interval calculation using
530 variance formula is activated (default), the interval represents
531 the standard uncertainty (deviation) of the value.
532
533 Vectors and Matrices
534 A matrix is a two-dimensional rectangular array of mathematical
535 objects. Vectors are matrices with only one row or column, and
536 thus one-dimensional sequences of objects. Vectors and matrices
537 are generated by various functions, or using syntax in the form
538 of [1 2 3 4] and [1 2; 3 4], with columns separated by space or
539 comma and rows separated by semi-colon, or (1, 2, 3, 4) and ((1,
540 2), (3, 4)).
541
542 Variables/Constants
543 See the list of variables in the GUI manual or using the command
544 .I list variables
545
546 Functions
547 See the list of functions in the GUI manual or using the command
548 .I list functions
549
550 Units and Prefixes
551 See the list of units and prefixes in the GUI manual or using
552 the command .I list units. Abbreviated, plural and singular
553 forms of unit names and prefixes are generally allowed. Prefixes
554 must be put immediately before the unit to be interpreted as
555 prefixes (eg. 5 mm = 0.005 m, but 5 m m = 5 m^2). For conve‐
556 nience units allow the power operator to be left out (e.g. 5 m2
557 = 5 m^2), with currencies excluded.
558
559 Unknowns
560 Unknowns are text strings without any associated value. These
561 are temporary unknown variables with default assumptions. Un‐
562 knowns can also be explicitly entered by placing a backslash (\)
563 before a single character (e.g. 5\a + 2\b) or using quotation
564 mark before and after a text string (e.g. 5 "apples" + 2 "ba‐
565 nanas"). If unknowns are activated characters without any asso‐
566 ciated variable, function or unit in an expression, will be re‐
567 garded as an unknown variable.
568
569 Date and Time
570 Date/time values are specified using quoted text string (quota‐
571 tion marks are not needed for function arguments), using stan‐
572 dard date and time format (YYYY-MM-DDTHH:MM:SS). Some local for‐
573 mats are also supported, but not recommended. The local time
574 zone are used, unless a time zone is specified at the end of the
575 time string (Z/UTC/GMT or +/-HH:MM). Date/time supports a small
576 subset of arithmetic operations. The time units represents cal‐
577 endar time, instead of average values, when added or subtracted
578 to a date.
579
580 Text
581 This category represent a number of different function argument
582 types, such as regular text and file names. They can, but do not
583 need to be put in quotes except when containing the argument
584 separator.
585
586 Comments
587 All text after a hashtag (e.g. (5*2)/2 #calculating triangle
588 area) is treated as a comment.
589
590 Operations and operators (word operators such as AND must be surrounded
591 by space):
592
593 Addition (+)
594
595 Subtraction (-)
596
597 Multiplication (*)
598
599 Division (/)
600
601 Remainder (%, rem) and modulo (%%, mod)
602 Returns the remainder after division.
603
604 Integer division (//, div)
605 Rounds the result of division towards zero.
606
607 Exponentiation (^, **)
608 Note that x^y^z equals x^(y^z), and not (x^y)^z. Note also that
609 for non-integer exponents with negative bases, the principal
610 root is returned and not the real root ((-8)^(1/3) equals 1 +
611 1.73i, and not -2). To calculate the real root for negative val‐
612 ues, use the cbrt() and root() functions.
613
614 10^x (E)
615
616 Parenthesis ((, ))
617
618 Parellel sum (∥, ||)
619 Returns the the reciprocal value of a sum of reciprocal values.
620 || is interpreted as parallel if units are used, otherwise as
621 logical OR.
622
623 Logical operators (!, NOT, ||, OR, &&, AND, XOR, NOR, NAND)
624
625 Bitwise operators (~, |, &, <<, >>, XOR)
626
627 Comparison operators (=, !=, <, <=, >, >=)
628 Returns 1 if expression is true and 0 if false. The x variable
629 is isolated if the expression does not evaluate as true or
630 false. Primarily used for equations and inequalities.
631
632 Dot product (.)
633
634 Element-wise operators (.*, ./, .^)
635
636 Save operator (:=, =)
637 Saves the expression to the right of the operator as a variable
638 or function (e.g. var1:=5, func1():=x+y, var1=ln(5)+2). If the
639 colon is omitted the expression is calculated before it is as‐
640 signed to the variable.
641
642 Evaluation priority order: parenthesis, 10^x, exponentiation, func‐
643 tions, bitwise NOT, logical NOT, multiplication/division/remainder,
644 parallel sum, addition/subtraction, bitwise NOT, bitwise shift, compar‐
645 isons, bitwise AND, bitwise XOR, bitwise OR, logical AND, logical OR.
646
647 The evaluation of short/implicit multiplication without any multiplica‐
648 tion sign (e.g. 5x, 5(2+3)), differs depending on the parsing mode. In
649 the conventional mode implicit multiplication does not differ from ex‐
650 plicit multiplication (12/2(1+2) = 12/2*3 = 18, 5x/5y = 5 * x/5 * y =
651 xy). In the parse implicit multiplication first mode, implicit multi‐
652 plication is parsed before explicit multiplication (12/2(1+2) = 12/(2 *
653 3) = 2, 5x/5y = (5 * x)/(5 * y) = x/y). The default adaptive mode works
654 as the parse implicit multiplication first mode, unless spaces are
655 found (1/5x = 1/(5 * x), but 1/5 x = (1/5) * x). In the adaptive mode
656 unit expressions are parsed separately (5 m/5 m/s = (5 * m)/(5 * (m/s))
657 = 1 s). Function arguments without parentheses are an exception, where
658 implicit multiplication in front of variables and units is parsed first
659 regardless of mode (sqrt 2x = sqrt(2x)).
660
661 In chain mode, expressions are calculated from left to right, ignoring
662 standard order of operations, like the immediate execution mode of a
663 traditional calculator (1+2*3 = (1+2)*3 = 9).
664
665 The "to"-operator is used for unit conversion and manipulation of how
666 the result is presented. Place " to " or a right arrow (e.g. "->") fol‐
667 lowed by one of expressions/commands the below, at the end of an ex‐
668 pression.
669
670 Unit conversion
671 - a unit or unit expression (e.g. meter or km/h)
672 prepend with ? to request the optimal prefix
673 prepend with b? to request the optimal binary prefix
674 prepend with + or - to force/disable use of mixed units
675 - a variable or physical constant (e.g. c)
676 - base (convert to base units)
677 - optimal (convert to optimal unit)
678 - mixed (convert to mixed units, e.g. hours + minutes)
679
680 Number base conversion
681 - bin, binary (show as binary number)
682 - bin# (show as binary number with specified number of bits)
683 - oct, octal (show as octal number)
684 - duo, duodecimal (show as duodecimal number)
685 - hex, hexadecimal (show as hexadecimal number)
686 - hex# (show as hexadecimal number with specified number of
687 bits)
688 - sex, sexa2, sexa3, sexagesimal (show as sexagesimal number;
689 sexa2 hides and sexa3 rounds arcseconds)
690 - latitude, latitude2, longitude, longitude2 (show as sexagesi‐
691 mal latitude/longitude; latitude2 and longitude2 hide arcsec‐
692 onds)
693 - bijective (shown in bijective base-26)
694 - fp16, fp32, fp64, fp80, fp128 (show in binary floating-point
695 format)
696 - bcd (show as binary-coded decimal)
697 - roman (show as roman numerals)
698 - time (show in time format)
699 - unicode
700 - base # (show in specified number base)
701 - bases (show as binary, octal, decimal and hexadecimal number)
702
703 Complex format
704 - rectangular, cartesian (show complex numbers in rectangular
705 form)
706 - exponential (show complex numbers in exponential form)
707 - polar (show complex numbers in polar form)
708 - cis (show complex numbers in cis form)
709 - angle, phasor (show complex numbers in angle/phasor notation)
710
711 Time and date conversion
712 - UTC (show date and time in UTC time zone)
713 - UTC+/-hh[:mm] (show date and time in specified time zone)
714 - calendars
715
716 Other conversion commands
717 - fraction (show result as mixed fraction)
718 - factors (factorize result)
719
720 Similarly where (or alternatively "/.") can be used at the end (but be‐
721 fore "to"), for variable assignments, function replacements, etc. (e.g.
722 "x+y where x=1 and y=2", "x^2=4 where x>0", and "sin(5) where
723 sin()=cos()").
724
726 Note that semicolon can be replaced with comma, if comma is not used as
727 decimal or thousands separator.
728
729 Basic functions and operators
730
731 sqrt 4 = sqrt(4)
732 = 4^(0.5)
733 = 4^(1/2)
734 = 2
735
736 sqrt(25; 16; 9; 4)
737 = [5 4 3 2]
738
739 sqrt(32)
740 = 4 * sqrt(2) (in exact mode)
741
742 cbrt(-27)
743 = root(-27; 3)
744 = -3 (real root)
745
746 (-27)^(1/3)
747 = 1.5 + 2.5980762i (principal root)
748
749 ln 25 = log(25; e)
750 = 3.2188758
751
752 log2(4)/log10(100)
753 = log(4; 2)/log(100; 10)
754 = 1
755
756 5! = 1 * 2 * 3 * 4 * 5
757 = 120
758
759 5\2 (integer division)
760 = 5//2
761 = trunc(5/2)
762 = 2
763
764 5 mod 3 = mod(5; 3)
765 = 2
766
767 52 to factors
768 = 2^2 * 13
769
770 25/4 * 3/5 to fraction
771 = 3 + 3/4
772
773 gcd(63; 27)
774 = 9
775
776 sin(pi/2) - cos(pi)
777 = sin(90 deg) - cos(180 deg)
778 = 2
779
780 sum(x; 1; 5)
781 = 1 + 2 + 3 + 4 + 5 = 15
782
783 sum(i^2+sin(i); 1; 5; i)
784 = 1^2 + sin(1) + 2^2 + sin(2) + ... = 55.176162
785
786 product(x; 1; 5)
787 = 1 * 2 * 3 * 4 * 5 = 120
788
789 var1:=5 store value 5 in variable var1
790
791 5^2 #this is a comment
792 = 25
793
794 sinh(0.5) where sinh()=cosh()
795 = cosh(0.5) = 1.1276260
796
797 plot(x^2; -5; 5)
798 plots the function y=x^2 from -5 to 5
799
800 Units
801
802 5 dm3 to L
803 = 25 dm^3 to L
804 = 5 L
805
806 20 miles / 2h to km/h
807 = 16.09344 km/h
808
809 1.74 to ft = 1.74 m to ft
810 = 5 ft + 8.5039370 in
811
812 1.74 m to -ft
813 = 5.7086614 ft
814
815 100 lbf * 60 mph to hp
816 = 16 hp
817
818 50 Ω * 2 A
819 = 100 V
820
821 50 Ω * 2 A to base
822 = 100 kg*m^2*s^-3*A^-1
823
824 10 N / 5 Pa
825 = (10 N)/(5 Pa) = 2 m^2
826
827 5 m/s to s/m
828 = 0.2 s/m
829
830 500 EUR - 20% to USD
831 = 451.04 USD
832
833 500 megabit/s * 2 h to b?byte
834 = 419.09516 gibibytes
835
836 Physical constants
837
838 k_e / G * a_0
839 = (coulombs_constant / newtonian_constant) * bohr_radius
840 = 7.126e9 kg*H*m^-1
841
842 planck ∕ (compton_wavelength * c)
843 = 9.1093837e-31 kg
844
845 5 ns * rydberg to c
846 = 6.0793194E-8c
847
848 atom(Hg; weight) + atom(C; weight) * 4 to g
849 = 4.129e-22 g
850
851 (G * planet(earth; mass) * planet(mars; mass))/(54.6e6 km)^2
852 = 8.58e16 N (gravitational attraction between earth and mars)
853
854 Uncertainty and interval arithmetic
855 result with interval arithmetic activated is shown in parenthesis
856
857 sin(5+/-0.2)^2/2+/-0.3
858 = 0.460±0.088 (0.46+/-0.12)
859
860 (2+/-0.02 J)/(523+/-5 W)
861 = 3.824+/-0.053 ms (3.82+/-±0.075 ms)
862
863 interval(-2; 5)^2
864 = intervall(-8.2500000; 12.750000) (intervall(0; 25))
865
866 Algebra
867
868 (5x^2 + 2)/(x - 3)
869 = 5x + 15 + 47/(x - 3)
870
871 (\a + \b)(\a - \b) = ("a" + "b")("a" - "b")
872 = 'a'^2 - 'b'^2
873
874 (x + 2)(x - 3)^3
875 = x^4 - 7x^3 + 9x^2 + 27x - 54
876
877 factorize x^4 - 7x^3 + 9x^2 + 27x - 54
878 = x^4 - 7x^3 + 9x^2 + 27x - 54 to factors
879 = (x + 2)(x - 3)^3
880
881 cos(x)+3y^2 where x=pi and y=2
882 = 11
883
884 gcd(25x; 5x^2)
885 = 5x
886
887 1/(x^2+2x-3) to partial fraction
888 = 1/(4x - 4) - 1/(4x + 12)
889
890 x+x^2+4 = 16
891 x = 3 or x = -4
892
893 x^2/(5 m) - hypot(x; 4 m) = 2 m where x > 0
894 x = 7.1340411 m
895
896 cylinder(20cm; x) = 20L
897 x = (1 / (2pi)) m
898 x = 16 cm (height of 20 L cylinder with radius 20 cm)
899
900 asin(sqrt(x)) = 0.2
901 x = sin(0.2)^2
902 x = 0.039469503
903
904 x^2 > 25x
905 = x > 25 or x < 0
906
907 solve(x = y+ln(y); y)
908 = lambertw(e^x)
909
910 solve2(5x=2y^2; sqrt(y)=2; x; y)
911 = 32/5
912
913 multisolve([5x=2y+32, y=2z, z=2x]; [x, y, z])
914 = [-32/3 -128/3 -64/3]
915
916 dsolve(diff(y; x) - 2y = 4x; 5)
917 = 6e^(2x) - 2x - 1
918
919 Calculus
920
921 diff(6x^2)
922 = 12x
923
924 diff(sinh(x^2)/(5x) + 3xy/sqrt(x))
925 = (2/5) * cosh(x^2) - sinh(x^2)/(5x^2) + (3y)/(2 * sqrt(x))
926
927 integrate(6x^2)
928 = 2x^3 + C
929
930 integrate(6x^2; 1; 5)
931 = 248
932
933 integrate(sinh(x^2)/(5x) + 3xy/sqrt(x))
934 = 2x * sqrt(x) * y + Shi(x^2) / 10 + C
935
936 integrate(sinh(x^2)/(5x) + 3xy/sqrt(x); 1; 2)
937 = 3.6568542y + 0.87600760
938
939 limit(ln(1 + 4x)/(3^x - 1); 0)
940 = 4 / ln(3)
941
942 Matrices and vectors
943
944 [1, 2, 3; 4, 5, 6]
945 = ((1; 2; 3); (4; 5; 6))
946 = [1 2 3; 4 5 6] (2x3 matrix)
947
948 (1; 2; 3) * 2 - 2
949 = [(1 * 2 - 2), (2 * 2 - 2), (3 * 2 - 2)]
950 = [0 2 4]
951
952 [1 2 3].[4 5 6]
953 = dot([1 2 3]; [4 5 6])
954 = 32 (dot product)
955
956 cross([1 2 3]; [4 5 6])
957 = [-3 6 -3] (cross product)
958
959 [1 2 3; 4 5 6].*[7 8 9; 10 11 12]
960 = hadamard([1 2 3; 4 5 6]; [7 8 9; 10 11 12])
961 = [7 16 27; 40 55 72] (hadamard product)
962
963 [1 2 3; 4 5 6] * [7 8; 9 10; 11 12]
964 = [58 64; 139 154] (matrix multiplication)
965
966 [1 2; 3 4]^-1
967 = inverse([1 2; 3 4])
968 = [-2 1; 1.5 -0.5]
969
970 Statistics
971
972 mean(5; 6; 4; 2; 3; 7)
973 = 4.5
974
975 stdev(5; 6; 4; 2; 3; 7)
976 = 1.87
977
978 quartile([5 6 4 2 3 7]; 1)
979 = percentile((5; 6; 4; 2; 3; 7); 25)
980 = 2.9166667
981
982 normdist(7; 5)
983 = 0.053990967
984
985 spearman(column(load(test.csv); 1); column(load(test.csv); 2))
986 = -0.33737388 (depends on the data in the CSV file)
987
988 Time and date
989
990 10:31 + 8:30 to time
991 = 19:01
992
993 10h 31min + 8h 30min to time
994 = 19:01
995
996 now to utc
997 = "2020-07-10T07:50:40Z"
998
999 "2020-07-10T07:50CET" to utc+8
1000 = "2020-07-10T14:50:00+08:00"
1001
1002 "2020-05-20" + 523d
1003 = addDays(2020-05-20; 523)
1004 = "2021-10-25"
1005
1006 today - 5 days
1007 = "2020-07-05"
1008
1009 "2020-10-05" - today
1010 = days(today; 2020-10-05)
1011 = 87
1012
1013 timestamp(2020-05-20)
1014 = 1 589 925 600
1015
1016 stamptodate(1 589 925 600)
1017 = "2020-05-20T00:00:00"
1018
1019 "2020-05-20" to calendars
1020 returns date in Hebrew, Islamic, Persian, Indian, Chinese, Ju‐
1021 lian, Coptic, and Ethiopian calendars
1022
1023 Number bases
1024
1025 52 to bin
1026 = 0011 0100
1027
1028 52 to bin16
1029 = 0000 0000 0011 0100
1030
1031 52 to oct
1032 = 064
1033
1034 52 to hex
1035 = 0x34
1036
1037 0x34 = hex(34)
1038 = base(34; 16)
1039 = 52
1040
1041 523<<2&250 to bin
1042 = 0010 1000
1043
1044 52.345 to float
1045 = 0100 0010 0101 0001 0110 0001 0100 1000
1046
1047 float(01000010010100010110000101001000)
1048 = 1715241/32768
1049 = 52.345001
1050
1051 floatError(52.345)
1052 = 1.2207031e-6
1053
1054 52.34 to sexa
1055 = 52°20'24"
1056
1057 1978 to roman
1058 = MCMLXXVIII
1059
1060 52 to base 32
1061 = 1K
1062
1063 sqrt(32) to base sqrt(2)
1064 = 100000
1065
1067 The manual of the graphical user interface at https://qalcu‐
1068 late.github.io/manual/index.html (includes more details about the syn‐
1069 tax and elements supported in mathematical expressions, and various op‐
1070 tions, and includes a complete list of functions, variables, and units)
1071
1073 Please report any bugs at https://github.com/Qalculate/libqalculate/is‐
1074 sues
1075
1077 Hanna Knutsson <hanna.knutsson@protonmail.com>.
1078
1079
1080
1081 13 July 2020 QALC(1)