home *** CD-ROM | disk | FTP | other *** search
- Reverse Polish Calculator - By Circle Software - © Jan 1995
- ===========================================================
-
- This program is shareware.
- Please read the file Licence in this directory.
-
- Introduction.
- ============
-
- The Reverse Polish system is different from the way most calculators
- work, and although this is simple, you should not try to use it without
- first reading these notes.
-
- The nature and origin of Reverse Polish notation is explained at the
- end of this file.
-
- Note that the !Help facility is fully implemented. Select Help from the
- iconbar menu.
-
- This manual is divided into sections.
-
- Conventions: Describes the nomenclature used in the text.
- A Quick Start: Gives simple instructions without getting technical.
- How to use RPCalc: Explains the finer points of using the program.
- Reverse Polish: Describes the origin and nature of Reverse Polish.
- The Functions: Describes the use af all calculator functions.
- More Complex Examples.
- To find any function, search for the button as
- [name] e.g. [+] or [Sine] etc.
-
- N.B. To correctly display some button legends, your
- text editor should be set to display standard
- system font. e.g. [⇩] should appear as [down arrow].
-
- Conventions
- ===========
-
- Throughout this manual, references to button icons on the calculator
- are shown between square brackets, e.g. [Enter].
-
- The terms SELECT and ADJUST refer to the first and third mouse buttons,
- as normally defined, and may be used to prefix a function button.
-
- When not specifically stated, you should always use the SELECT button,
- as in most cases, ADJUST will cause an alternative action.
-
-
- A Quick Start
- =============
-
- First, see how easy it is to use by doing a simple addition calculation,
- before going into details. Press the following keys in order -
-
- [3] [Enter] [4] [+]
-
- The value shown in the lower display is the result of adding 3 + 4, (7).
- To multiply the result by 5, press -
-
- [5] [x]
-
- And we get 35.00 as expected. Its as simple as that!
-
- Using this method you can always see exactly what values are about to be
- operated on, unlike ordinary calculators.
-
- You can also now see why it is called 'Reverse' Polish. On this calculator
- you press these buttons in the reverse order, compared to a normal one.
-
- However, this simple example may illustrate how to use the machine, but
- does not show the real power of the system. For that, read on.
-
-
- How to use RPCalc.
- =================
-
- The Displays.
-
- The calculator has four display registers rather than the usual one.
- The lower register, labelled 'X', is equivalent to the single display
- found on ordinary calculators. Above this, the Y register is used to
- hold a second value to be operated on, while the remainder will
- display intermediate calculation results, where appropriate.
-
- These registers constitute a 'stack', where numbers are placed until
- needed.
-
- When you click on the [+] operator button, for example, the value
- displayed in the X register will be added to the value in Y, and the
- result displayed in X.
-
- A few functions produce two results, and in these cases the second
- result will be displayed in the Y register.
-
-
- Entering Values.
-
- You enter values into the X register in the normal way, by clicking
- on the number buttons, or by using the keyboard number pad. (In the
- later case, the calculator must have the input focus. If not, click
- in the calculator background, or the iconbar icon.)
-
- To get a value into the Y register, first enter it into X, as above,
- and then use the [Enter] key. This will move the value in the X
- register up to the Y, and clear X ready for a new value.
-
- When [Enter] is used, any values in higher registers will also be moved
- up, and any value in the top register will be lost. This should rarely
- happen.
-
-
- Adding Two Numbers.
-
- Thus, to add two values, enter the first value into X, click [Enter] to
- push this up to Y, enter the second number into X, then click [+].
-
- This simple example does not show the advantages of Reverse Polish over
- the more conventional calculator, so let's try something more complex.
-
-
- Evaluating an Expression.
-
- To evaluate the expression ( 2 + 4 ) * ( 7 - 3 ) follow the button
- clicks in the first column below, and check the actions listed.
- In particular note the display contents as given in the last column.
-
- Button Action Stack
- ====== ================================== ========
- X Y
- [2] '2' appears in X. 2
- [Enter] The 2 moves up to Y, and X clears. 2
- [4] '4' appears in X. 4 2
- [+] '4' and '2' are unstacked, and 6 placed in X 6
- [7] '7' appears in X, the 6 moves up to Y 7 6
- [Enter] The 7 moves up to Y, and X clears. 7 6
- [3] '3' appears in X 3 7 6
- [-] '3' and '7' are unstacked, and 4 placed in X 4 6
- [*] '4' and '6' are unstacked, and 24 placed in X 24
-
- Thus X contains the final result, which we can use in further
- calculations if required. Note that it is not necessary to write down,
- remember, or re-enter either intermediate result 6 or 4, as these
- remain on the stack until needed. This calculation required 3 of
- the 4 registers provided, which you will find sufficient for the most
- complex calculations.
-
-
- Another Example
-
- Suppose you needed to calculate the VAT due and the total price of
- an item costing £123.50 We will use a property of the [Enter] button
- invoked by clicking with the ADJUST button. When you do this, the value
- in X will be moved up as before, but X will not be cleared, so its value
- may be used again.
-
- Press the buttons shown in the first column, as before -
- ( Remember to use the ADJUST button for [Enter] ).
-
- Buttons Action Stack
- ======= ================================== =============
- X Y
- [1][2][3][.][5] 123.5 appears in X 123.50
- [Enter] Use the ADJUST mouse button 123.50 123.50
- [1][7][.][5] Stack rises & 17.5 appears in X 17.5 123.50 123.50
- [%] X % of Y is computed in X 21.61 123.50
- (This is the VAT due on 123.50)
- [+] 21.61 + 123.50 is computed in X 145.11
- (This is the total due.)
-
- Note how the final total was computed with a single key stroke, without
- the need to re-enter any values at all. This was because we had duplicated
- the original 123.5 by clicking [Enter] with the ADJUST button.
-
-
- The Storage Registers
-
- In addition to the stack, the value in X may be stored in any of 10 special
- registers numbered from 0 to 9. To do this click on [Store] followed by the
- single digit indicating the required store number. To retrieve the stored
- number click on 'Store' with the Adjust button, followed by the store number.
-
- Try this -
-
- Buttons Action Stack
- ======= ================================== =============
- X Y
- [pi] 3.14 appears in X 3.14
- [Store] The store button stays 'in'. 3.14
- [7] The value is stored. 3.14
- [Clear] The X register is cleared 0.00
-
- Now prove the value is stored by (Use the ADJUST button) -
-
- [Store] Use the Adjust button to 'fetch' 0.00
- [7] Value stored in store 7 is shown 3.14
-
- In the VAT example above, we could have stored the VAT rate, 17.5, in one
- of these storage registers, and used it in repeated VAT calculations.
-
-
- The Display Format
-
- In the above example, the value of 'pi' was shown as 3.14 because the
- calculator is initially set to display only 2 decimal places. The full
- value of pi (to about 15 significant figures) is of course used internally,
- and may be displayed by increasing the decimal places using the adjuster
- buttons at the top right of the calculator.
-
- Other display modes are also available.
-
-
- !Help
-
- RPCalc supports the Acorn !help facility, which may be used to explore all
- the functions on the calculator. To invoke this, select 'Help' from
- the iconbar menu, and move the pointer over the function buttons provided.
- You will find that most of the buttons provide two separate functions. The
- function displayed on the button is invoked using the SELECT mouse button,
- while another, often the inverse function, is invoked using the ADJUST
- button.
-
-
- Reverse Polish
- ==============
-
- Reverse Polish is a notation system for mathematical expressions
- invented by a Polish gentleman by the name of Lukasiewicz.
- Unfortunately for him, nobody could pronounce his name so the
- notation became known as Reverse Polish, and his name is all but
- forgotten.
-
- It is possible that even the notation itself would have been
- forgotten were it not for the arrival of computers, where it has
- become probably one of the most often used systems, not for
- writing expressions, but for storing them for later computation,
- as for example in compiled code.
-
- The Forth programming language is based upon the Reverse Polish
- system, and Postscript also works this way.
-
- The tag 'reverse' simply refers to the fact that operators, such
- as '+' and '-' are written after the values on which they operate
- rather than before, as in more conventional notation.
-
- The advantage of the notation is that it permits an expression
- to be written without the use of parentheses, while remaining
- totally un-ambiguous. For example, the expression -
-
- ( 2 + 4 ) * ( 7 - 3 )
-
- would be written, or stored as -
-
- 2 4 + 7 3 - *
-
- To evaluate this, the expression is scanned from left to right, and
- any values found removed and placed aside on a stack (i.e. a heap or
- pile). When an operator is found, the required number of values are
- retrieved from the stack (last on, first off), the operation carried
- out on them, and the result put back on the stack. This system is
- continued to the end of the expression.
-
- Thus in the above case, 2 and then 4 are placed on the stack before
- the '+' operator is found. These values are then retrieved and the
- addition carried out. The result, 6, is then placed back on the
- stack.
-
- Then 7 and 3 are found in turn and placed on top of the 6. At this
- point a '-' operator is found, so the last two values, 7 and 3, are
- retrieved and the result of the subtraction, 4, is placed back on
- the stack, as before.
-
- At this point the stack now has a 4 on top of 6, so when the last
- operator is found, the '*', these two numbers are multiplied together
- and the result, now the final answer, 24, is placed back on the
- stack.
-
- Notice that whenever an operator is found, only the required number of
- values are unstacked, so that the system works equally well for unary
- operators such as x! or sin(x), as for binary ('+' '/' etc) or other
- operators.
-
- The system may be extended to include multi-parameter functions, such
- as function( a, b, c ). Which is simply written -
-
- a b c function
-
- It is also possible to include programming constructs, such as
- if-then-else, repeat, etc, as is done in Forth and Postscript.
-
- Note also that the notation does not require any knowledge of operator
- priority. Operators are always executed when found, using however
- many values are needed.
-
- The Functions.
- =============
-
- This section gives full descriptions of each available function,
- for each calculator button.
-
- In all cases, X, or X and Y where appropriate, are unstacked, and
- the result placed in X, unless otherwise stared.
-
- Use of the SELECT mouse button is assumed where not stated.
-
-
- The stack manipulations.
-
- [Enter] Causes the stack to rise.
- SELECT Clears the X register
- ADJUST Preserves the X register.
-
- [⇩] SELECT Rotates the stack downwards.
- ADJUST Rotates the stack upwards.
- In both cases end values are wrapped around.
-
- [X⇧ Y⇩] Swaps the X and Y register values.
- The stack does not rise.
-
-
- Simple Arithmetic.
-
- [-] Subtract. Computes Y - X
-
- [+] Add. Computes Y + X
-
- [×] Multiply. Computes Y * X
-
- [÷] Divide. Computes Y ÷ X
-
-
- Functions of X.
-
- [x!] Factorial. Computes x * (x-1) * (x-2) * (x-3) ... * 2 * 1
-
- e.g. to compute factorial 10, key in -
- [10] [x!] result 3628800
-
-
- [1/x] Reciprocal. Computes 1 ÷ x
-
- e.g. to compute 1 / e, key in -
- [e] [1/x] result 0.37
-
-
- [x^y] Powers. ( Actual legend not reproducible here)
- SELECT Computes X the the power of Y
- ADJUST Computes Y the the power of X
-
- [x²] Squares.
- SELECT Computes x * x
- ADJUST Computes the square root of x
-
-
- Miscellaneous Functions.
-
- [±] Changes the sign of X. i.e. -x becomes x, and x becomes -x
-
- [Int] Integer.
- SELECT Computes the integer part of x, removing fractions.
- ADJUST Computes the fractional part of x.
-
- [Abs] Absolute Computes |x| i.e. Removes any -ve sign.
-
-
- Logarithms.
-
- [Log] SELECT Computes the log to base 10.
- ADJUST Computes the anti-log to base 10.
-
- [Ln] SELECT Computes the log to base E.
- ADJUST Computes the anti-log to base E.
-
-
- Trig Functions.
-
- [Sin] SELECT Computes sine(x)
- ADJUST Computes angle whose sine is x
-
- [Cos] SELECT Computes cos(x)
- ADJUST Computes angle whose cosine is x
-
- [Tan] SELECT Computes tan(x)
- ADJUST Computes angle whose tangent is x
-
-
- Hyperbolic Functions.
-
- [Sinh] SELECT Computes sinh(x)
- ADJUST Computes inverse of sinh(x)
-
- [Cosh] SELECT Computes cosh(x)
- ADJUST Computes inverse of cosh(x)
-
- [Tanh] SELECT Computes tanh(x)
- ADJUST Computes inverse of tanh(x)
-
-
- Other Functions.
-
- [Polar] This function produces two result values.
-
- SELECT Computes polar from cartesian co-ordinates.
- X = Sqrt( x*x + y*y )
- Y = angle whose tangent is Y ÷ X
-
- e.g. Given a 3, 4, 5 triangle, key in -
- [3] [Enter] [4] [Polar] results in -
- X = 5, the (hypotenuse)
- Y = 36.87°
-
- ADJUST Computes cartesian from polar co-ordinates.
- X = x * cos(y)
- Y = x * sin(y)
-
-
- [H.MS] Hours, Minutes and Seconds Conversion.
- The display should be set to Fixed point, 4 decimal places
- to use this function.
-
- SELECT Computes hrs, mins, secs from decimal hrs.
- i.e. result X = H.MMSS where MM == Minutes, SS == Seconds.
-
- e.g. Given 12.56 hrs, key in -
- [12.56] [H.MMSS] results in 12.3336
- i.e. 12 hrs 33 mins 36 secs.
-
-
- ADJUST Computes the inverse, converting hrs, mins, secs to hrs.
-
- e.g. Map reference 12° 18', key in -
-
- [12.18] ADJUST [H.MMSS] results in 12.30°
-
-
- [yCx] Combinations and Permutations.
-
- SELECT Computes the number of possible combinations of Y objects
- taken X at a time, where order is unimportant.
-
- e.g. To compute the number of ways to select 8 objects from a
- total of 12, key in -
-
- [12] [Enter] [8] [yCx], result 495.
-
- N.B. This is how to compute (so called) permutations on your
- Pools coupon. These are really Combinations, as order is
- not important.
-
- ADJUST Computes the number of possible permutations of Y objects
- taken X at a time, where order IS important.
-
- e.g. Taking the above example, key in -
-
- [12] [Enter] [8] ADJUST [yCx], result 19,958,400
-
-
- More Complex Examples.
- =====================
-
- 1. A laser range finder gives the distance to the top of a building as
- 97.66 meters at an elevation of 12° 25'. Compute the height of the
- building, and its horizontal distance.
-
- We must first convert the angle to decimal degrees, then enter the
- angular distance and convert to cartesian co-ordinates.
-
- key in - [12.25] ADJUST [H.MS] [97.66] ADJUST [POLAR]
-
- Results are X = 95.38, the horizontal distance.
- Y = 21.00, the vertical height of the building.
-
-
- 2. Compute the roots of the equation: 3x² - 9x + 6 = 0
-
- Given the equation -b ± €(b² - 4ac) i.e. a = 3, b = -9, c = 6
- ----------------
- 2a
-
- This example demonstrates the use of the internal storage registers
- as well as some stack manipulation, all of which eliminates the
- need to remember intermediate results, and the necessity to enter
- the same value more than once.
-
- The best way of tackling a problem like this is to start in the
- middle, with the most complex part, like the inner root function.
-
- Buttons Action Stack
- ======= ====================== ======================
- [9] value -b 9
- [Store] [1] We will need this later 0
- [x²] compute b² 81
- [4] enter 4 4 81
- [Enter] push the stack up 4 81
- [3] value a 3 4 81
- [Store] [2] We will need this again 3 4 81
- [x] compute 4a 12 81
- [6] value c 6 12 81
- [x] compute 4ac 72 81
- [-] compute b² - 4ac 9
- Adj [x²] compute sqr root. 3
- Adj [Enter] duplicate value 3 3
- Adj [Store] [1] recall -b 9 3 3
- [+] compute -b + (b² - 4ac) 12 3
- Adj [Store] [2] recall a 3 12 3
- [2] value 2 2 3 12 3
- [x] compute 2a 6 12 3
- [÷] First result = 2 2 3
- [⇩] loose result 3
- Adj [Store] [1] recall -b 9 3
- [x⇧ y⇩] swap values over 3 9
- [-] compute -b - (b² - 4ac) 6
- Adj [Store] [2] recall a 3 6
- [2] value 2 2 3 6
- [x] compute 2a 6 6
- [÷] Second result = 1 1
-
- Hence, the roots are x = 1 and x = 2.
-
- There may be shorter ways of doing this. Note that we stored -b and a
- values for later use. In this simple contrived example this may have
- been pointless, as they could easily be re-entered. However, in a real
- example these values may have had 9 or more digits, so that storing
- them would be a real time saver.
-
- If the inner function had been negative indicating complex roots, we
- would have had to proceed slightly differently.
-
-
-
- End.
-
-