home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / technical / rpcalc / ManualTxt < prev   
Encoding:
Text File  |  1995-01-24  |  18.8 KB  |  531 lines

  1. Reverse Polish Calculator - By Circle Software - © Jan 1995
  2. ===========================================================
  3.  
  4. This program is shareware.  
  5. Please read the file Licence in this directory.
  6.  
  7. Introduction.
  8. ============
  9.  
  10. The Reverse Polish system is different from the way most calculators 
  11. work, and although this is simple, you should not try to use it without
  12. first reading these notes.
  13.  
  14. The nature and origin of Reverse Polish notation is explained at the 
  15. end of this file.
  16.  
  17. Note that the !Help facility is fully implemented. Select Help from the
  18. iconbar menu.
  19.  
  20. This manual is divided into  sections.
  21.  
  22. Conventions:           Describes the nomenclature used in the text.
  23. A Quick Start:         Gives simple instructions without getting technical.
  24. How to use RPCalc:     Explains the finer points of using the program.
  25. Reverse Polish:        Describes the origin and nature of Reverse Polish.
  26. The Functions:         Describes the use af all calculator functions.
  27. More Complex Examples.
  28.                        To find any function, search for the button as
  29.                        [name]   e.g. [+]  or  [Sine]  etc.
  30.  
  31. N.B.                   To correctly display some button legends, your 
  32.                        text editor should be set to display standard 
  33.                        system font. e.g. [⇩] should appear as [down arrow].
  34.  
  35. Conventions
  36. ===========
  37.  
  38. Throughout this manual, references to button icons on the calculator
  39. are shown between square brackets, e.g. [Enter].
  40.  
  41. The terms SELECT and ADJUST refer to the first and third mouse buttons,
  42. as normally defined, and may be used to prefix a function button.
  43.  
  44. When not specifically stated, you should always use the SELECT button,
  45. as in most cases, ADJUST will cause an alternative action.
  46.  
  47.  
  48. A Quick Start
  49. =============
  50.  
  51. First, see how easy it is to use by doing a simple addition calculation,
  52. before going into details.  Press the following keys in order -
  53.  
  54.                 [3] [Enter] [4] [+]
  55.  
  56. The value shown in the lower display is the result of adding 3 + 4, (7).
  57. To multiply the result by 5, press -
  58.  
  59.                 [5] [x]
  60.  
  61. And we get 35.00 as expected. Its as simple as that!  
  62.  
  63. Using this method you can always see exactly what values are about to be 
  64. operated on, unlike ordinary calculators.
  65.  
  66. You can also now see why it is called 'Reverse' Polish.  On this calculator 
  67. you press these buttons in the reverse order, compared to a normal one.
  68.  
  69. However, this simple example may illustrate how to use the machine, but 
  70. does not show the real power of the system. For that, read on.
  71.  
  72.  
  73. How to use RPCalc.
  74. =================
  75.  
  76. The Displays.
  77.  
  78. The calculator has four display registers rather than the usual one.
  79. The lower register, labelled 'X', is equivalent to the single display 
  80. found on ordinary calculators. Above this, the Y register is used to
  81. hold a second value to be operated on, while the remainder will
  82. display intermediate calculation results, where appropriate.
  83.  
  84. These registers constitute a 'stack', where numbers are placed until
  85. needed.
  86.  
  87. When you click on the [+] operator button, for example, the value
  88. displayed in the X register will be added to the value in Y, and the
  89. result displayed in X.
  90.  
  91. A few functions produce two results, and in these cases the second
  92. result will be displayed in the Y register.
  93.  
  94.  
  95. Entering Values.
  96.  
  97. You enter values into the X register in the normal way, by clicking
  98. on the number buttons, or by using the keyboard number pad. (In the 
  99. later case, the calculator must have the input focus. If not, click
  100. in the calculator background, or the iconbar icon.)
  101.  
  102. To get a value into the Y register, first enter it into X, as above,
  103. and then use the [Enter] key.  This will move the value in the X 
  104. register up to the Y, and clear X ready for a new value. 
  105.  
  106. When [Enter] is used, any values in higher registers will also be moved
  107. up, and any value in the top register will be lost. This should rarely
  108. happen.
  109.  
  110.  
  111. Adding Two Numbers.
  112.  
  113. Thus, to add two values, enter the first value into X, click [Enter] to
  114. push this up to Y, enter the second number into X, then click [+].
  115.  
  116. This simple example does not show the advantages of Reverse Polish over
  117. the more conventional calculator, so let's try something more complex.
  118.  
  119.  
  120. Evaluating an Expression.
  121.  
  122. To evaluate the expression ( 2 + 4 ) * ( 7 - 3 ) follow the button
  123. clicks in the first column below, and check the actions listed. 
  124. In particular note the display contents as given in the last column.
  125.  
  126.      Button    Action                                          Stack
  127.      ======    ==================================              ========
  128.                                                                 X  Y 
  129.      [2]       '2' appears in X.                                2
  130.      [Enter]   The 2 moves up to Y, and X clears.                  2
  131.      [4]       '4' appears in X.                                4  2
  132.      [+]       '4' and '2' are unstacked, and 6 placed in X     6  
  133.      [7]       '7' appears in X, the 6 moves up to Y            7  6
  134.      [Enter]   The 7 moves up to Y, and X clears.                  7  6
  135.      [3]       '3' appears in X                                 3  7  6
  136.      [-]       '3' and '7' are unstacked, and 4 placed in X      4  6
  137.      [*]       '4' and '6' are unstacked, and 24 placed in X    24
  138.  
  139. Thus X contains the final result, which we can use in further 
  140. calculations if required.  Note that it is not necessary to write down,
  141. remember, or re-enter either intermediate result 6 or 4, as these 
  142. remain on the stack until needed.  This calculation required 3 of
  143. the 4 registers provided, which you will find sufficient for the most
  144. complex calculations.
  145.  
  146.  
  147. Another Example
  148.  
  149. Suppose you needed to calculate the VAT due and the total price of
  150. an item costing £123.50  We will use a property of the [Enter] button
  151. invoked by clicking with the ADJUST button. When you do this, the value
  152. in X will be moved up as before, but X will not be cleared, so its value
  153. may be used again.
  154.  
  155. Press the buttons shown in the first column, as before -
  156. ( Remember to use the ADJUST button for [Enter] ).
  157.  
  158.      Buttons           Action                              Stack
  159.      =======           ==================================  =============
  160.                                                            X       Y 
  161.      [1][2][3][.][5]   123.5 appears in X                  123.50
  162.      [Enter]           Use the ADJUST mouse button         123.50  123.50
  163.      [1][7][.][5]      Stack rises & 17.5 appears in X     17.5    123.50  123.50
  164.      [%]               X % of Y is computed in X           21.61   123.50
  165.                        (This is the VAT due on 123.50)
  166.      [+]               21.61 + 123.50 is computed in X     145.11
  167.                        (This is the total due.)
  168.  
  169. Note how the final total was computed with a single key stroke, without
  170. the need to re-enter any values at all.  This was because we had duplicated
  171. the original 123.5 by clicking [Enter] with the ADJUST button.
  172.  
  173.  
  174. The Storage Registers
  175.  
  176. In addition to the stack, the value in X may be stored in any of 10 special 
  177. registers numbered from 0 to 9. To do this click on [Store] followed by the
  178. single digit indicating the required store number. To retrieve the stored
  179. number click on 'Store' with the Adjust button, followed by the store number.
  180.  
  181. Try this -
  182.  
  183.      Buttons   Action                               Stack
  184.      =======   ==================================   =============
  185.                                                     X      Y 
  186.      [pi]      3.14 appears in X                    3.14
  187.      [Store]   The store button stays 'in'.         3.14
  188.      [7]       The value is stored.                 3.14
  189.      [Clear]   The X register is cleared            0.00
  190.  
  191. Now prove the value is stored by (Use the ADJUST button) -
  192.  
  193.      [Store]   Use the Adjust button to 'fetch'     0.00
  194.      [7]       Value stored in store 7 is shown     3.14
  195.  
  196. In the VAT example above, we could have stored the VAT rate, 17.5, in one
  197. of these storage registers, and used it in repeated VAT calculations.
  198.  
  199.  
  200. The Display Format
  201.  
  202. In the above example, the value of 'pi' was shown as 3.14 because the
  203. calculator is initially set to display only 2 decimal places. The full
  204. value of pi (to about 15 significant figures) is of course used internally, 
  205. and may be displayed by increasing the decimal places using the adjuster
  206. buttons at the top right of the calculator.
  207.  
  208. Other display modes are also available.
  209.  
  210.  
  211. !Help
  212.  
  213. RPCalc supports the Acorn !help facility, which may be used to explore all
  214. the functions on the calculator.  To invoke this, select 'Help' from
  215. the iconbar menu, and move the pointer over the function buttons provided.
  216. You will find that most of the buttons provide two separate functions. The
  217. function displayed on the button is invoked using the SELECT mouse button,
  218. while another, often the inverse function, is invoked using the ADJUST
  219. button.
  220.  
  221.  
  222. Reverse Polish
  223. ==============
  224.  
  225. Reverse Polish is a notation system for mathematical expressions 
  226. invented by a Polish gentleman by the name of Lukasiewicz. 
  227. Unfortunately for him, nobody could pronounce his name so the 
  228. notation became known as Reverse Polish, and his name is all but 
  229. forgotten.
  230.  
  231. It is possible that even the notation itself would have been
  232. forgotten were it not for the arrival of computers, where it has
  233. become probably one of the most often used systems, not for 
  234. writing expressions, but for storing them for later computation,
  235. as for example in compiled code. 
  236.  
  237. The Forth programming language is based upon the Reverse Polish
  238. system, and Postscript also works this way.
  239.  
  240. The tag 'reverse' simply refers to the fact that operators, such
  241. as '+' and '-' are written after the values on which they operate
  242. rather than before, as in more conventional notation.
  243.  
  244. The advantage of the notation is that it permits an expression
  245. to be written without the use of parentheses, while remaining
  246. totally un-ambiguous. For example, the expression -
  247.  
  248.           ( 2 + 4 ) * ( 7 - 3 )
  249.  
  250. would be written, or stored as -
  251.  
  252.             2  4  +  7  3  -  * 
  253.  
  254. To evaluate this, the expression is scanned from left to right, and 
  255. any values found removed and placed aside on a stack (i.e. a heap or 
  256. pile). When an operator is found, the required number of values are 
  257. retrieved from the stack (last on, first off), the operation carried 
  258. out on them, and the result put back on the stack. This system is 
  259. continued to the end of the expression.
  260.  
  261. Thus in the above case, 2 and then 4 are placed on the stack before 
  262. the '+' operator is found. These values are then retrieved and the
  263. addition carried out. The result, 6, is then placed back on the 
  264. stack. 
  265.  
  266. Then 7 and 3 are found in turn and placed on top of the 6. At this 
  267. point a '-' operator is found, so the last two values, 7 and 3, are
  268. retrieved and the result of the subtraction, 4, is placed back on 
  269. the stack, as before.
  270.  
  271. At this point the stack now has a 4 on top of 6, so when the last 
  272. operator is found, the '*', these two numbers are multiplied together 
  273. and the result, now the final answer, 24, is placed back on the 
  274. stack.
  275.  
  276. Notice that whenever an operator is found, only the required number of
  277. values are unstacked, so that the system works equally well for unary
  278. operators such as x! or sin(x), as for binary ('+' '/' etc) or other 
  279. operators.
  280.  
  281. The system may be extended to include multi-parameter functions, such
  282. as function( a, b, c ). Which is simply written -
  283.  
  284.                        a  b  c  function
  285.  
  286. It is also possible to include programming constructs, such as
  287. if-then-else, repeat, etc, as is done in Forth and Postscript.
  288.  
  289. Note also that the notation does not require any knowledge of operator
  290. priority.  Operators are always executed when found, using however
  291. many values are needed.
  292.  
  293. The Functions.
  294. =============
  295.  
  296. This section gives full descriptions of each available function,
  297. for each calculator button.   
  298.  
  299. In all cases, X, or X and Y where appropriate, are unstacked, and 
  300. the result placed in X, unless otherwise stared.
  301.  
  302. Use of the SELECT mouse button is assumed where not stated.
  303.  
  304.  
  305. The stack manipulations.
  306.  
  307. [Enter]  Causes the stack to rise.
  308.          SELECT Clears the X register
  309.          ADJUST Preserves the X register.
  310.  
  311. [⇩]      SELECT Rotates the stack downwards.
  312.          ADJUST Rotates the stack upwards.
  313.                 In both cases end values are wrapped around.
  314.  
  315. [X⇧ Y⇩]  Swaps the X and Y register values.  
  316.          The stack does not rise.
  317.  
  318.  
  319. Simple Arithmetic.
  320.  
  321. [-]  Subtract.  Computes Y - X
  322.  
  323. [+]  Add.       Computes Y + X
  324.  
  325. [×]  Multiply.  Computes Y * X
  326.  
  327. [÷]  Divide.    Computes Y ÷ X
  328.  
  329.  
  330. Functions of X.
  331.  
  332. [x!]   Factorial. Computes  x * (x-1) * (x-2) * (x-3) ... * 2 * 1
  333.  
  334.        e.g.  to compute factorial 10, key in -
  335.                 [10] [x!]    result 3628800
  336.  
  337.  
  338. [1/x]  Reciprocal.  Computes 1 ÷ x
  339.  
  340.        e.g.  to compute 1 / e,  key in -
  341.                 [e] [1/x]    result  0.37
  342.  
  343.  
  344. [x^y]  Powers.  ( Actual legend not reproducible here)
  345.        SELECT   Computes X the the power of Y
  346.        ADJUST   Computes Y the the power of X
  347.  
  348. [x²]   Squares. 
  349.        SELECT   Computes x * x
  350.        ADJUST   Computes the square root of x
  351.  
  352.  
  353. Miscellaneous Functions.
  354.  
  355. [±]    Changes the sign of X.  i.e. -x becomes x, and x becomes -x
  356.  
  357. [Int]  Integer.
  358.        SELECT   Computes the integer part of x, removing fractions.
  359.        ADJUST   Computes the fractional part of x.
  360.  
  361. [Abs]  Absolute Computes |x| i.e. Removes any -ve sign.
  362.  
  363.  
  364. Logarithms.
  365.  
  366. [Log]  SELECT  Computes the log to base 10.
  367.        ADJUST  Computes the anti-log to base 10.
  368.  
  369. [Ln]   SELECT  Computes the log to base E.
  370.        ADJUST  Computes the anti-log to base E.
  371.  
  372.  
  373. Trig Functions.
  374.  
  375. [Sin]  SELECT  Computes sine(x)
  376.        ADJUST  Computes angle whose sine is x
  377.  
  378. [Cos]  SELECT  Computes cos(x)
  379.        ADJUST  Computes angle whose cosine is x
  380.  
  381. [Tan]  SELECT  Computes tan(x)
  382.        ADJUST  Computes angle whose tangent is x
  383.  
  384.  
  385. Hyperbolic Functions.
  386.  
  387. [Sinh] SELECT  Computes sinh(x)
  388.        ADJUST  Computes inverse of sinh(x)
  389.  
  390. [Cosh] SELECT  Computes cosh(x)
  391.        ADJUST  Computes inverse of cosh(x)
  392.  
  393. [Tanh] SELECT  Computes tanh(x)
  394.        ADJUST  Computes inverse of tanh(x)
  395.  
  396.  
  397. Other Functions.
  398.  
  399. [Polar]  This function produces two result values.
  400.  
  401.          SELECT Computes polar from cartesian co-ordinates.
  402.                     X = Sqrt( x*x + y*y )
  403.                     Y = angle whose tangent is Y ÷ X
  404.  
  405.          e.g.   Given a 3, 4, 5 triangle, key in -
  406.                    [3] [Enter] [4] [Polar]   results in -
  407.                     X = 5,  the (hypotenuse)
  408.                     Y = 36.87°
  409.  
  410.          ADJUST Computes cartesian from polar co-ordinates.
  411.                     X = x * cos(y)
  412.                     Y = x * sin(y)
  413.  
  414.  
  415. [H.MS]   Hours, Minutes and Seconds Conversion.
  416.          The display should be set to Fixed point, 4 decimal places
  417.          to use this function.
  418.  
  419.          SELECT Computes hrs, mins, secs from decimal hrs.
  420.                 i.e. result X = H.MMSS  where MM == Minutes, SS == Seconds.
  421.  
  422.          e.g.   Given 12.56 hrs,  key in -
  423.                 [12.56] [H.MMSS]   results in 12.3336  
  424.                 i.e. 12 hrs 33 mins 36 secs.
  425.    
  426.  
  427.          ADJUST Computes the inverse, converting hrs, mins, secs  to hrs.
  428.  
  429.          e.g. Map reference 12° 18', key in -
  430.  
  431.                [12.18]  ADJUST [H.MMSS]    results in 12.30°
  432.  
  433.  
  434. [yCx]    Combinations and Permutations.
  435.  
  436.          SELECT Computes the number of possible combinations of Y objects
  437.                 taken X at a time, where order is unimportant.
  438.  
  439.          e.g.   To compute the number of ways to select 8 objects from a
  440.                 total of 12, key in -
  441.  
  442.                 [12] [Enter] [8] [yCx],  result 495.
  443.  
  444.          N.B.   This is how to compute (so called) permutations on your
  445.                 Pools coupon. These are really Combinations, as order is
  446.                 not important.
  447.  
  448.          ADJUST Computes the number of possible permutations of Y objects
  449.                 taken X at a time, where order IS important.
  450.  
  451.          e.g.   Taking the above example, key in -
  452.  
  453.                 [12] [Enter] [8] ADJUST [yCx],   result 19,958,400
  454.  
  455.  
  456. More Complex Examples.
  457. =====================
  458.  
  459. 1.  A laser range finder gives the distance to the top of a building as
  460.     97.66 meters at an elevation of 12° 25'. Compute the height of the
  461.     building, and its horizontal distance.
  462.  
  463.     We must first convert the angle to decimal degrees, then enter the 
  464.     angular distance and convert to cartesian co-ordinates.
  465.  
  466.     key in -   [12.25]  ADJUST [H.MS]  [97.66]  ADJUST [POLAR]
  467.  
  468.     Results are  X = 95.38,  the horizontal distance.
  469.                  Y = 21.00,  the vertical height of the building.
  470.  
  471.  
  472. 2.  Compute the roots of the equation:  3x² - 9x + 6 = 0
  473.  
  474.     Given the equation  -b ± €(b² - 4ac)   i.e.  a = 3,  b = -9,  c = 6
  475.                         ----------------
  476.                               2a
  477.  
  478.     This example demonstrates the use of the internal storage registers
  479.     as well as some stack manipulation, all of which eliminates the 
  480.     need to remember intermediate results, and the necessity to enter
  481.     the same value more than once.
  482.  
  483.     The best way of tackling a problem like this is to start in the
  484.     middle, with the most complex part, like the inner root function.
  485.  
  486.     Buttons          Action                    Stack
  487.     =======          ======================    ======================
  488.     [9]              value -b                   9
  489.     [Store] [1]      We will need this later    0
  490.     [x²]             compute b²                81
  491.     [4]              enter 4                    4  81
  492.     [Enter]          push the stack up              4  81
  493.     [3]              value a                    3   4  81
  494.     [Store] [2]      We will need this again    3   4  81
  495.     [x]              compute 4a                12  81
  496.     [6]              value c                    6  12  81
  497.     [x]              compute 4ac               72  81
  498.     [-]              compute b² - 4ac           9
  499.     Adj [x²]         compute sqr root.          3
  500.     Adj [Enter]      duplicate value            3   3
  501.     Adj [Store] [1]  recall -b                  9   3   3
  502.     [+]              compute -b + (b² - 4ac)   12   3
  503.     Adj [Store] [2]  recall a                   3  12   3
  504.     [2]              value 2                    2   3  12   3
  505.     [x]              compute 2a                 6  12   3
  506.     [÷]              First result = 2           2   3
  507.     [⇩]              loose result               3
  508.     Adj [Store] [1]  recall -b                  9   3
  509.     [x⇧ y⇩]          swap values over           3   9
  510.     [-]              compute -b - (b² - 4ac)    6
  511.     Adj [Store] [2]  recall a                   3   6
  512.     [2]              value 2                    2   3   6
  513.     [x]              compute 2a                 6   6
  514.     [÷]              Second result = 1          1
  515.  
  516. Hence, the roots are x = 1 and x = 2.
  517.  
  518. There may be shorter ways of doing this. Note that we stored -b and a 
  519. values for later use. In this simple contrived example this may have
  520. been pointless, as they could easily be re-entered. However, in a real
  521. example these values may have had 9 or more digits, so that storing
  522. them would be a real time saver.
  523.  
  524. If the inner function had been negative indicating complex roots, we
  525. would have had to proceed slightly differently.
  526.  
  527.  
  528.  
  529. End.
  530.  
  531.