» Download and/or Run latest version
» Installation instructions
» Complete User's Guide
» See also
HP-41C related topics :
Programming Environment, HP-IL Manuals and Bar Codes, links ...
» Et une petite initiation à la Notation Polonaise Inverse (ou RPN en anglais), si besoin en est.
In Version 4, I gave in "Progress pressure" and added a mouse keyboard, extending the DOS screen to 50 lines mode. Many thanks to Bill, who did nothing but requesting it ! ;-)
Sure you have a better one, but here it is :
The ZIP file contains the program file, help file and the example files (see below).
You can also directly test or use it pressing the "Run RPN Calc" button, the only limitation being that you'll not have the help file, so an error message will appear when invoking Help function.
And how to run it with a single click ?
Nothing to install, just copy the .EXE and new .HLP files, or unzip package to where you want. The following only reminds (because everyone already knows this, of course !) how to associate an icon to it, and most important, how to configure it for mouse operated.
Here a quick tip, based on Windows 2000 (similar procedure under other Windows versions) :
Installation instructions
- under "General" tab, type a name (f.e. CALC).
- under "Program" tab, you should find back the previously keyed target under "Cmd line", set the same path in "Working" field and and re-type a name (may be different) aside the icon, run in "Normal window" and "Close on exit". The Working path is also where the .HLP, .INI and other saved files will be stored.
- to enable mouse operation, under Properties, Option tab, Edit Option : uncheck Quick Edit Mode.
- change any other parameter to fit your preferences (fonts, icon to identify it (if you need some, look in C:\WINNT\system32\pifmgr.dll),screen , ...) Note that you can configure other options through the menu while running.
+,-,*,/,ENTER
~ : ± : Change sign
% : Percentage (the original number keeps in the stack)
! : n! : Factorial X (must be positive integer)
i : 1/X : Invert
d : Delta % : ((X / Y) - 1) (displayed in %)
2 or ` : X2 : Square [small 2 superscript or grave accent
on keyboard, usually on the key at left of '1']
v : V¯ : Square root
q : X3 (X^3) : Cube
^ : YX (Y^X) : Y raised to power
X
l : ln(X) : Logarithm Neperian of X
L : log(X) : Logarithm in base 10 of X
p : eX (e^X) : e to the Xth power
P : 10X (10^X) : 10 to the Xth
power
<,> or LEFT, RIGHT arrows : Swap X and Y
UP, DOWN arrows : Scroll the stack
Backspace : Correct input, and if Input field is empty, clear
(delete) current stack element (this is Stack 0, also referred as the 'X'
register)
DEL : Delete input at once, and if input field is empty, will delete X.
ESC : Quit / Exit (work also on memory operations partially
keyed : will exit it directly)
Shift-F1 : Cycle on 'Auto-save on Exit' modes
Logically however (this is as presented), we have :
F3 : Store
F4 : Recall
F5 : Store +
F6 : Store -
F7 : Store *
F8 : Store /
x : Recall 'Last X'
y : Recall 'Last Y'
m : Recall 'Memory'
s[+|-|*|/] <R> : Store (with optional operation) to RegisterExamples :
r <R> : Recall Register
<R> : [.]<n>|i|x|y|m|n|r|p|a|f|c : specify register as :
. : stack selector : refers to a stack element if provided (optional)
<n> : register/stack number n, from 0 to 9; or
i : indirect operations : register number specified in Memory as : '(Integer part of the absolute value of Memory) modulus 32'; meaning there are actually 32 registers (plus 'Currency' and 'Mouse TimeOut'), of which Finances ones, Last Y, ... (see table below). Indirect operations are valid only on registers, resulting in clearing the stack selector ('.') if previously keyed.
x : 'Last X'
y : 'Last Y'
m : Memory register
n|r|p|a|f : Finance registers
Partial memory operations are displayed in the Input field and can be corrected (ESC / Backspace), this is as long as the target register is not provided.
| Default Name |
key |
number |
| R 0 ... R 9 | ||
| Memory | ||
| N Ann | ||
| Rate/Y | ||
| P Val | ||
| Annuit | ||
| F Val | ||
| Last x | ||
| Last y | ||
| (Reserved) | ||
| (Reserved) | ||
| (Reserved) | ||
| (Reserved) | ||
| (Reserved) | ||
| (Reserved) | ||
| Usr F1 ... Usr F8 | ||
| EUR>BEF | ||
| (Mouse TimeOut) |
You can change the default name given (displayed) to registers, but it will not change the way you use them (same number / letter). Rename doesn't apply to stack registers, neither to Input and Result fields. This new name will be saved with the File Save function (see later), and on Exit, depending on Auto-save mode.
This said, the finance functions rely on (are derived or extracted from)
this general formula :
| PV * (1 + Rate)Nbr_Annuities + Annuity * ( 1 + Rate * Type) * [ ( 1 + Rate)Nbr_Annuities - 1] / Rate + FV = 0 |
and, if Rate = 0 :
| PV + Annuity * Nbr_Annuities + FV = 0 |
where :
| Variable
Name |
Register |
Description / Remarks |
| Rate | Yearly interest rate, expressed (entered) in percentages. | |
| Nbr_Annuities | Number of Annuities (or payments) | |
| PV | Present Value | |
| Annuity | Annuity (recurrent payment). I used the term 'Annuity' and not 'Payment' just because 'Payment' and 'Present' start with the same letter, making single character differentiation impossible ! | |
| FV | Future Value | |
| Type | 'Type' equals 0 (zero) if Annuities (payments) are due at the end of the period, and is 1 (one) if due at beginning of it. |
In annuity functions, cash you pay out, such as a deposit to savings, is represented by a negative number; cash you receive, such as a dividend check, is represented by a positive number. For example, a $1,000 deposit to the bank would be represented by the argument -1000 if you are the depositor and by the argument 1000 if you are the bank.
Rates are yearly interest rate, meaning that with monthly payments (annuity period set to monthly), the monthly interest rate used in annuity function is first computed as :
| Monthly_Rate = (1 + Yearly_Rate)1/12 - 1 |
If from the above F(Rate, Nbr_Annuities, PV, Annuity,
FV) function, we can easily get PV = FPV(Rate,
Nbr_Annuities, Annuity, FV), FV = FFV(Rate,
Nbr_Annuities, PV, Annuity), Annuity = FAnnuity(Rate,
Nbr_Annuities, PV, FV) and Nbr_Annuities = FNbr_Annuities(Rate,
PV, Annuity, FV); we can not get Rate = FRate(Nbr_Annuities,
PV, Annuity, FV) !
So, the only way is to compute an estimate value, by successive approximations
: an iterative process, finding the root of F(Rate,
Nbr_Annuities, PV, Annuity, FV), where Nbr_Annuities,
PV, Annuity, FV variables are fixed. I used therefore, the fast converging
Newton-Raphson method :
| Ratei+1 = Ratei - F(Ratei, Nbr_Annuities, PV, Annuity, FV) / F'(Ratei, Nbr_Annuities, PV, Annuity, FV) |
where F'(Rate,...) is the derivate by 'Rate' of F(Rate,...) : dF/dr.
The interest rates are input (and displayed) as a percentage value : for example, you key '3.5sr'
to store 3.5% as yearly interest rate, which is displayed as 3.5000%. Actually, numbers stored to r register are first divided by 100 (converted in %) if its data type is not already 'Percent', and is then associated with 'Percent' data type.
Other arguments are not converted, so, when working in monthly
mode, the Number of Annuities must be expressed (stored) in number of months,
and the Annuity amount is the monthly payment. Thus, if you want
to set directly the monthly rate (instead of the yearly), you just have
to stay in Yearly mode.
Again, as I'm not a financial, I don't know which options are the more convenient. When switching from Yearly to Monthly, I could as well automatically multiply the Number of Annuities ('N') register by 12, and vice versa.
Currency name is structured in 3 parts :
- First 3 characters = from currency (default is EUR)
- Middle character : you should keep it as '>'
- Last 3 characters = to currency (default is BEF)
Those parts are use as currency conversion labels on 'Mouse Keypad', and as corresponding conversion functions (EUR>BEF or BEF>EUR, hence the importance of middle character).
...
And now the
! ! !
You won't believe it !
I dreamed of it for
years, though about it for months and took some evenings to make it real
!
To access History, just click on History (right zone) or press the TAB key.
Then when printing to a TEXT file, the color codes are "translated" in Characters codes, and are written at the left of history line. The corresponding characters are stated between square brackets ('[]') hereunder.
And for operators / functions only :
BLUE : line deleted or input edited without replay : indicates that the result
is not correct ! [!]
BROWN : line (operation) marked to be skipped on replay [*]
YELLOW : line skipped in user function [*]
RED : break point : this operation and all following will be
skipped (until next break point) [#]
LIGTH RED : break point in user function [#]
CYAN : operations after/between break point(s) : indicates that
the operation is not performed [|]. This color is only shown after a replay. (Not marked in user functions).
When "replaying history", ' *** REPLAY *** ' is displayed (in red) in the input field.
If and error occurs during the replay, the error must first be cleared (with ESC or BS). The operation will be skipped and marked so, allowing you to correct and re-run.
Shift-F1 : Cycle on 'Auto-save on Exit' mode (see upper).
Shift-F2 : Save status, registers (value and name) and history to a binary file,
with skip info, ... allowing a "perfect" re-run afterwards (append
automatically the .RPN extension)
Shift-F3 : Reload and re-play (open) a previously saved
status and history from a binary file (append automatically the .RPN extension).
Note that Stack and History will be cleared on file reload. Registers (value and name)
will be restored before history replay (to restart from cleared registers,
start the operation with a 'Clear Registers', which don't affect names).
Shift-F4 : Print registers and history to a text file
(append automatically the .PRT extension)
NB: File names must respect old DOS rules : maximum 8 characters before the extension (3 characters automatically added), with no spaces, no special characters, ... Sorry for that !
But I must admit I use it !
Thanks to Bill who did nothing but requesting it !
However, for convenience, some toggle keys (Save on Exit mode (Shift-F1) and Skip mode in History (F10)) have been split into direct functions/buttons.
On the other hand, all status indicators in the first line act as toggles :
When in help, left click will move down.
You can click on up/down arrow to move line by line, or on scroll bar above/below the block to move by page. No block slide (drag), sorry.
When defined (this is when Label is inserted), the corresponding key on 'mouse pad' is changed from gray to blue, as visual reminder.
On Replay, the Return instruction is automatically added at then end (of History), if a Label is still opened.
A Goto a not defined label, or to its own label, will give an error and operator will be marked "skipped". But the Goto will then still act as Return function (thus not actually skipped !). If the label is defined later on, just clear the skip mark (by pressing F10 2 times on it).
With the mouse, click on Function number '1..8' (blue on white background) to insert a Label, on '>' (white on light gray) for Goto and on displayed name 'Usr F1..8' (blue on light gray) to Execute.
Character | with function (re-)named 'My Fct' | |
| Label | ||
| Goto | ||
| Execute | ||
| Return |
To keep the History zone "clean", User functions at top of it are not shown. The first "dummy" visible operator is then '^^^^^^^', which is automatically added/inserted (and deleted in some cases) on Replay. You can still delete it manually if automation fails, but it will be inserted back on next Replay (or on restart).
User functions are not deleted with History. To remove them, delete their label first or do a "Full memory reset". In the same way, function names are not deleted (reset) with Clear Names function as long as the corresponding label exists.
The best is still to try & play with !
Lets look back at the example (quelque peu farfelu, je vous l'accorde !)
as in the figure or the PRINT file listed below. You can play with
it by yourself reloading it, here is the corresponding saved file
CALC41EX.RPN.
I illustrated here two independent calculations : trigonometric
operations and finance rates search.
NB : To replay excatly the sequence, after the reload, you should :
- Reload the CALC41EX.RPN file, which will re-run,
without Finance registers initialization;
- Clear registers : R
- Switch to History, and skip the Clr Reg operation
- Remove the break points at begin and end of initialization,
- Re-play it once
- Reset the break points.
Now, you can re-play it up to 10 times and get the Rate estimates stored in
Register 0 to 9.
I recommend you to run it once in step-by-step mode and see what happens, how Status indicators changes (DEG to RAD, UNSYNCH to *SYNC* and others if modes were different before reloading ...).
ID-PHY ================== RPN Calculator V4.1 ================== (c)P. HARDY
Result: 0.0785
Input :
Last y: 10.0000
Last x: 16.0000
Status indicators / Modes :
Auto-save on Exit mode : [#] Save all : Status, Names, Registers, Stack and History
Function key : Standard mode : F1 = Help , F2 to F8 = Direct Memory functions
Screen mode : Normal : Register and History only (25 lines)
Number format : FIX (Floating), with 4 decimals
Trigonometric mode : RADIAN
Finance mode : YEARLY payments at END of period
Finance registers are : SYNCHRONIZED (one being computed based on others).
Internal registers :
Click TimeOut 35.0000
Currency EUR>BEF 40.3399
Finance registers :
Present Value P Val : 2 000.0000
Annuity (payment) Annuit: -180.0000
Future Value F Val : -200.0000
Interest Rate Rate/Y: 7.8478 %
Number of Annuities N Ann : 26.0000
Memory registers :
Index : 9.0000
R 0 : 0.0000
R 1 : 0.0246
R 2 : 0.0412
R 3 : 0.0528
R 4 : 0.0612
R 5 : 0.0674
R 6 : 0.0721
R 7 : 0.0757
R 8 : 0.0785
R 9 : 0.0000
Stack registers :
St 0 : 0.0785
St 1 : 26.0000
St 2 : 0.0000
St 3 : 0.0000
=================== History ===================
180.0000 Enter 180.0000
!> 8.0000 / 45.0000
Sin 0.7071
Radian 0.7071
Pi 3.1416
In-004 4.0000
/ 0.7854
Sin 0.7071
* Swap 0.7071
- 0.0000
# 2 000.0000 STO P 2 000.0000
| -200.0000 STO F -200.0000
| -180.0000 STO A -180.0000
# 10.0000 STO N 10.0000
Re-001 10.0000
RCL M 8.0000
2.0000 * 16.0000
+ 26.0000
STO N 26.0000
Rate 0.0785
STO i 0.0785
Mem+1 0.0785
Here below, a reformatted extract of Help file, as displayed in Help function (without colors but with bold, ...) :
+---------------------------------------------------------------------+
RPN Calculator
An RPN calculator, working as old HP calculators
with infinite stack, trigonometric and finance functions,
conversions, editable & replayable history of operations,
user defined functions, ...
Author : Pierre Hardy
Version : 4.1, July 2007
More info at : http://users.swing.be/id-phy/CALC/CALC.html
Copyright Pierre Hardy, 2004 - 2007. All rights reserved.
The program may be freely used and distributed.
+---------------------------------------------------------------------+
Base Operations
Number Input :
0 - 9, e, . or , : Digits, Exponent sign, Decimal point
= : '-' sign (only if entered before digit)
INS : Change sign, anywhere in number input (+/- toggle)
<- / DEL : Correct / Delete, if empty input : delete x
Basic functions :
+, -, *, /, %, Enter : basic operators
~ : Change sign operator (end entry) i : 1/x : Invert
! : n! : Factorial(x) d : Delta % : (x/y)-1
` (back quote) or small 2 : Square v : v : Square root
q : x^3 : Cube ^ : y^x : y raised to power x
l : LN : Logarithm Neperian L : Log : Logarithm base 10
p : e^x : e to the Xth power P : 10^x: 10 to the Xth power
Stack movements :
<,> or LEFT, RIGHT arrows : Swap x and y
UP, DOWN arrow : Scroll stack
ESC : Exit
+---------------------------------------------------------------------+
Extended Functions
Accessed by pressing 'f' or 't' first
f : Finance functions : t : Trigonometric functions :
d : Display/Hide Finance Reg. d,r : Degree, Radian mode
b,e : Begin/End of period p : Pi (3.141592...)
m,y : Monthly/Yearly Annuity s,c,t : Sine, Cosine, Tangent
c : Clear Finance registers and S,C,T : ArcSin,ArcCos,ArcTangent
restore setting to End & Yearly
Computes (assuming all 4 other values are provided) :
n : Number of annuities
r : Rate (yearly rate in %)
p : Present value
a : Annuity (payment)
f : Future value
Negative value = Cash out
After execution of finance function, Finance registers changes form
Magenta to Green, and indicator in status bar switch form '-' to '*'
+---------------------------------------------------------------------+
Memory Operations
Direct Memory functions (on Mem register) :
F2 : Increment memory (+1) F3 : Store F4|m : Recall
F5 : Store + F6 : Store - F7 : Store * F8 : Store /
Stack and Registers operations :
x, y, m : Recall Last x, Last y or Direct Memory (Mem register)
s[+|-|*|/] Rename, Clear, Save and Reload
Register rename :
n Conversions
Sexagesimal conversions :
h : HR->HH:MM:SS : conversion to sexagesimal
H : HH:MM:SS->HR : conversion to Decimal
Currency conversions :
Currency rate is stored in 'c' register : BEF/EUR in default example.
Corresponding name "EUR>BEF" used (needs a Replay after rename) :
- to re-label mouse keys as [EUR] [BEF] (at left of HMS)
- as Function name in history "EUR>BEF" or "BEF>EUR"
Pound symbol or AltGr-b : multiply by rate (to "BEF" or Local )
$ or AltGr-e (Euro symbol) : divide by rate (to "EUR", USD, ...)
Metric to Imperial conversions :
Only available through "Mouse pad".
+---------------------------------------------------------------------+
More functions ... User defined !
User Functions keys :
Up to 8 User Functions can be defined
Alt-F1...F8 : Creates a User Function (insert a Label in History)
Ctrl-F1..F8 : Executes corresponding User Function (if defined)
Alt-F9..F12, Ctrl-F9..F12 : Go to label 1-4, 5-8
Ctrl-End : Return (end function)
U : User mode toggle : Swap F1..F8 with Ctrl-F1..Ctrl-F8 functions
A function is terminated by either Return or Goto function.
Visually, functions are between { }, and grayed in History.
Mouse operations :
Click on : Key Number to insert a Label (define function)
'>' sign for "Go to"
Function Label (default is "Usr Fn") to Execute
When defined, function key color (on mouse pad) will change to blue
Function label (renamed) will be used in History (Replay to refresh)
User functions are stored in History, but not cleared with History.
Functions at top of History are "hidden" above screen, ending with
[^^^^^^^] : automatically added after last "hidden" function,
making it the first visible "operation" (can be deleted).
+---------------------------------------------------------------------+
... and now the MAGIC !
History Navigation :
ESC : Quit history mode TAB : Switch to/from history
ENTER : Recall value (and exit) F9 : Cycle on edited values
Arrows, Home, End, Page Up and Page Down : Navigate in history
History Edit :
Overwrite on input or result field, correct with Backspace
Quit with Escape and Validate with any other key.
Value set in CYAN and Operator set on BLUE until next Replay
DEL : Mark line to be DELETED INS : Fix / Release result value
F10 : Operation skip mode :
Skip (BROWN): skip one line
Break (RED) : skip until next break or until end
History Replay :
F11 : Replay step by step then ...
F12 : Replay all : Re-RUN / Refresh
+---------------------------------------------------------------------+
... MOUSE & Display ...
Mouse operation :
\ or Click on [Arrow] (upper right corner) : 'Mouse keypad' toggle.
Mouse Keypad should be self explanatory, most map to key strokes.
Double click on any value to recall it !
Status bar 'mouse toggles/keys' :
First characater : cycle on "Save on exit" mode
STD|USR FIX|Fix|SCI|Sci REG|STK RAD|DEG BEG|END YRL|MTL HELP [^]
-|* (between BEG and YRL) : Finance display (c) : Quick exit
F|S toggle between SCI|FIX, last two between Mixed & Same Format
Display format :
F n : FIX mode (n Decimals) S n : SCI mode (n Decimals)
# : Toggle between Mixed (Fix|Sci) and Same (FIX|SCI) Format
D : Display mode toggle : Stack/Register precedence (over Reg/Stk)
MixFmt : Mixed Format, numbers displayed as when entered : Fix or Sci
SmFmt : Same Format, all displayed as current setting : FIX or SCI.
Number of decimals applies to all. Refresh (F12) to update History.
+---------------------------------------------------------------------+
a : A : clear All: names, reg, stk & hist.
b :
c : clear stack and history C : clear registers, stack and history
d : delta % D : toggle display mode Stack | Register
e : E character in numbers
f : finance functions F : Fix (Floating) display format
g :
h : convert to sexagesimal H : convert to decimal
i : invert : 1/x
j :
k : K : clear stacK
l : LN : logarithm neperian L : LOG : logarithm base 10
m : recall memory M : Memory reset
n : register re-Name N : clear register names
o :
p : e^x P : 10^x
q : cube : x^3
r : recall R : clear registers
s : store S : Scientific (Exp) display format
t : trigonometric functions
u : U : User | Std mode toggle
v : square root
w :
x : Last x
y : Last y Y : clear historY
z :
0 - 9 : digits ,. : decimal separator
+ : plus - : minus
* : multiply / : divide
% : percentage ! : factorial
~ : change sign = : minus sign
^ : power ` , [small 2] : square
$ : From Currency conversion Pound symbol : To Currency conversion
AltGr-e (Euro sympbol): idem AltGr-b : idem -^
\ : Mouse pad toggle # : Mixed | Same Format mode toggle
ESC : quit / exit TAB : to/from History
F1 : Quick Help Shift F1 : Cycle on Save mode
F2 : Mem + 1 Shift F2 : Print
F3 : Store to Mem Shift F3 : Save
F4 : Recall Mem Shift F4 : Reload
F5 : Store + Mem
F6 : Store - Mem
F7 : Store * Mem
F8 : Store / Mem
F9 : Go to previous edited
F10 : Toggle skip | break | normal mode
F11 : Step by step run
F12 : Replay : run all
Alt-F1..F8 : Label 1 .. 8 Ctrl-F1..F8 : Execute Fct 1 .. 8
Alt-F9..F12 : Go to 1 .. 4 Ctrl-F9..F12 : Go to 5 .. 8
Pierre HARDY.To conclude ...
This program is "freeware",
but if you download and test it, could you provide me some feedback. Suggestions
on key mapping, new functions, mouse keypad layout (I'm not 100% satisfied of it), ... are welcome. I'm thinking about extended finance
functions, add statistic functions, ... So if you have some
requirements, I just make no promises ;-)
I'd like to know who uses it, so I could add you to the users list and inform you of new "releases". Take one minute to drop me an e-mail !
e-mail : pierre.hardy@swing.be
Copyright © Pierre Hardy, 2004 - 2007. All rights reserved. The program
and this document may be freely used and distributed.