- Installation
- Introduction
- Basic Concepts
- Modes of Operation
- Input Format
- Operators and Functions
- Special Features
- Commands
- Examples
- Error Handling
- Advanced Topics
$ sudo make install
RPX (RPN eXtended) is a powerful calculator that uses Reverse Polish Notation (RPN). It supports real, complex, and matrix calculations, offering a wide range of mathematical operations and functions.
- Uses Reverse Polish Notation (RPN)
- No parallel processing
- No GUI
- Low keystrokes
RPX offers four modes of operation:
- Real Number Mode (default)
- Supports floating-point operations and transcendental functions
- Complex Number Mode
- Toggle with
:tc
command - Supports complex number operations
- Supports matrix operations
- Toggle with
- Use spaces to separate numbers and operators
- Negative numbers: Use 'm' operator (e.g.,
5 m
for -5) - Decimal numbers are supported
- Complex numbers: Use 'i' operator (e.g.,
3m 4 i +
for -3+4i) - Polar coordinates: Use 'p' operator (e.g.,
1(\P2/)p
for 1i) - Matrices: Use
[columns elements,]
format (e.g.,[2 1,2,3,4,]
for a 2x2 matrix) - Spaces are required only to delimit numbers (e.g.,
5 3m4i+
for 5-3+4i)
+
(addition),-
(subtraction),*
(multiplication),/
(division)%
(modulo),^
(exponentiation)=
,<
,>
, (comparison)
A
(absolute value)m
(negate)i
(multiply by i, for complex mode)
s
(sin),c
(cos),t
(tan)as
(asin),ac
(acos),at
(atan)
hs
(sinh),hc
(cosh),ht
(tanh)
l2
(log2),lc
(log10),le
(ln)L
(custom base log)
C
(ceil),F
(floor),R
(round)
r
(degree to radian),d
(radian to degree)
~
(Inverse Matrix)
?
(Ternary operator) usage:<false case> <true case> <cond> ?
\E
: Euler's number\P
: Pi
$[a-z]
followed by a letter (a-z) for variable reference&[a-z]
to update variables (e.g.,3 5 + &x
for x=3+5)
!
evaluate lambda expression at the top of the stack usage:... <$3> <$2> <$1> <lambda> !
- First element is the number of columns
- Elements separated by commas
- End matrix with
,]
- Example:
[2 1,2,3,4,]
creates a 2x2 matrix [1 2; 3 4] - Ignore the overhang
- Example:
[2 5,3m,6i,1s,99]
creates a 2x2 matrix [5 -3; 6i sin(1)]
@a
: Reference to previous result (ANS)@d
: Display top value of stack@h
: Access to result history (e.g.,5 @h
for 5 previous history)@n
: Push nan@p
: Duplicate the top stack value@r
: Random number between 0 and 1@s
: Access specific stack value (e.g.,5 @h
for 5 previous stack value)
( )
: Specify the valid range of the operator;
: Start of a comment (ignored until end of line)
:tc
: Toggle between real and complex number mode:tp
: Toggle between explicit and implicit function in plot:o
: Optimize expression (e.g., remove unnecessary spaces):p
: Plot graph (argument is $1, multidimensional is not supported)
-h
: Show help-r
: Evaluate following argument as expression-q
: Quit Arguments whose first letter is not '-' are interpreted as file name.
- Basic arithmetic:
3 4 + 2 *
-> 14.000000 - Using constants:
\P 2 / s
-> 1.000000 (sin(Pi/2)) - Complex expression:
2 3 ^ (4 5 *) + (6 7 /) -
-> 27.142857 - Using previous result:
5 @a +
-> Adds 5 to previous result - Complex mode:
3 4i +
-> 3.000000 + 4.000000i - Matrix addition:
[2 1,2,3,4,][2,4,5,6,7,]+
-> [2 5,7,9,11,] - Matrix inverse:
[3 1,1,1m,2m,0,1,0,2,1,]~
-> [3 -0.5,-0.75,0.25,0.5,0.25,0.25,-1,-0.5,0.5,] - Plot fn:
:p $1s
-> Graph of sin(x) - Plot implicit fn:
:p $12^($22^)+1-
-> Circle of radius 1 - Define fn:
{$1 2 ^} &f
-> f(x) = x^2 - Define multi-arg fn:
{$1 $2 +} &g
-> g(x, y) = x + y - Call fn:
5 $f !
-> f(5) - Call multi-arg fn:
6 7 $g !
-> g(7, 6) - Lambda fn:
4 {$1 2 *} !
-> 8 - Lambda multi-arg fn:
5 6 {$1 $2 -} !
-> 1 - Conditional Branch:
3 4 (5 6 <) ?
-> 4 - Recursive fn:
5 {{$1 1 - $f! $1 *} {1} ($1 1 =) ?} &f!
-> 120 - Display help and exit:
rpx -h -q
- One-shot calculator:
rpx -r "1 1 +" -q
- One-shot graph plottor:
rpx -r ":spr\\P,\\Pm,1,1m" -r ":p $1s" -q
- Run script files:
rpx sample1.rpx sample2.rpx sample3.rpx
- Unknown operators or functions result in an error message
- Division by zero and other mathematical errors are not explicitly handled
- NaN results are not displayed