John's Online RPN Scientific Calculator, using Complex Math

A powerful, online, RPN Scientific Calculator, written in Javascript. It employs complex math, has hundreds of functions (including complex Gaussian integer factorization, complex roots of unity, combinatorics, the 12-fold way, continued fraction approximations, etc.), and a scrollable display/log window. This is an example of just how powerful the javascript language can be. The true test of a real calculator: Sqrt[-1]. If you get an imaginary answer, then you have a TRUE calculator. If it crashes, then toss it and go get a TRUE calculator... You can also write Advanced DAL (Dynamic/Direct Algebraic Logic) equations directly to the input window as well. There is a memory slot with an unlimited number of entries and the standard Store/Recall/Clear function. Since you can cut/copy/paste and select/drag from the scrollable log window, you can even use the log window as an effective memory. It has buttons for various constants, complete trigonometric functions, integer and modular math functions such as integer factorization and gcd, base conversion from 2 to 36, not just bin, oct, dec, & hex, etc. Input numbers from the mouse-click pad or from the keyboard. Also includes an NxN linear system solver and N-polynomial complex root finder which can have complex coefficients.

SiteMap of SciRealm | About John | Send email to John
John's Science, Math, Philosophy Stuff:
The Science Realm: John's Virtual Sci-Tech Universe
| 4-Vectors | Ambigrams | Antipodes | Covert Ops Fragments | Cyrillic Projector | Forced Induction (Sums Of Powers Of Integers) | Frontiers | IFS Fractals | JavaScript Graphics | JavaScript Graphics Using Table | Kid Science | Kryptos | Prime Sieve | QM from SR | Quantum Phase | Quotes | RuneQuest Cipher Challenge | Secret Codes & Ciphers | Scientific Calculator | Science+Math | Sci-Pan Pantheist Poems | Stereograms | Turkish Grammar

Welcome to Quantum Reality: Virtual worlds of imaginary particles: The dreams stuff is made of: Life, the eternal ghost in the machine... This site is dedicated to the quest for knowledge and wisdom, through science, mathematics, philosophy, invention, and technology. 
May the treasures buried herein spark the fires of imagination like the twinkling jewels of celestial light crowning the midnight sky...
***Learn, Discover, Explore***

Site last modified: 2013-May-22-12pm


Philosophical Dragon Ph.D. Systems

RPN Scientific
re or (re,im)
list {z1;z2;z3}


rad deg
grad cycl
hyp inv



tips Help Tips
**Note**  Javascript has some known mathematical approximation "issues".  I have tried to correct for these as best I know how.  Also, all the Mathematical Special Functions use approximation methods to calculate results - Make to sure to double check answers with another source such as Wolfram Alpha / Mathematica, esp. if you are using this calculator for anything important or for numbers that are near the edge of integer precision.

Logic Calculator:


Complex Linear System Equation Solver: - you can use complex coefficients in form of (re,im)


Polynomial Root Solver: Lin-Bairstow method


Complex Polynomial Root Solver: - you can use complex coefficients in form of (re,im)
uses Modified Durand-Kerner-Weierstrass Method (iterated)
if you are expecting integer results, try hitting the solve button several times to reset the initial guesses


To use Scientific Calculator RPN (Reverse Polish Notation) button operators (Complex operation capable):
For unary operations (1 number req.), type the number into the input box and then click the function.
For binary operations (2 numbers req.) type the 1st number, click the [Enter] button, type the 2nd number, and then click the function.

For short-cut RPN operations (like HP calculator logic), you can use operators directly on the stack as well.
Unary operations replace the last stack value with its new value
Binary operations replace the last two stack values with its new value

Just play with the buttons, the log window will let you see how it works -- its pretty easy once you get the hang of it...

