1ORPIE(1) a console-based RPN calculator ORPIE(1)
2
3
4
6 orpie is a console-based RPN calculator with an interactive visual
7 stack.
8
10 orpie
11
13 CAUTION: while this manpage should be suitable as a quick reference, it
14 may be subject to miscellaneous shortcomings in typesetting. The defin‐
15 itive documentation is the user manual provided with Orpie in PDF for‐
16 mat.
17
18 This section describes how to use Orpie in its default configuration.
19 After familiarizing yourself with the basic operations as outlined in
20 this section, you may wish to consult the orpierc(5) manpage to see how
21 Orpie can be configured to better fit your needs.
22
23 OVERVIEW
24 The interface has two panels. The left panel combines status informa‐
25 tion with context-sensitive help; the right panel represents the calcu‐
26 lator's stack. (Note that the left panel will be hidden if Orpie is run
27 in a terminal with less than 80 columns.)
28
29 In general, you perform calculations by first entering data on to the
30 stack, then executing functions that operate on the stack data. As an
31 example, you can hit 1<enter>2<enter>+ in order to add 1 and 2.
32
33 ENTERING REAL NUMBERS
34 To enter a real number, just type the desired digits and hit enter. The
35 space bar will begin entry of a scientific notation exponent. The 'n'
36 key is used for negation. Here are some examples:
37
38 ────────────────────────────────────────────
39 Keypresses Resulting Entry
40 ────────────────────────────────────────────
41 1.23<enter> 1.23
42 1.23<space>23n<enter> 1.23e-23
43 1.23n<space>23<enter> -1.23e23
44 ────────────────────────────────────────────
45
46 ENTERING COMPLEX NUMBERS
47 Orpie can represent complex numbers using either cartesian (rectangu‐
48 lar) or polar coordinates. See PERFORMING BASIC COMMAND OPERATIONS to
49 see how to change the complex number display mode.
50
51 A complex number is entered by first pressing '(', then entering the
52 real part, then pressing ',' followed by the imaginary part. Alterna‐
53 tively, you can press '(' followed by the magnitude, then '<' followed
54 by the phase angle. The angle will be interpreted in degrees or radi‐
55 ans, depending on the current setting of the angle mode (see PERFORMING
56 BASIC COMMAND OPERATIONS). Examples:
57
58 ────────────────────────────────────────────────────────────────────
59 Keypresses Resulting Entry
60 ────────────────────────────────────────────────────────────────────
61 (1.23, 4.56<enter> (1.23, 4.56)
62 (0.7072<45<enter> (0.500065915655126, 0.50006591...
63 (1.23n,4.56<space>10<enter> (-1.23, 45600000000)
64 ────────────────────────────────────────────────────────────────────
65
66 ENTERING MATRICES
67 You can enter matrices by pressing '['. The elements of the matrix may
68 then be entered as described in the previous sections, and should be
69 separated using ','. To start a new row of the matrix, press '[' again.
70 On the stack, each row of the matrix is enclosed in a set of brackets;
71 for example, the matrix
72
73 1 2
74 3 4
75
76 would appear on the stack as [[1, 2][3, 4]].
77
78 Examples of matrix entry:
79
80 ─────────────────────────────────────────────────────────────────────
81 Keypresses Resulting Entry
82 ─────────────────────────────────────────────────────────────────────
83 [1,2[3,4<enter> [[1, 2][3, 4]]
84 [1.2<space>10,0[3n,5n<enter> [[ 12000000000, 0 ][ -3, -5 ]]
85 [(1,2,3,4[5,6,7,8<enter> [[ (1, 2), (3, 4) ][ (5, 6), (...
86 ─────────────────────────────────────────────────────────────────────
87
88 ENTERING DATA WITH UNITS
89 Real and complex scalars and matrices can optionally be labeled with
90 units. After typing in the numeric portion of the data, press '_' fol‐
91 lowed by a units string. The format of units strings is described in
92 the UNITS FORMATTING section.
93
94 Examples of entering dimensioned data:
95
96 ───────────────────────────────────────────────────────
97 Keypresses Resulting Entry
98 ───────────────────────────────────────────────────────
99 1.234_N*mm^2/s<enter> 1.234_N*mm^2*s^-1
100 (2.3,5_s^-4<enter> (2.3, 5)_s^-4
101 [1,2[3,4_lbf*in<enter> [[ 1, 2 ][ 3, 4 ]]_lbf*in
102 _nm<enter> 1_nm
103 ───────────────────────────────────────────────────────
104
105 ENTERING EXACT INTEGERS
106 An exact integer may be entered by pressing '#' followed by the desired
107 digits. The base of the integer will be assumed to be the same as the
108 current calculator base mode (see PERFORMING BASIC COMMAND OPERATIONS
109 to see how to set this mode). Alternatively, the desired base may be
110 specified by pressing space and appending one of {b, o, d, h}, to rep‐
111 resent binary, octal, decimal, or hexadecimal, respectively. On the
112 stack, the representation of the integer will be changed to match the
113 current base mode. Examples:
114
115 ─────────────────────────────────────────────
116 Keypresses Resulting Entry
117 ─────────────────────────────────────────────
118 #123456<enter> # 123456`d
119 #ffff<space>h<enter> # 65535`d
120 #10101n<space>b<enter> # -21`d
121 ─────────────────────────────────────────────
122
123 Note that exact integers may have unlimited length, and the basic
124 arithmetic operations (addition, subtraction, multiplication, division)
125 will be performed using exact arithmetic when both arguments are inte‐
126 gers.
127
128 ENTERING VARIABLE NAMES
129 A variable name may be entered by pressing '@' followed by the desired
130 variable name string. The string may contain alphanumeric characters,
131 dashes, and underscores. Example:
132
133 ─────────────────────────────────
134 Keypresses Resulting Entry
135 ─────────────────────────────────
136
137 @myvar @ myvar
138 ─────────────────────────────────
139
140 Orpie also supports autocompletion of variable names. The help panel
141 displays a list of pre-existing variables that partially match the name
142 currently being entered. You can press '<tab>' to iterate through the
143 list of matching variables.
144
145 As a shortcut, keys <f1>-<f4> will enter the variables (``registers'')
146 @ r01 through @ r04.
147
148 ENTERING PHYSICAL CONSTANTS
149 Orpie includes definitions for a number of fundamental physical con‐
150 stants. To enter a constant, press 'C', followed by the first few let‐
151 ters/digits of the constant's symbol, then hit enter. Orpie offers an
152 autocompletion feature for physical constants, so you only need to type
153 enough of the constant to identify it uniquely. A list of matching con‐
154 stants will appear in the left panel of the display, to assist you in
155 finding the desired choice.
156
157 The following is a list of Orpie's physical constant symbols:
158
159 ──────────────────────────────────────────────
160 Symbol Physical Constant
161 ──────────────────────────────────────────────
162 NA Avagadro's number
163 k Boltzmann constant
164 Vm molar volume
165 R universal gas constant
166 stdT standard temperature
167 stdP standard pressure
168 sigma Stefan-Boltzmann constant
169 c speed of light
170 eps0 permittivity of free space
171 u0 permeability of free space
172 g acceleration of gravity
173 G Newtonian gravitational constant
174 h Planck's constant
175 hbar Dirac's constant
176 e electron charge
177 me electron mass
178 mp proton mass
179 alpha fine structure constant
180 phi magnetic flux quantum
181 F Faraday's constant
182 Rinf ``infinity'' Rydberg constant
183 a0 Bohr radius
184 uB Bohr magneton
185 uN nuclear magneton
186 lam0 wavelength of a 1eV photon
187 f0 frequency of a 1eV photon
188 lamc Compton wavelength
189 c3 Wien's constant
190 ──────────────────────────────────────────────
191
192 All physical constants are defined in the Orpie run-configuration file;
193 consult the orpierc(5) manpage if you wish to define your own constants
194 or change the existing definitions.
195
196 ENTERING DATA WITH AN EXTERNAL EDITOR
197 Orpie can also parse input entered via an external editor. You may find
198 this to be a convenient method for entering large matrices. Pressing
199 'E' will launch the external editor, and the various data types may be
200 entered as illustrated by the examples below:
201
202 ────────────────────────────────────────────────────────────────────────────────────────
203 Data Type Sample Input String
204 ────────────────────────────────────────────────────────────────────────────────────────
205 exact integer #12345678`d, where the trailing
206 letter is one of the base characters {b, o, d, h}
207 real number -123.45e67
208 complex number (1e10, 2) or (1 <90)
209 real matrix [[1, 2][3.1, 4.5e10]]
210 complex matrix [[(1, 0), 5][1e10, (2 <90)]]
211 variable @myvar
212 ────────────────────────────────────────────────────────────────────────────────────────
213
214 Real and complex numbers and matrices may have units appended; just add
215 a units string such as ``_N*m/s'' immediately following the numeric
216 portion of the expression.
217
218 Notice that the complex matrix input parser is quite flexible; real and
219 complex matrix elements may be mixed, and cartesian and polar complex
220 formats may be mixed as well.
221
222 Multiple stack entries may be specified in the same file, if they are
223 separated by whitespace. For example, entering (1, 2) 1.5 into the edi‐
224 tor will cause the complex value (1, 2) to be placed on the stack, fol‐
225 lowed by the real value 1.5.
226
227 The input parser will discard whitespace where possible, so feel free
228 to add any form of whitespace between matrix rows, matrix elements,
229 real and complex components, etc.
230
231 EXECUTING BASIC FUNCTION OPERATIONS
232 Once some data has been entered on the stack, you can apply operations
233 to that data. For example, '+' will add the last two elements on the
234 stack. By default, the following keys have been bound to such opera‐
235 tions:
236
237 ─────────────────────────────────────────────────────
238 Keys Operations
239 ─────────────────────────────────────────────────────
240 + add last two stack elements
241 - subtract element 1 from element 2
242 * multiply last two stack elements
243 / divide element 2 by element 1
244 ^ raise element 2 to the power of element 1
245 n negate last element
246 i invert last element
247 s square root function
248 a absolute value function
249 e exponential function
250 l natural logarithm function
251 c complex conjugate function
252 ! factorial function
253 % element 2 mod element 1
254 S store element 2 in (variable) element 1
255 ; evaluate variable to obtain contents
256 ─────────────────────────────────────────────────────
257
258 As a shortcut, function operators will automatically enter any data
259 that you were in the process of entering. So instead of the sequence
260 2<enter>2<enter>+, you could type simply 2<enter>2+ and the second num‐
261 ber would be entered before the addition operation is applied.
262
263 As an additional shortcut, any variable names used as function argu‐
264 ments will be evaluated before application of the function. In other
265 words, it is not necessary to evaluate variables before performing
266 arithmetic operations on them.
267
268 EXECUTING FUNCTION ABBREVIATIONS
269 One could bind nearly all calculator operations to specific keypresses,
270 but this would rapidly get confusing since the PC keyboard is not
271 labeled as nicely as a calculator keyboard is. For this reason, Orpie
272 includes an abbreviation syntax.
273
274 To activate an abbreviation, press ''' (quote key), followed by the
275 first few letters/digits of the abbreviation, then hit enter. Orpie
276 offers an autocompletion feature for abbreviations, so you only need to
277 type enough of the operation to identify it uniquely. The matching
278 abbreviations will appear in the left panel of the display, to assist
279 you in finding the appropriate operation.
280
281 To avoid interface conflicts, abbreviations may be entered only when
282 the entry buffer (the bottom line of the screen) is empty.
283
284 The following functions are available as abbreviations:
285
286 ─────────────────────────────────────────────────────────────────────────────────────────────────────
287 Abbreviations Functions
288 ─────────────────────────────────────────────────────────────────────────────────────────────────────
289 inv inverse function
290 pow raise element 2 to the power of element 1
291 sq square last element
292 sqrt square root function
293 abs absolute value function
294 exp exponential function
295 ln natural logarithm function
296 10^ base 10 exponential function
297 log10 base 10 logarithm function
298 conj complex conjugate function
299 sin sine function
300 cos cosine function
301 tan tangent function
302 sinh hyperbolic sine function
303 cosh hyperbolic cosine function
304 tanh hyperbolic tangent function
305 asin arcsine function
306 acos arccosine function
307 atan arctangent function
308 asinh inverse hyperbolic sine function
309 acosh inverse hyperbolic cosine function
310 atanh inverse hyperbolic tangent function
311 re real part of complex number
312 im imaginary part of complex number
313 gamma Euler gamma function
314 lngamma natural log of Euler gamma function
315 erf error function
316 erfc complementary error function
317 fact factorial function
318 gcd greatest common divisor function
319 lcm least common multiple function
320 binom binomial coefficient function
321 perm permutation function
322 trans matrix transpose
323 trace trace of a matrix
324 solvelin solve a linear system of the form Ax = b
325 mod element 2 mod element 1
326 floor floor function
327 ceil ceiling function
328 toint convert a real number to an integer type
329 toreal convert an integer type to a real number
330 add add last two elements
331 sub subtract element 1 from element 2
332 mult multiply last two elements
333 div divide element 2 by element 1
334 neg negate last element
335 store store element 2 in (variable) element 1
336 eval evaluate variable to obtain contents
337 purge delete a variable
338 total sum the columns of a real matrix
339 mean compute the sample means of the columns of a real matrix
340
341 sumsq sum the squares of the columns of a real matrix
342 var compute the unbiased sample variances of the columns of a real matrix
343 varbias compute the biased (population) sample variances of the columns of a real matrix
344 stdev compute the unbiased sample standard deviations of the columns of a real matrix
345 stdevbias compute the biased (pop.) sample standard deviations of the columns of a matrix
346 min find the minima of the columns of a real matrix
347 max find the maxima of the columns of a real matrix
348 utpn compute the upper tail probability of a normal distribution
349 uconvert convert element 2 to an equivalent expression with units matching element 1
350 ustand convert to equivalent expression using SI standard base units
351 uvalue drop the units of the last element
352 ─────────────────────────────────────────────────────────────────────────────────────────────────────
353
354 Entering abbreviations can become tedious when performing repetitive
355 calculations. To save some keystrokes, Orpie will automatically bind
356 recently-used operations with no prexisting binding to keys <f5>-<f12>.
357 The current autobindings can be viewed by pressing 'h' to cycle between
358 the various pages of the help panel.
359
360 EXECUTING BASIC COMMAND OPERATIONS
361 In addition to the function operations listed in the section EXECUTING
362 BASIC FUNCTION OPERATIONS, a number of basic calculator commands have
363 been bound to single keypresses:
364
365 ─────────────────────────────────────────────────────────────────────────────
366 Keys Operations
367 ─────────────────────────────────────────────────────────────────────────────
368 \ drop last element
369 | clear all stack elements
370 <pagedown> swap last two elements
371 <enter> duplicate last element (when entry buffer is empty)
372 u undo last operation
373 r toggle angle mode between degrees and radians
374 p toggle complex display mode between rectangular and polar
375 b cycle base display mode between binary, octal, decimal, hex
376 h cycle through multiple help windows
377 v view last stack element in a fullscreen editor
378 E create a new stack element using an external editor
379 P enter 3.14159265 on the stack
380 C-L refresh the display
381 <up> begin stack browsing mode
382 Q quit Orpie
383 ─────────────────────────────────────────────────────────────────────────────
384
385 EXECUTING COMMAND ABBREVIATIONS
386 In addition to the function operations listed in the section EXECUTING
387 FUNCTION ABBREVIATIONS, there are a large number of calculator commands
388 that have been implemented using the abbreviation syntax:
389
390 ─────────────────────────────────────────────────────────────────────────────────────
391 Abbreviations Calculator Operation
392 ─────────────────────────────────────────────────────────────────────────────────────
393 drop drop last element
394 clear clear all stack elements
395 swap swap last two elements
396 dup duplicate last element
397 undo undo last operation
398 rad set angle mode to radians
399 deg set angle mode to degrees
400 rect set complex display mode to rectangular
401 polar set complex display mode to polar
402 bin set base display mode to binary
403 oct set base display mode to octal
404 dec set base display mode to decimal
405 hex set base display mode to hexidecimal
406 view view last stack element in a fullscreen editor
407 edit create a new stack element using an external editor
408
409 pi enter 3.14159265 on the stack
410 rand generate a random number between 0 and 1 (uniformly distributed)
411 refresh refresh the display
412 about display a nifty ``About Orpie'' screen
413 quit quit Orpie
414 ─────────────────────────────────────────────────────────────────────────────────────
415
416 BROWSING THE STACK
417 Orpie offers a stack browsing mode to assist in viewing and manipulat‐
418 ing stack data. Press <up> to enter stack browsing mode; this should
419 highlight the last stack element. You can use the up and down arrow
420 keys to select different stack elements. The following keys are useful
421 in stack browsing mode:
422
423 ──────────────────────────────────────────────────────────────────────────────────────────────────
424 Keys Operations
425 ──────────────────────────────────────────────────────────────────────────────────────────────────
426 q quit stack browsing mode
427 <left> scroll selected entry to the left
428 <right> scroll selected entry to the right
429 r cyclically ``roll'' stack elements downward, below the selected element (inclusive)
430 R cyclically ``roll'' stack elements upward, below the selected element (inclusive)
431 v view the currently selected element in a fullscreen editor
432 E edit the currently selected element with an external editor
433 <enter> duplicate the currently selected element
434 ──────────────────────────────────────────────────────────────────────────────────────────────────
435
436 The left and right scrolling option may prove useful for viewing very
437 lengthy stack entries, such as large matrices. The edit option provides
438 a convenient way to correct data after it has been entered on the
439 stack.
440
441 UNITS FORMATTING
442 A units string is a list of units separated by '*' to indicate multi‐
443 plication and '/' to indicate division. Units may be raised to
444 real-valued powers using the '^'character. A contrived example of a
445 valid unit string would be "N*nm^2*kg/s/in^-3*GHz^2.34".
446
447 Orpie supports the standard SI prefix set, {y, z, a, f, p, n, u, m, c,
448 d, da, h, k, M, G, T, P, E, Z, Y} (note the use of 'u' for micro-).
449 These prefixes may be applied to any of the following exhaustive sets
450 of units:
451
452 ────────────────────────────────
453 String Length Unit
454 ────────────────────────────────
455 m meter
456 ft foot
457 in inch
458 yd yard
459 mi mile
460 pc parsec
461 AU astronomical unit
462 Ang angstrom
463 furlong furlong
464 pt PostScript point
465 pica PostScript pica
466 nmi nautical mile
467 lyr lightyear
468 ────────────────────────────────
469
470 ─────────────────────────────
471 String Mass Unit
472 ─────────────────────────────
473 g gram
474 lb pound mass
475 oz ounce
476
477 slug slug
478 lbt Troy pound
479 ton (USA) short ton
480 tonl (UK) long ton
481 tonm metric ton
482 ct carat
483 gr grain
484 ─────────────────────────────
485
486 ───────────────────────
487 String Time Unit
488 ───────────────────────
489 s second
490 min minute
491 hr hour
492 day day
493 yr year
494 Hz Hertz
495 ───────────────────────
496
497 ──────────────────────────────
498 String Temperature Unit
499 ──────────────────────────────
500 K Kelvin
501 R Rankine
502 ──────────────────────────────
503
504 Note: No, Celsius and Fahrenheit will not be supported. Because these
505 temperature units do not share a common zero point, their behavior is
506 ill-defined under many operations.
507
508 ──────────────────────────────────────────
509 String ``Amount of Substance'' Unit
510 ──────────────────────────────────────────
511 mol Mole
512 ──────────────────────────────────────────
513
514 ─────────────────────────
515 String Force Unit
516 ─────────────────────────
517 N Newton
518 lbf pound force
519 dyn dyne
520 kip kip
521 ─────────────────────────
522
523 ──────────────────────────────────
524 String Energy Unit
525 ──────────────────────────────────
526 J Joule
527 erg erg
528 cal calorie
529 BTU british thermal unit
530 eV electron volt
531 ──────────────────────────────────
532
533 ─────────────────────────────
534 String Electrical Unit
535 ─────────────────────────────
536 A Ampere
537 C Coulomb
538 V volt
539 Ohm Ohm
540 F Farad
541 H Henry
542 T Tesla
543 G Gauss
544
545 Wb Weber
546 Mx Maxwell
547 ─────────────────────────────
548
549 ────────────────────────
550 String Power Unit
551 ────────────────────────
552 W Watt
553 hp horsepower
554 ────────────────────────
555
556 ────────────────────────────────────
557 String Pressure Unit
558 ────────────────────────────────────
559 Pa Pascal
560 atm atmosphere
561 bar bar
562 Ohm Ohm
563 mmHg millimeters of mercury
564 inHg inches of mercury
565 ────────────────────────────────────
566
567 ────────────────────────────
568 String Luminance Unit
569 ────────────────────────────
570 cd candela
571 lm lumen
572 lx lux
573 ────────────────────────────
574
575 Note: Although the lumen is defined by 1_lm = 1_cd * sr, Orpie drops
576 the steridian because it is a dimensionless unit and therefore is of
577 questionable use to a calculator.
578
579 ──────────────────────────────
580 String Volume Unit
581 ──────────────────────────────
582 ozfl fluid ounce (US)
583 cup cup (US)
584 pt pint (US)
585 qt quart (US)
586 gal gallon (US)
587 L liter
588 ──────────────────────────────
589
590 All units are defined in the Orpie run-configuration file; consult the
591 orpierc(5) manpage if you wish to define your own units or change the
592 existing definitions.
593
595 Orpie is Free Software; you can redistribute it and/or modify it under
596 the terms of the GNU General Public License (GPL), Version 2, as pub‐
597 lished by the Free Software Foundation. You should have received a copy
598 of the GPL along with this program, in the file ``COPYING''.
599
601 Orpie includes portions of the ocamlgsl [1] bindings supplied by
602 Olivier Andrieu, as well as the curses bindings from the OCaml Text
603 Mode Kit [2] written by Nicolas George. I would like to thank these
604 authors for helping to make Orpie possible.
605
607 Orpie author: Paul Pelzl <pelzlpj@gmail.com>
608 Orpie website: http://pessimization.com/software/orpie
609
610 Feel free to contact me if you have bugs, feature requests, patches,
611 etc. I would also welcome volunteers interested in packaging Orpie for
612 various platforms.
613
615 [1] http://oandrieu.nerim.net/ocaml/gsl/
616 [2] http://www.nongnu.org/ocaml-tmk/
617 [3] http://www.gnu.org/software/gnu-arch/.
618
620 orpierc(5), orpie-curses-keys(1)
621
622a console-based RPN calculator 11 April 2014 ORPIE(1)