To calculate | You enter |
---|---|
1 + 2 | 1 2 + |
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 | 1 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 + nextor you possibly do not need a calculator to multiply 5 by 11, but, then, where's the fun in that?
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
Available stack operators
- clear
- depth
- drop
- drop2
- drop3
- dropn
- dup
- dup2
- dup3
- dupdup
- dupn
- ndupn
- nip
- over
- pick
- pick2
- pick3
- roll
- rolld
- rot
- swap
- unpick
- unrot
How they work
Stack | Operation | Result |
---|---|---|
objn ... obj1 | CLEAR |
Stack | Operation | Result |
---|---|---|
objn ... obj1 | DEPTH | objn ... obj1 n |
Stack | Operation | Result |
---|---|---|
objn ... obj4 obj3 obj2 obj1 | DROP | objn ... obj4 obj3 obj2 |
objn ... obj4 obj3 obj2 obj1 | DROP2 | objn ... obj4 obj3 |
objn ... obj4 obj3 obj2 obj1 | DROP3 | objn ... obj4 |
Stack | Operation | Result |
---|---|---|
objn ... obj1 | n DROPN | |
obj2 obj1 | 2 DROPN | |
obj | 1 DROPN | |
0 DROPN |
Stack | Operation | Result |
---|---|---|
obj2 obj1 | DUP | obj2 obj1 obj1 |
obj3 obj2 obj1 | DUP2 | obj3 obj2 obj1 obj2 obj1 |
obj4 obj3 obj2 obj1 | DUP3 | obj4 obj3 obj2 obj1 obj3 obj2 obj1 |
Stack | Operation | Result |
---|---|---|
obj2 obj1 | DUPDUP | obj2 obj1 obj1 obj1 |
Stack | Operation | Result |
---|---|---|
objn ... obj1 | n DUPN | objn-1 ... obj1 objn ... obj1 |
obj2 obj1 | 2 DUPN | obj2 obj1 obj2 obj1 |
obj | 1 DUPN | obj obj |
0 DUPN |
Stack | Operation | Result |
---|---|---|
obj | n NDUPN | obj ... obj n |
obj | 2 NDUPN | obj obj 2 |
obj | 1 NDUPN | obj 1 |
obj | 0 NDUPN | 0 |
Stack | Operation | Result |
---|---|---|
objn ... obj3 obj2 obj1 | NIP | objn ... obj3 obj1 |
Stack | Operation | Result |
---|---|---|
obj2 obj1 | OVER | obj2 obj1 obj2 |
Stack | Operation | Result |
---|---|---|
objn ... obj1 | n PICK | objn ... obj1 objn |
obj2 obj1 | 2 PICK | obj2 obj1 obj2 |
obj | 1 PICK | obj obj |
0 PICK |
Shorthand versions of "2 pick" and "3 pick" respectively
Stack | Operation | Result |
---|---|---|
objn objn-1 ... obj1 | n ROLL | objn-1 ... obj1 objn |
obj2 obj1 | 2 ROLL | obj1 obj2 |
obj | 1 ROLL | obj |
0 ROLL |
Stack | Operation | Result |
---|---|---|
objn ... obj2 obj1 | n ROLLD | obj1 objn ... obj2 |
obj2 obj1 | 2 ROLLD | obj1 obj2 |
obj | 1 ROLLD | obj |
0 ROLLD |
Stack | Operation | Result |
---|---|---|
obj3 obj2 obj1 | ROT | obj2 obj1 obj3 |
Stack | Operation | Result |
---|---|---|
obj2 obj1 | SWAP | obj1 obj2 |
Stack | Operation | Result |
---|---|---|
objn objn-1 ... obj1 obj | n UNPICK | obj objn-1 ... obj1 |
obj2 obj1 obj | 2 UNPICK | obj obj1 |
obj1 obj | 1 UNPICK | obj |
obj | 0 UNPICK |
Stack | Operation | Result |
---|---|---|
obj3 obj2 obj1 | UNROT | obj1 obj3 obj2 |
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
Conditionals
Stack | Operation | Result |
---|---|---|
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 condition REPEAT statements END
6 8 while dup repeat swap over mod end
DO statements UNTIL condition END
rand do rand + until rand rand > end
Testing conditions
IF condition THEN statements END
IF condition THEN statements ELSE statements END
if dup 2 mod then 3 * 1 + else 2 / end
Counted loops
counterStart counterEnd START statements NEXT
counterStart counterEnd START statements increment STEP
1 5 start "Hello, world!" next
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 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
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
Stack | Operation | Result |
---|---|---|
obj identifier | STO | |
identifier | RCL | obj |
Stack | Operation | Result |
---|---|---|
obj identifier | STO | |
identifier | RCL | obj |
Permanentely removes identifier
Evaluates the commands or expression on level 1
Stack | Operation | Result |
---|---|---|
'2 3 * 1 +' seven | STO | |
seven | RCL | '2 3 * 1 +' |
'2 3 * 1 +' | EVAL | 7 |
seven | EVAL | 7 |
seven | PURGE |
Recalls... things and stuffs and more
Graphing functions
Produces a graphical representation of the algebraic function string in level 1
e.g. gxmin
gxmax
gymin
gymax
greset
'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
Sets the minimum x value and returns the previous value
Sets the maximum x value and returns the previous value
Sets the minimum y value and returns the previous value
Sets the maximum y value and returns the previous value
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
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)