RPN calculators for Linux
RPN stands for Reverse Polish Notation. Reverse Polish Notation was developed in 1920 by Jan Lukasiewicz as a way to write a mathematical expression without using parentheses and brackets.
It takes a few minutes to learn RPN but you will soon see that
this entry method is superior to the algbraic format.
_________________ _________________ _________________
RPN pocket calculators became popolar with the HP calculators. HP
used this entry method already for it's first calculator in 1968.
If you search the internet you will find that there is a whole fan club
behind those HP calculators. I have made a number of very good links available at the end of this article.
Most of those HP calculators are today collectors items and sell now for
much more than their original price.
In this article will present some of the RPN desktop calculators available for
Linux. We will not only look at the HP emulators which are available but
also other RPN calculators which are totally independent of HP.
What is RPN? Why RPN?
RPN calculators use a stack and all mathematical operations are executed
immediately on the lower level of the stack. The stack is used as a memory to
save results which you need to further evaluate your formula.
Therefore you do not need any brackets on an RPN calculator.
You first enter the numbers, push them up the stack, and then you say
what you want to do with those numbers.
Let's say you want
(( 3 + 1 )^2 + 1) * 4
To do this you would type the following:
1 + (immediately you see the result of this operation: 4)
x^2 (immediately you see the result of this operation: 16)
1+ (immediately you see the result of this operation: 17)
4* (final result: 68)
So to enter this formula you needed 9 key strokes and you could
see all the intermediate results. It is basically how you would
evaluate a formula when you evaluate it without calculator in your
brain. In other words the calculator is much more "natural". It
works the same way that your "brain works".
If you compare this to an algebraic calculator where you punch in
the formula as written you would need 12 key strokes and you would
not see all the intermediate results.
The advantages are in other words:
- RPN saves time and keystrokes. You never have to account for the parentheses while doing calculations. The process is similar to the way you learned math on paper.
- You can see the intermediary results as you perform your computations rather than just the answer at the end. This is an extremely helpful byproduct.
- An intermediate result allows the user to check the results and correct errors more easily. It's easier to follow the stream of calculation. The user defines the priority of operators.
- RPN is logical because the user first gives the number and then tells what to do with it.
- Because subexpressions are evaluated as they are entered, entry errors are more obvious with RPN. On an algebraic calculator, omitting an opening parenthesis, may not lead to a calculation error until much later when an entire subexpression is evaluated.
Let's start with some simple calculators which you can just test in
your webbrowser while you are reading this article and then further down
I will present more powerful "machines".
because you can use also the keyboard to type in numbers and basic mathematical operators. Just click here
to play with rpnjcalc
looking like a real (old) HP-35 pocket calculator. You can test it online
by following this link
If you really want to use it then I recommend to download the
zip file below because it uses gif images and the response is much faster
when you install it locally.
Note also that this calculator does not offer the same functionallity as
a real HP35. It can e.g do trigonnometry only in degrees (0-360).
|Unknown, taken from www.hpmuseum.org. Download here:hp-35.zip
This calculator is an standard Unix command. You find it on even the oldest unix
systems. It can do only basic arithmetic but it can handle very very long numbers.
To start it just type dc and then a number followed by "k" (e.g: 6k and press return). This sets the
precision. Now you can do calculations (+-*/) and you print the lowest level
of the stack with "p". You end it with crtl-d.
|dc (desk calculator)
|Part of every unix system. Under Linux the package name for dc is called bc
|normally the same as your Unix system
This calculator is written in Perl. It is an interessting implementation
because it is actually a vector calculator. You can of course use
it also for normal arithmetic as a single number is just a one dimmensional
vector. It has an integrated help system (just type help).
Installation is easy because it uses only standard perl modules.
This calculator is a HP-48 emulator. That is: you can run the real code
from HP on it. The calculator just implements an emulator. You need to load
the real HP-48 ROM code. x48 has a GPL license but the the ROM is of course
copyright HP. The original hp48 calculator is no longer manufactured by HP and
HP allows now downloads of ROM images since year 2000.
Side note: It is nice to have such a calculator on the computer screen but it is
still no real replacment for a original HP-48 because the x48 has not a very
good keyboard interface. Therefore you find your self using mouse clicks
most of the time and this is rather slow.
Because x48 is an emulator it
can do all the operations exactly as the original HP-48. The latest version
that I could find is 0.4 which is already a few years old. It works
however without any problems. Version 0.4 needs a small
patch to compile on a modern Linux system. You find an original Manual, some
ROM images, the patch and further instructions on the "x48 details page" below.
This calculator has all the functionallity of a real hp67 but it
is completley re-written and independent of the hp67 code. It
is not an emulator. The interface looks a bit basic (ncurses) but
the functionallity is very good. It comes als with excellent documentation in
the form of a man-page (see link below).
You can even program it like a real hp67.
To start programming you press "prog" then you enter your program, starting
with a lable name and you get out of programming mode with "immed".
To execute a program you use "run labelname".
Here is an example. My example is a bit useless as it implements
just the square function but it gives you an idea how to program the
prog (enter programming mode)
immed (end of programming mode)
Now you can use "run myprg" to execute x^2.
kalc runs also from the command line. It uses the readline library and
has some "command completion" features. It works with real and complex numbers, unlimited size integers, arbitrary-precision real numbers.
Very good is also the documentation (see pdf file below).
This is also a ncurses based calculator to run in a terminal window.
It is not programmable like the hp67 but it is good to convert numbers
from hex to bin to decimal.
This is also a rpn calculator to run in a terminal window but it is
not ncurses based. Therefore it is very similar to the "dc" command.
It implements the functionallity of the HP28s.
rpncalc is therefore much more advanced than "dc". It can handle
complex numbers, vector and matrices.
rpncalc is part of Debian.
This is a nice calculator with gtk graphical user interface.
You can configure it to use either RPN or algebraic entry method.
It offers 4 modes: scientific, financial, statistics and
a number conversion mode called programming mode. This mode has
however nothing to do with programming of the calculator (like
the x48 or hp67). It offers everything that you would expect from
a desktop calculator.
To use the units conversion menue you need to install the
units(1) command (from ftp://ftp.gnu.org/gnu/units/, already part of
most Linux distributions).
This is a an RPN calculator also based on a gtk user interface.
It offers basic algebra and trigonnometric functions.
This calculator is in its functionallity very similar to gdcalc. You can configure it
to use RPN or algebraic entry method. It supports number conversion bin/hex/dec and has
all basic scientific functions.
It uses however the very latest gtk libraries (gtk 2.2).
You will therefore have trouble to install it on older Linux systems.
It is however well designed and has a plesant user interface.
This is an old calculator. You can configure it for either RPN or
algebraic mode. It is good for basic algebra and trigonometry.
This is a basic (but free) RPN calculator for the palm pilot.
The palm does not run Linux but I present this one here because
it is available under a GPL license (a rare thing for palm software).
This is not an RPN calculator at all but it is still very very useful.
It is a java based online graphing calculator. To use it you need the java plugin for mozilla or netscape, part of the jre package from blackdown.org.
You can instantly draw graphs in a java capable webbrowser.
As you can see there are RPN calculators for every taste.
There are probably even more RPN calculators but
the above ones are all GPL licensed.
- Download page, the calculator versions as available at time of writing
- HP48 rom images, from hpcalc.org
- http://www.hpmuseum.org/, online museum about all the hp calculators
- area48.com/history.html, history of the famous HP48 calculator
- www.transnull.com/hp48.html, FAQs and ROM images for the HP48
- www.hp-collection.org/hewlettpackard.htm, a private collection of almost all HP calculators, page is in German
- www.limov.com/rcl20/, RCL 20: People, Dreams & HP Calculators. This is a book (no online version) about the famous HP41
- www.finseth.com/~fin/hpdata.html, HP Database, details about all the HP calculators
- www.hp.com/calculators/, the official HP calcualtors site (all othere links above are private initiatives from HP RPN fans). There is not much available from HP these days. A rather sad page.
Talkback form for this article
Every article has its own talkback page. On this page you can submit a comment or look at comments from other readers:
<--, back to the index of this issue
2004-01-06, generated by lfparser version 2.46