Anthony Stone's RRF Calculator

Home -> Programs -> RRF -> RRFcalc


Personal information

Computer programs

Research details

The Theory of Intermolecular Forces


Supplementary material for published papers

RRFcalc reads input a line at a time and treats it as commands for a calculator working in Reverse Polish Notation. It is convenient for interactive use, but it can be used non-interactively by supplying a file of commands as standard input.

After each line of input has been processed, the top item on the stack is displayed, unless the last command already displayed it. The commands available are:

integer read the integer (which must be non-negative) and put it on the stack. To get a negative number on the stack, you need to read in a positive number and use CHS to change the sign.
PP rrf read the rest of the line as a root-rational-fraction in power-of-prime form, and put it on the stack.
+ Add: replace the top two elements on the stack by their sum.
- Subtract (top-of-stack from the one below). To change the sign of the top-of-stack, use CHS.
* Multiply
/ Divide (top-of-stack into the one below)
POWER n raise to power n (n = integer or integer/2).
SQRT = POWER 1/2. Note that it is an error to take the square root of a number which already contains half-odd-integer powers.
CHS change sign
SWOP, SWAP exchange top two items of stack
STO n Store top-of-stack in memory n (1 ≤ n ≤ 25). The item is not removed from the stack.
RCL n Recall from memory n to top-of-stack.
V Verify top of stack.
LIST List the entire stack using the current default verification mode. Top of stack is shown first.
VP Verify top-of-stack in power-of-prime notation
VI Verify top-of-stack as (a/b)*sqrt(c/d), where a, b, c and d are integers (standard default).
VF Verify top-of-stack as a floating-point number.
VMP Change default verification mode to power-of-prime.
VMI Change default verification mode to (a/b)*sqrt(c/d). This is the usual default.
VMF Change default verification mode to floating-point.
0J, 3J, 6J, 9J Calculate a Wigner 3j, 6j or 9j symbol and put it on the stack. 0J calculates a 3j symbol for which all m values are zero. The full input for these commands takes the form:
  • 0J j1 j2 j3
  • 3J j1 j2 j3 m1 m2 m3
  • 6J j1 j2 j3 l1 l2 l3
  • 9J a b c d e f g h i
where each argument is integer or integer/2 (integers only for 0J) and all arguments must appear on the same line separated by one or more spaces.
POP Delete the top member from the stack.
PUSH Push the stack down, copying the top member. PUSHing an empty stack inserts zero.
CLR,CLEAR Clear the stack.
PROMPT ‘string Set prompt string. The string is output when the program is ready for the next line of commands. The default string is ‘:’. A null string may be set.
ECHO+ Reflect each input line before obeying any commands.
ECHO- Do not reflect input lines (default).
( Ignore rest of line.
? Give a summary of the available commands.
QUIT, Q Quit.

Valid HTML 4.01 Transitional