Introduction
RPN, "reverse polish notation", Wikipedia entry
To calculateYou enter
1 + 21 2 +
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 101 2 3 4 5 6 7 8 9 10 +++++++++ *
sin(sqrt(4*7))4 7 * sqrt sin
(sqrt(123.45) * (17 - 2.45)) / (sq(8 + (17 % 3)))123.45 sqrt 17 2.45 - * 8 17 3 mod + sq /
* Of course, you would actually use
10 11 * 2 /
or
10 dup 1 + * 2 /
or perhaps
0 1 10 for i i + next
or you possibly do not need a calculator to multiply 5 by 11, but, then, where's the fun in that?
Settings
Settings
deg
Sets the angle input mode to degrees
rad
Sets the angle input mode to radians
grad
Sets the angle input mode to gradians
precision
Sets the numerical precision, used on the stack-view and for some functions like Q or round. Returns the previous value
Stack
Available stack operators
How they work
clear
Clears out all stack and other content
StackOperationResult
objn
...
obj1
CLEAR

depth
Returns the number of elements on the stack before DEPTH was called
StackOperationResult
objn
...
obj1
DEPTHobjn
...
obj1
n

drop, drop2, drop3
Discards level 1, level 1 and 2 or levels 1 to 3
StackOperationResult
objn
...
obj4
obj3
obj2
obj1
DROPobjn
...
obj4
obj3
obj2
objn
...
obj4
obj3
obj2
obj1
DROP2objn
...
obj4
obj3
objn
...
obj4
obj3
obj2
obj1
DROP3objn
...
obj4

dropn
Discards N elements
StackOperationResult
objn
...
obj1
n DROPN
obj2
obj1
2 DROPN
obj1 DROPN
0 DROPN

dup, dup2, dup3
Copies level 1, level 1 and 2 or levels 1 to 3
StackOperationResult
obj2
obj1
DUPobj2
obj1
obj1
obj3
obj2
obj1
DUP2obj3
obj2
obj1
obj2
obj1
obj4
obj3
obj2
obj1
DUP3obj4
obj3
obj2
obj1
obj3
obj2
obj1

dupdup
Copies level 1 twice
StackOperationResult
obj2
obj1
DUPDUPobj2
obj1
obj1
obj1

dupn
Copies N elements
StackOperationResult
objn
...
obj1
n DUPNobjn-1
...
obj1
objn
...
obj1
obj2
obj1
2 DUPNobj2
obj1
obj2
obj1
obj1 DUPNobj
obj
0 DUPN

ndupn
Copies level 1 N times and returns the count
StackOperationResult
objn NDUPNobj
...
obj
n
obj2 NDUPNobj
obj
2
obj1 NDUPNobj
1
obj0 NDUPN0

nip
Discards level 2
StackOperationResult
objn
...
obj3
obj2
obj1
NIPobjn
...
obj3
obj1

over
Copies level 2
StackOperationResult
obj2
obj1
OVERobj2
obj1
obj2

pick
Copies element n
StackOperationResult
objn
...
obj1
n PICKobjn
...
obj1
objn
obj2
obj1
2 PICKobj2
obj1
obj2
obj1 PICKobj
obj
0 PICK

pick2, pick3

Shorthand versions of "2 pick" and "3 pick" respectively


roll
Rolls up N elements
StackOperationResult
objn
objn-1
...
obj1
n ROLLobjn-1
...
obj1
objn
obj2
obj1
2 ROLLobj1
obj2
obj1 ROLLobj
0 ROLL

rolld
Rolls down N elements
StackOperationResult
objn
...
obj2
obj1
n ROLLDobj1
objn
...
obj2
obj2
obj1
2 ROLLDobj1
obj2
obj1 ROLLDobj
0 ROLLD

rot
Rolls up 3 elements
StackOperationResult
obj3
obj2
obj1
ROTobj2
obj1
obj3

swap
Exchanges levels 1 and 2
StackOperationResult
obj2
obj1
SWAPobj1
obj2

unpick
Replaces element n
StackOperationResult
objn
objn-1
...
obj1
obj
n UNPICKobj
objn-1
...
obj1
obj2
obj1
obj
2 UNPICKobj
obj1
obj1
obj
1 UNPICKobj
obj0 UNPICK

