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