# orpierc man page

orpierc is the configuration textfile for the orpie(1) console calculator.

## Introduction

CAUTION: while this manpage should be suitable as a quick reference, it may be subject to miscellaneous shortcomings in typesetting. The definitive documentation is the user manual provided with Orpie in PDF format.

Orpie reads a run-configuration textfile (generally /etc/orpierc or /usr/local/etc/orpierc) to determine key and command bindings. You can create a personalized configuration file in $HOME/.orpierc, and select bindings that match your usage patterns. The recommended procedure is to “include” the orpierc file provided with Orpie (see Including Other Rcfiles), and add or remove settings as desired.

## Orpierc Syntax

You may notice that the orpierc syntax is similar to the syntax used in the configuration file for the Mutt email client (muttrc).

Within the orpierc file, strings should be enclosed in double quotes ("). A double quote character inside a string may be represented by The backslash character must be represented by doubling it (\\).

### Including Other Rcfiles

Syntax: include *filename_string*

This syntax can be used to include one run-configuration file within another. This command could be used to load the default orpierc file (probably found in /etc/orpierc) within your personalized rcfile,

{/.orpierc}. The filename string should be enclosed in quotes.

### Setting Configuration Variables

Syntax: set *variable*=*value_string*

Several configuration variables can be set using this syntax; check the Configuration Variables description to see a list. The variables are unquoted, but the values should be quoted strings.

### Creating Key Bindings

Syntax: bind *key_identifier operation*

This command will bind a keypress to execute a calculator operation. The various operations, which should not be enclosed in quotes, may be found in the section on Calculator Operations. Key identifiers may be specified by strings that represent a single keypress, for example "m" (quotes included). The key may be prefixed with "\\C" or "\\M" to represent Control or Meta (Alt) modifiers, respectively; note that the backslash must be doubled. A number of special keys lack single-character representations, so the following strings may be used to represent them:

- "<esc>"
- "<tab>"
- "<enter>"
- "<return>"
- "<insert>"
- "<home>"
- "<end>"
- "<pageup>"
- "<pagedown>"
- "<space>"
- "<left>"
- "<right>"
- "<up>"
- "<down>"
- "<f1>" to "<f12>"

Due to differences between various terminal emulators, this key identifier syntax may not be adequate to describe every keypress. As a workaround, Orpie will also accept key identifiers in octal notation. As an example, you could use \024 (do *not* enclose it in quotes) to represent Ctrl-T.

Orpie includes a secondary executable, orpie-curses-keys, that prints out the key identifiers associated with keypresses. You may find it useful when customizing orpierc.

Multiple keys may be bound to the same operation, if desired.

### Removing Key Bindings

Syntax:

unbind_function *key_identifier*

unbind_command *key_identifier*

unbind_edit *key_identifier*

unbind_browse *key_identifier*

unbind_abbrev *key_identifier*

unbind_variable *key_identifier*

unbind_integer *key_identifier*

These commands will remove key bindings associated with the various entry modes (functions, commands, editing operations, etc.). The key identifiers should be defined using the syntax described in the previous section.

### Creating Key Auto-Bindings

Syntax: autobind *key_identifier*

In order to make repetitive calculations more pleasant, Orpie offers an automatic key binding feature. When a function or command is executed using its abbreviation, one of the keys selected by the autobind syntax will be automatically bound to that operation (unless the operation has already been bound to a key). The current set of autobindings can be viewed in the help panel by executing command_cycle_help (bound to 'h' by default).

The syntax for the key identifiers is provided in the previous section.

### Creating Operation Abbreviations

Syntax: abbrev *operation_abbreviation operation*

You can use this syntax to set the abbreviations used within Orpie to represent the various functions and commands. A list of available operations may be found in the Calculator Operations section. The operation abbreviations should be quoted strings, for example "sin" or "log".

Orpie performs autocompletion on these abbreviations, allowing you to type usually just a few letters in order to select the desired command. The order of the autocompletion matches will be the same as the order in which the abbreviations are registered by the rcfile--so you may wish to place the more commonly used operation abbreviations earlier in the list.

Multiple abbreviations may be bound to the same operation, if desired.

### Removing Operation Abbreviations

Syntax: unabbrev *operation_abbreviation*

This syntax can be used to remove an operation abbreviation. The operation abbreviations should be quoted strings, as described in the previous section.

### Creating Macros

Syntax: macro *key_identifier macro_string*

You can use this syntax to cause a single keypress (the *key_identifier*) to be interpreted as the series of keypresses listed in *macro_string*. The syntax for defining a keypress is the same as that defined in the section on Creating Key Bindings. The macro string should be a list of whitespace-separated keypresses, e.g. "2 <return> 2 +" (including quotes).

This macro syntax provides a way to create small programs; by way of example, the default orpierc file includes macros for the base 2 logarithm and the binary entropy function (bound to L and H, respectively), as well as “register” variable shortcuts (<f1> to <f12>).

Macros may call other macros recursively. However, take care that a macro does not call *itself* recursively; Orpie will not trap the infinite loop.

Note that operation abbreviations may be accessed within macros. For example, macro "A" "' a b o u t <return>" would bind A to display the “about Orpie” screen.

### Creating Units

Syntax:

base_unit *unit_symbol preferred_prefix*

unit *unit_symbol unit_definition*

Units are defined in a two-step process:

- 1.
Define a set of orthogonal “base units.” All other units must be expressible in terms of these base units. The base units can be given a preferred SI prefix, which will be used whenever the units are standardized (e.g. via ustand). The unit symbols and preferred prefixes should all be quoted strings; to prefer

*no*prefix, use the empty string ("").

It is expected that most users will use the fundamental SI units for base units.

- 2.
Define all other units in terms of either base units or previously-defined units. Again, the unit symbol and unit definition should be quoted strings. The definition should take the form of a numeric value followed by a units string, e.g. "2.5_kN*m/s". See the UNITS FORMATTING section for more details on the unit string format.

### Creating Constants

Syntax: constant *constant_symbol constant_definition*

This syntax can be used to define a physical constant. Both the constant symbol and definition must be quoted strings. The constant definition should be a numeric constant followed by a units string e.g. "1.60217733e-19_C". All units used in the constant definition must already have been defined.

## Configuration Variables

The following configuration variables may be set as described in the SETTING CONFIGURATION VARIABLES section.

- datadir

This variable should be set to the full path of the Orpie data directory, which will contain the calculator state save file, temporary buffers, etc. The default directory is "\~/.orpie/". - editor

This variable may be set to the fullscreen editor of your choice. The default value is "vi". It is recommended that you choose an editor that offers horizontal scrolling in place of word wrapping, so that the columns of large matrices can be properly aligned. (The Vim editor could be used in this fashion by setting editor to "vim -c 'set nowrap'".) - hide_help

Set this variable to "true" to hide the left help/status panel, or leave it on the default of "false" to display the help panel. - conserve_memory

Set this variable to "true" to minimize memory usage, or leave it on the default of "false" to improve rendering performance. (By default, Orpie caches multiple string representations of all stack elements. Very large integers in particular require significant computation for string representation, so caching these strings can make display updates much faster.)

## Calculator Operations

Every calculator operation can be made available to the interface using the syntax described in the sections on Creating Key Bindings and Creating Operation Abbreviations. The following is a list of every available operation.

### Functions

The following operations are functions--that is, they will consume at least one argument from the stack. Orpie will generally abort the computation and provide an informative error message if a function cannot be successfully applied (for example, if you try to compute the transpose of something that is not a matrix).

For the exact integer data type, basic arithmetic operations will yield an exact integer result. Division of two exact integers will yield the quotient of the division. The more complicated functions will generally promote the integer to a real number, and as such the arithmetic will no longer be exact.

- function_10_x

Raise 10 to the power of the last stack element (inverse of function_log10). - function_abs

Compute the absolute value of the last stack element. - function_acos

Compute the inverse cosine of the last stack element. For real numbers, The result will be provided either in degrees or radians, depending on the angle mode of the calculator. - function_acosh

Compute the inverse hyperbolic cosine of the last stack element. - function_add

Add last two stack elements. - function_arg

Compute the argument (phase angle of complex number) of the last stack element. The value will be provided in either degrees or radians, depending on the current angle mode of the calculator. - function_asin

Compute the inverse sine of the last stack element. For real numbers, The result will be provided either in degrees or radians, depending on the angle mode of the calculator. - function_asinh

Compute the inverse hyperbolic sine of the last stack element. - function_atan

Compute the inverse tangent of the last stack element. For real numbers, The result will be provided either in degrees or radians, depending on the angle mode of the calculator. - function_atanh

Compute the inverse hyperbolic tangent of the last stack element. - function_binomial_coeff

Compute the binomial coefficient (“n choose k”) formed by the last two stack elements. If these arguments are real, the coefficient is computed using a fast approximation to the log of the gamma function, and therefore the result is subject to rounding errors. For exact integer arguments, the coefficient is computed using exact arithmetic; this has the potential to be a slow operation. - function_ceiling

Compute the ceiling of the last stack element. - function_convert_units

Convert stack element 2 to an equivalent expression in the units of element 1. Element 1 should be real-valued, and its magnitude will be ignored when computing the conversion. - function_cos

Compute the cosine of the last stack element. If the argument is real, it will be assumed to be either degrees or radians, depending on the angle mode of the calculator. - function_cosh

Compute the hyperbolic cosine of the last stack element. - function_conj

Compute the complex conjugate of the last stack element. - function_div

Divide element 2 by element 1. - function_erf

Compute the error function of the last stack element. - function_erfc

Compute the complementary error function of the last stack element. - function_eval

Obtain the contents of the variable in the last stack position. - function_exp

Evaluate the exponential function of the last stack element. - function_factorial

Compute the factorial of the last stack element. For a real argument, this is computed using a fast approximation to the gamma function, and therefore the result may be subject to rounding errors (or overflow). For an exact integer argument, the factorial is computed using exact arithmetic; this has the potential to be a slow operation. - function_floor

Compute the floor of the last stack element. - function_gamma

Compute the Euler gamma function of the last stack element. - function_gcd

Compute the greatest common divisor of the last two stack elements. This operation may be applied only to integer type data. - function_im

Compute the imaginary part of the last stack element. - function_inv

Compute the multiplicative inverse of the last stack element. - function_lcm

Compute the least common multiple of the last two stack elements. This operation may be applied only to integer type data. - function_ln

Compute the natural logarithm of the last stack element. - function_lngamma

Compute the natural logarithm of the Euler gamma function of the last stack element. - function_log10

Compute the base-10 logarithm of the last stack element. - function_maximum

Find the maximum values of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. - function_minimum

Find the minimum values of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. - function_mean

Compute the sample means of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. - function_mod

Compute element 2 mod element 1. This operation can be applied only to integer type data. - function_mult

Multiply last two stack elements. - function_neg

Negate last stack element. - function_permutation

Compute the permutation coefficient determined by the last two stack elements 'n' and 'k': the number of ways of obtaining an ordered subset of k elements from a set of n elements. If these arguments are real, the coefficient is computed using a fast approximation to the log of the gamma function, and therefore the result is subject to rounding errors. For exact integer arguments, the coefficient is computed using exact arithmetic; this has the potential to be a slow operation. - function_pow

Raise element 2 to the power of element 1. - function_purge

Delete the variable in the last stack position. - function_re

Compute the real part of the last stack element. - function_sin

Compute the sine of the last stack element. If the argument is real, it will be assumed to be either degrees or radians, depending on the angle mode of the calculator. - function_sinh

Compute the hyperbolic sine of the last stack element. - function_solve_linear

Solve a linear system of the form Ax = b, where A and b are the last two elements on the stack. A must be a square matrix and b must be a matrix with one column. This function does not compute inv(A), but obtains the solution by a more efficient LU decomposition method. This function is recommended over explicitly computing the inverse, especially when solving linear systems with relatively large dimension or with poorly conditioned matrices. - function_sq

Square the last stack element. - function_sqrt

Compute the square root of the last stack element. - function_standardize_units

Convert the last stack element to an equivalent expression using the SI standard base units (kg, m, s, etc.). - function_stdev_unbiased

Compute the unbiased sample standard deviation of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48's sdev function.) - function_stdev_biased

Compute the biased (population) sample standard deviation of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48's psdev function.) - function_store

Store element 2 in (variable) element 1. - function_sub

Subtract element 1 from element 2. - function_sumsq

Sum the squares of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. - function_tan

Compute the tangent of the last stack element. If the argument is real, it will be assumed to be either degrees or radians, depending on the angle mode of the calculator. - function_tanh

Compute the hyperbolic tangent of the last stack element. - function_to_int

Convert a real number to an integer type. - function_to_real

Convert an integer type to a real number. - function_total

Sum each of the columns of a real NxM matrix, returning a 1xM matrix as a result. - function_trace

Compute the trace of a square matrix. - function_transpose

Compute the matrix transpose of the last stack element. - function_unit_value

Drop the units of the last stack element. - function_utpn

Compute the upper tail probability of a normal distribution.

UTPN(m, v, x) = Integrate[ 1/Sqrt[2 Pi v] Exp[-(m-y)^2/(2 v)], {y, x, Infinity}] - function_var_unbiased

Compute the unbiased sample variance of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48's var function.) - function_var_biased

Compute the biased (population) sample variance of each of the columns of a real NxM matrix, returning a 1xM matrix as a result. (Compare to HP48's pvar function.)

### Commands

The following operations are referred to as commands; they differ from functions because they do not take an argument. Many calculator interface settings are implemented as commands.

- command_about

Display a nifty “about Orpie” credits screen. - command_begin_abbrev

Begin entry of an operation abbreviation. - command_begin_browsing

Enter stack browsing mode. - command_begin_constant

Begin entry of a physical constant. - command_begin_variable

Begin entry of a variable name. - command_bin

Set the base of exact integer representation to 2 (binary). - command_clear

Clear all elements from the stack. - command_cycle_base

Cycle the base of exact integer representation between 2, 8, 10, and 16 (bin, oct, dec, and hex). - command_cycle_help

Cycle through multiple help pages. The first page displays commonly used bindings, and the second page displays the current autobindings. - command_dec

Set the base of exact integer representation to 10 (decimal). - command_deg

Set the angle mode to degrees. - command_drop

Drop the last element off the stack. - command_dup

Duplicate the last stack element. - command_enter_pi

Enter 3.1415... on the stack. - command_hex

Set the base of exact integer representation to 16 (hexadecimal). - command_oct

Set the base of exact integer representation to 8 (octal). - command_polar

Set the complex display mode to polar. - command_rad

Set the angle mode to radians. - command_rand

Generate a random real-valued number between 0 (inclusive) and 1 (exclusive). The deviates are uniformly distributed. - command_rect

Set the complex display mode to rectangular (cartesian). - command_refresh

Refresh the display. - command_swap

Swap stack elements 1 and 2. - command_quit

Quit Orpie. - command_toggle_angle_mode

Toggle the angle mode between degrees and radians. - command_toggle_complex_mode

Toggle the complex display mode between rectangular and polar. - command_undo

Undo the last calculator operation. - command_view

View the last stack element in an external fullscreen editor. - command_edit_input

Create a new stack element using an external editor.

### Edit Operations

The following operations are related to editing during data entry. These commands cannot be made available as operation abbreviations, since abbreviations are not accessible while entering data. These operations should be made available as single keypresses using the bind keyword.

- edit_angle

Begin entering the phase angle of a complex number. (Orpie will assume the angle is in either degrees or radians, depending on the current angle mode.) - edit_backspace

Delete the last character entered. - edit_begin_integer

Begin entering an exact integer. - edit_begin_units

Begin appending units to a numeric expression. - edit_complex

Begin entering a complex number. - edit_enter

Enter the data that is currently being edited. - edit_matrix

Begin entering a matrix, or begin entering the next row of a matrix. - edit_minus

Enter a minus sign in input. - edit_scientific_notation_base

Begin entering the scientific notation exponent of a real number, or the base of an exact integer. - edit_separator

Begin editing the next element of a complex number or matrix. (This will insert a comma between elements.)

### Browsing Operations

The following list of operations is available only in stack browsing mode. As abbreviations are unavailable while browsing the stack, these operations should be bound to single keypresses using the bind keyword.

- browse_echo

Echo the currently selected element to stack level 1. - browse_end

Exit stack browsing mode. - browse_drop

Drop the currently selected stack element. - browse_dropn

Drop all stack elements below the current selection (inclusive). - browse_keep

Drop all stack elements*except*the current selection. (This is complementary to browse_drop. - browse_keepn

Drop all stack elements above the current selection (non-inclusive). (This is complementary to browse_dropn. - browse_next_line

Move the selection cursor down one line. - browse_prev_line

Move the selection cursor up one line. - browse_rolldown

Cyclically “roll” stack elements downward, below the selected element (inclusive). - browse_rollup

Cyclically “roll” stack elements upward, below the selected element (inclusive) . - browse_scroll_left

Scroll the selected element to the left (for viewing very large entries such as matrices). - browse_scroll_right

Scroll the selected element to the right. - browse_view

View the currently selected stack element in a fullscreen editor. - browse_edit

Edit the currently selected stack element using an external editor.

### Abbreviation Entry Operations

The following list of operations is available only while entering a function or command abbreviation, or while entering a physical constant. These operations must be bound to single keypresses using the bind keyword.

- abbrev_backspace

Delete a character from the abbreviation string. - abbrev_enter

Execute the operation associated with the selected abbreviation. - abbrev_exit

Cancel abbreviation entry.

### Variable Entry Operations

The following list of operations is available only while entering a variable name. As abbreviations are unavailable while entering variables, these operations should be bound to single keypresses using the bind keyword.

- variable_backspace

Delete a character from the variable name. - variable_cancel

Cancel entry of the variable name. - variable_complete

Autocomplete the variable name. - variable_enter

Enter the variable name on the stack.

### Integer Entry Operations

The following operation is available only while entering an integer; it can be made accessible by binding it to a single keypress using the bind keyword.

- integer_cancel

Cancel entry of an integer.

## See Also

## Author

This manpage is written by Paul J. Pelzl <pelzlpj@gmail.com>.

## Referenced By

orpie(1), orpie-curses-keys(1).