To use built-in javascript DAL (Dynamic/Direct Algebraic Logic) operations (Real operations only):
Write your numeric equation/formula directly into the input box and then press [Enter]
(you don't have to write the JS 'Math.' in front of the functions, but you can only use and receive real numbers):
ex. 2+5/3-abs(-8)*cos(PI) you must input angles in radians when using this mode
Note: you must have the [kbd] checkbox OFF to use DAL

To input numbers, there are several options, all of which are effective:
(1) mouse-click on the virtual number pad above
(2) use copy-paste/select-drag from the log window to the input box
(3) just type in the numbers on your computer keyboard
(4) turn on the [kbd] checkbox to make the actual keyboard activate the (+,-,*,/,=,c) virtual keys in RPN mode

Input types:
real 255 or PI or -234.2235 or etc.
complex pair (0,3) or (2,3) or (-2,3) etc.
complex add 0 +i 3 or 2 +i 3 or -2 +i 3 etc.
imaginary 3i or 2+3i or -2+3i or 2+3I etc.
complex polar 3 /_ 90  or   3 /_ 1.5708 (set the angle mode 1st)
num-to-base   FF_b16 or 1001010_b2
list of complex {2;(3,4.5);4.46;(5,3);3;4;(5.23,-4.84);2}

Javascript numbers:
octal integer ±0### 0345 -> 229 decimal  -0345 -> -229 decimal
hexadecimal integer ±0x### 0x345 -> 837 decimal -0x345 -> -837 decimal

To page through the available functions:
Keep clicking the [Fncs] key

Apparently, javascript only uses about 16 digits of precision, so take results of huge numbers with a grain of salt...

To use Javascript Math functions in input field: === To use Javascript operators in input field (listed in precedence order):
Math.abs(x) Absolute value of x ( , ) Parentheses for grouping
Math.acos(x) Arc cosine of x ~ Bitwise complement
Math.asin(x) Arc sine of x ! Logical complement
Math.atan(x) Arc tangent of x typeof Return data type
Math.atan2(y,x) Argument from +x axis * , / , % Multiply , Divide , Remainder
Math.ceil(x) Ceiling of x + , - Add , Subtract
Math.cos(x) Cosine of x + Concatenate strings
Math.exp(x) Natural exponent of x << Integer shift left
Math.floor(x) Floor of x >> Integer shift right, sign extension
Math.log(x) Natural logarithm of x >>> Integer shift right, zero extension
Math.max(args...) Max of list of values < , <= Less than , Less than or equal
Math.min(args...) Min of list of values > , >= Greater than, Greater than or equal
Math.pow(x,y) x to the y power == Test for equality
Math.random() Random number (0..1) != Test for inequaltiy
Math.round(x) Round of x === Test for identity
Math.sin(x) Sine of x !== Test for identity
Math.sqrt(x) Square root of x & Integer bitwise AND
Math.tan(x) Tangent of x ^ Integer bitwise XOR
| Integer bitwise OR
Math.E Natural exponent E && Logical AND
Math.LN10 Natural logarithm of 10 || Logical OR
Math.LN2 Natural logarithm of 2 ?: Conditional operator "condition"?"if true":"if false"
Math.LOG10E Base-10 log of E
Math.LOG2E Base-2 log of E
Math.PI Circle constant PI
Math.SQRT1_2 Square root of 1/2
Math.SQRT2 Square root of 2
Note: all built-in javascript trig functions use radians in the argument
Note: if anyone notices a bug in the calculator, please report it so that I can fix it

And, just an interesting bit of math trivia:

Addition is repeated incrementing ( c = a+b ); the 2 inverses are subtraction. ( a = c-b ) & ( b = c-a )
Multiplication is repeated addition ( c = a*b ); the 2 inverses are division. ( a = c/b ) & ( b = c/a )
Exponentiation is repeated multiplication ( c = a^b); it has 2 different inverses: the root ( a = Rootb[c] ) and the log ( b = Loga[c])
Isn't this branching pretty cool, considering that mathematics has a tree-like structure? :-)

Contest: Who can tell me what is special about 0.20787957635076193?
Hint: it can be derived using a single simple "unit" number and one single operation from above.
An introduction to complex numbers
Problems about Complex numbers

If you have a comment about this site, or find a bug, or want more features added, or just want to say 'hi', please email John.
The Science Realm: John's Virtual Sci-Tech Universe
John's Science & Math Stuff: | About John | Send email to John
4-Vectors | Ambigrams | Antipodes | Covert Ops Fragments | Cyrillic Projector | Forced Induction (Sums Of Powers Of Integers) | Fractals | Frontiers |
JavaScript Graphics | Kid Science | Kryptos | Prime Sieve | QM from SR | Quantum Phase | Quotes |
RuneQuest Cipher Challenge | Scientific Calculator | Secret Codes & Ciphers | Science+Math | Sci-Pan Pantheist Poems | Stereograms | Turkish Grammar |