unrot
Rolls down 3 elements
StackOperationResult
obj3
obj2
obj1
UNROTobj1
obj3
obj2
Mathematical functions
Arithmetic
+
Addition
-
Subtraction
*
Multiplication
/
Division
mod
Modulo
Constants
E
Euler's constant, 2.7182...
PI
π, 3.1415...
LN2
Natural logarithm of 2
LN10
Natural logarithm of 10
LOG2E
Base 2 logarithm of E
LOG10E
Base 10 logarithm of E
SQRT2
Square root of 2
SQRT1_2
Square root of 0.5
General math functions
abs
Absolute value
cb
Cube
cbrt
Cube root
ceil
Ceil function (round up)
comb
Calculates the number of combinations
exp
Exponential function, base E
fact
Factorial
floor
Floor function (round down)
fp
Fractional part
gamma
Gamma function (factorial function for any argument)
lambertw
Lambert W function (primary branch)
ip
Integer part
ln
Natural logarithm, base e
log
Logarithm, base 10
neg
Negates its argument
perm
Calculates the number of permutations
pow
Power function, yx
Q
Guesstimates the nearest (according to the current precision) fraction or quotient
round
Rounds to precision digits
sq
Calculates the square
sqrt
Square root
Trigonometry
sin
Sine
asin
arcsine
sinh
Hyperbolic sine
asinh
Inverse hyperbolic sine
cos
Cosine
acos
arccosine
cosh
Hyperbolic cosine
acosh
Inverse hyperbolic cosine
tan
Tangent
atan
Inverse tangent
tanh
Hyperbolic tangent
atanh
Inverse hyperbolic tangent
sec
Secant
asec
arcsecant
sech
Hyperbolic secant
asech
Inverse hyperbolic secant
csc
Cosecant
acsc
arccosecant
csch
Hyperbolic cosecant
acsch
Inverse hyperbolic secant
cot
Cotangent
acot
arccotangent
coth
Hyperbolic cotangent
acoth
Inverse hyperbolic cotangent
Somewhat mathy functions
date
Today's date, YYYY-MM-DD
div
Determines all positive divisors. This function may take a while on large numbers
factor
Integer prime factorization. This function may take a while on large numbers
gcd
Greatest common divisor
lcm
Lowest common multiple
max
Maximum
min
Minimum
rand
Returns a random number, 0 <= rand < 1
sign
Returns the sign as -1, 0 or 1
time
Current time, HH:MM
timer
Number of milliseconds elapsed since January 1, 1970 00:00:00 UTC
Programming
Conditionals
These replace levels 1 and 2 with 1 if they test true, i.e. non-zero, or 0 otherwise
StackOperationResult
2
5
<
less than
1
2
5
<=
less than or equal
1
2
5
==
equal
0
2
5
!=
not equal
1
2
5
>=
greater or equal
0
2
5
>
greater
0
Conditional loops
while
WHILE condition REPEAT statements END
6 8 while dup repeat swap over mod end
do
DO statements UNTIL condition END
rand do rand + until rand rand > end
Testing conditions
if
IF condition THEN statements END
IF condition THEN statements ELSE statements END
if dup 2 mod then 3 * 1 + else 2 / end
Counted loops
start
counterStart counterEnd START statements NEXT
counterStart counterEnd START statements increment STEP
1 5 start "Hello, world!" next
for
counterStart counterEnd FOR identifier statements NEXT
counterStart counterEnd FOR identifier statements increment STEP
1 10 for index index index * 2 step
When IF is just not enough
case
CASE
condition THEN statements END
condition THEN statements END
...
condition THEN statements END
Default statements
END
Notes
Performance
timer 0 while dup 1000000 < repeat 1 + end timer rot - nip
This will tell you how long it takes to count to 1 million, in milliseconds
  • Endless loops are a thing. A thing you do not want!
  • condition assumes the current value at level 1 is a number that can be compared to 0, with 0 being false and not-zero being true
Memory
Memory
Identifiers must match /^[a-z][a-z\d_]*/i, as in, a letter, optionally followed by letters, numbers or underscore
a, a1, abc, a_b_c, and friends
sto
Stores level 2 as identifier
StackOperationResult
obj
identifier
STO
identifierRCLobj
rcl
Recalls the content stored in identifier
StackOperationResult
obj
identifier
STO
identifierRCLobj
purge

Permanentely removes identifier

eval

Evaluates the commands or expression on level 1

Memory usage example
StackOperationResult
'2 3 * 1 +'
seven
STO
sevenRCL'2 3 * 1 +'
'2 3 * 1 +'EVAL7
sevenEVAL7
sevenPURGE
rclall

Recalls... things and stuffs and more

Graphing
Graphing functions
plot
Produces a graphical representation of the algebraic function string in level 1
e.g.
'sin(sqrt(xx-yy))' plot
, or
'sqrt(abs(xy))' plot
  • A function in x is evaluated within min.x and max.x, and rendered within the min.y and max.y window
  • A function in y is evaluated within min.y and max.y, and rendered within the min.x and max.x window
  • A function in x and y is evaluated within min.x and max.x and min.y and max.y and rendered with the function value f(x, y) = z as height
  • All trigonometric functions operate in radians
gxmin

Sets the minimum x value and returns the previous value

gxmax

Sets the maximum x value and returns the previous value

gymin

Sets the minimum y value and returns the previous value

gymax

Sets the maximum y value and returns the previous value

greset

Resets most graphing values to their defaults. When stuff starts to look weirder than usual

n.b.
The graphic reacts to mouse-wheel and -drag operations
Examples and other random oddities
Stuffs
2 precision rad 0.5 asin PI / Q rot precision drop

Given:
	3x2 + 2x - 1 = 0

Enter:
	3 2 -1

followed by:
	swap rot dup + swap neg dup dup * 3 pick 5 roll dup +  * - sqrt over over - unrot + unrot over / unrot /
			

'sin(y)*cos(x)' plot

'sqrt(abs(xy))' plot

'sin(0.2*x*y)' plot

On a function like '(x+2)(x+4)(x+6)(x-1)(x-3)(x-5)', you may have to adjust the min or max parameters before seeing things (more clearly)