home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff250.lzh / RPSC / RPSC.doc < prev    next >
Text File  |  1989-09-16  |  15KB  |  405 lines

  1.  
  2.  
  3.  
  4.                               R P S C     1.1
  5.  
  6.                  Reverse   Polish   Scientific   Calculator
  7.  
  8.  
  9.                              Copyright    1989
  10.                                              
  11.                                     by
  12.  
  13.                               Gary   Teachout
  14.  
  15.  
  16.  
  17.  
  18.       A programable RPN calculator in the Hewlett-Packard tradition
  19.  
  20.  
  21.  
  22.  
  23.  Contents:
  24.  
  25.    Introduction
  26.    Reverse Polish Notation
  27.    Programs and User Defined Functions
  28.    Summary of Functions and Operations
  29.       Stack
  30.       Modes
  31.       Storage
  32.       Arithmetic
  33.       Programing
  34.       Control
  35.       Files
  36.    Errors and Messages
  37.    Freeware
  38.  
  39.  
  40.  Introduction:
  41.  
  42.       RPSC is a programable reverse polish notation calculator for
  43.    the Amiga which may be run from the Workbench or the CLI.
  44.    It suports operations with real numbers, complex numbers,
  45.    matrices, and 3-D vectors. As well as storage and recall of
  46.    labeled variables. Data and programs may be saved to, loaded from,
  47.    or writen as ASCII text to AmigaDOS files. It uses the Intuition
  48.    user interface of Gadgets and Menus. The numeric keypad as well as
  49.    the letters and symbols to the right of each function gadget
  50.    may be used as keybord alternatives.
  51.  
  52.       RPSC may be terminated at any time by pressing the escape key
  53.    or selecting the Esc button.
  54.  
  55.  
  56.  Reverse Polish Notation:
  57.  
  58.       In Reverse Polish Notation ( RPN ) also called postfix notation
  59.    numbers are specified before the operation to be performed.
  60.    For example the sum of five and seven could be written:
  61.  
  62.                5  +  7           algebra or infix notation.
  63.                +  5  7           polish or prefix notation.
  64.                5  7  +           reverse polish or postfix notation.
  65.  
  66.    The advantage of RPN is apparent in the more complex example:
  67.  
  68.                ( 141 + 15 ) / ( ( 3 * 11 ) - 21 )         algebra
  69.                141  15  +  3  11  *  21  -  /             RPN
  70.  
  71.    To perform this on an algebraic calculator requires that you
  72.    store the result of some operations while performing others.
  73.    On an RPN calculator it may be keyed in as is using the ENTER
  74.    key or an operation to separate numbers:
  75.  
  76.          1 4 1  ENTER  1 5  +  3  ENTER  1 1  *  2 1  -  /
  77.  
  78.    The result ( 13 in this case ) is displayed and is available
  79.    to further operations.
  80.  
  81.       RPSC stores numbers in a group of four registers known as
  82.    the "stack". The registers are labeled "x", "y", "z" and "t".
  83.    Each register may contain a real number, a complex number, or
  84.    the descriptor of a matrix or vector. Input numbers are keyed into
  85.    the x register. A push operation loads the x register and copies the
  86.    previous contents of each register up to the next register. The
  87.    previous contents of the t register are discarded. A pull or pop
  88.    operation removes the contents of the x register and copies the
  89.    previous contents of each register down to the next register. The
  90.    t register is unchanged. Inputs to each operation are popped off the
  91.    stack, the operation is performed, and the result is pushed back on
  92.    to the stack.
  93.  
  94.  
  95.  Programs and User Defined Functions:
  96.  
  97.       Almost any sequence of operations may be entered as a program.
  98.    Programs must begin with a label and should end with a return.
  99.    The usual way to run a program is gosub followed by the label of the
  100.    program.
  101.  
  102.       User defined functions are programs that accept a single input and
  103.    return a single result. User defined functions can expect the stack
  104.    to be filled with the input variable. Such programs may be evaluated
  105.    ( Extra 0 ), graphed ( Extra 1 ), numerically integrated ( integ. ),
  106.    or numerically solved ( solve ). These operations first fill the stack
  107.    with the input variable then call the function as a subroutine.
  108.  
  109.  
  110.  Summary of Functions and Operations:
  111.  
  112.    Stack:
  113.  
  114.       Enter       Push x make room for next input.
  115.       E  exp      Enter exponent
  116.       E  im       Enter imaginary portion of complex number.
  117.       <---        Clear x make room for next input.
  118.       pop         Pop x off of stack and discard.
  119.       up          Rotate stack up.
  120.       down        Rotate stack down.
  121.       x <-> y     Swap x and y.
  122.       a <-> b     Swap real and imaginary portions of x.
  123.  
  124.    Modes:
  125.  
  126.       degrees     Interpret angles as degrees.
  127.       radians     Interpret angles as radians.
  128.  
  129.       fixed
  130.          1 - 9    Display numbers in fixed point notation.
  131.       sci
  132.          1 - 9    Display numbers in scientific notation.
  133.                   1 - 9    Number of digits precision.
  134.  
  135.       complex     Initiate complex mode. Show complex stack.
  136.       real        Terminate complex mode.
  137.  
  138.       fast        Speed up programs by turning off the display.
  139.       slow        Terminate fast mode. Display normal.
  140.  
  141.       program     Enter or exit program mode.
  142.  
  143.    Storage:
  144.  
  145.                   Any button with a letter to its right may be used
  146.                   as a label to identify a variable.
  147.                   Storage operations must be followed by a label.
  148.  
  149.       dim         Define variable as matrix of dimension x * y.
  150.                   If x = 0 or y = 0 undimension.
  151.       rcl  M      Recall Matrix and push descriptor on to stack.
  152.       result      Specify variable to receive matrix result.
  153.       store I     Store x in matrix index.
  154.       rcl   I     Recall matrix index into x.
  155.       store       If label specifies a matrix store x into the
  156.                   indexed element then increment index.
  157.                   If not a matrix store x at label.
  158.       rcl         If label specifies a matrix recall the
  159.                   indexed element into x then increment index.
  160.                   If not a matrix recall from label into x.
  161.       rcl-(I)     If label specifies a matrix decrement index then
  162.                   recall the indexed element into x.
  163.                   If not a matrix recall from label into x.
  164.  
  165.    Arithmetic:
  166.  
  167.       +           Add numbers or like matrices.
  168.       -           Subtract numbers or like matrices.
  169.       *           Multiply numbers or compatible matrices.
  170.                   Scale matrix or vector.
  171.       /           Divide numbers.
  172.  
  173.       int         Integer portion of real x.
  174.       frac        Fractional portion of real x.
  175.       abs         Absolute value of real x.
  176.                   Magnitude of complex, vector, or matrix.
  177.       chs±        Change sign of real x.
  178.       mod         Modulus remainder after division.
  179.       %           Percent.
  180.       x !         Factorial x or Gamma of ( x + 1 ) .
  181.       1 / x       Invert.
  182.       x 1/2       Square root or x to the power 1/2.
  183.       y 1/x       x root of y.
  184.       x ²         x squared.
  185.  
  186.       sin         Sine.
  187.       cos         Cosine.
  188.       tan         Tangent.
  189.       sin -1      Inverse Sine.
  190.       cos -1      Inverse Cosine.
  191.       tan -1      Inverse Tangent.
  192.  
  193.       sinh        Hyperbolic Sine.
  194.       cosh        Hyperbolic Cosine.
  195.       tanh        Hyperbolic Tangent.
  196.       sinh -1     Inverse Hyperbolic Sine.
  197.       cosh -1     Inverse Hyperbolic Cosine.
  198.       tanh -1     Inverse Hyperbolic Tangent.
  199.  
  200.       y^x         y to the power x.
  201.       e^x         e to the power x.
  202.       10^x        10 to the power x.
  203.       logx y      Base x Logarithm of y.
  204.       loge x      Base e Logarithm of x. Natural Logarithm.
  205.       log10 x     Base 10 Logarithm of x. Common Logarithm.
  206.  
  207.       random      Random number between 0 and 0.999...
  208.       e           Natural Logarithm base  = 2.7182818...
  209.       pi          Pi = 3.1415926...
  210.  
  211.                   These must be followed by a digit.
  212.  
  213.       Vector      A vector may be any three element matrix.
  214.                   An orthogonal basis is a three by three matrix where
  215.                   each row is a perpendicular unit vector here
  216.                   labeled I, J, and K.
  217.          0        Vector sum           y + x.
  218.          1        Vector difference    y - x.
  219.          2        Vector product       y dot x.
  220.          3        Vector product       y cross x.
  221.          4        Angle between two vectors.
  222.          5        Project vector y into basis x.
  223.          6        Rotate y basis vectors I J angle x.
  224.          7        Rotate y basis vectors J K angle x.
  225.          8        Rotate y basis vectors K I angle x.
  226.                   Rotate operations act directly on the basis y.
  227.  
  228.       Matrix
  229.          0        x = transpose of x.
  230.          1        Result = transpose of x.
  231.          2        x = inverse of x.
  232.          3        Result = inverse of x.
  233.          4        x = determinant of x.
  234.          5        Result = copy of x.
  235.                   All of these accept one matrix as input.
  236.  
  237.       Extra       The first two of these must be followed by the label
  238.                   of a user defined function.
  239.          0        Compute user defined function F(x).
  240.          1        Display graph of user defined function.
  241.                      top of display            = t
  242.                      bottom of display         = z
  243.                      left edge of display      = y
  244.                      right edge of display     = x
  245.          2        Time in hours since midnight.
  246.  
  247.       Convert
  248.          0        Polar coordinates to rectangular.
  249.          1        Rectangular coordinates to polar.
  250.                   In polar coordinates x = magnitude y = angle.
  251.          2        Degrees to radians.
  252.          3        Radians to degrees.
  253.          4        Gradians to radians.
  254.          5        Radians to gradians.
  255.          6        Hours to hours minutes seconds.
  256.          7        Hours minutes seconds to hours.
  257.  
  258.    Programing:
  259.  
  260.                   Programs in RPSC consist of almost any sequence of
  261.                   key strokes. While in program mode all but the
  262.                   following will be recorded as part of the program.
  263.  
  264.                   The up and down arrow keys may be used to scroll
  265.                   through the program. Shift up and down arrow keys
  266.                   scroll ten lines at a time.
  267.  
  268.       program     Enter or exit program mode.
  269.                   When you exit program mode the program is scanned
  270.                   for labeled entry points.
  271.  
  272.       forward     Scroll forward through program one line.
  273.                   Same as curser down.
  274.       back        Scroll backward through program one line.
  275.                   Same as curser up.
  276.  
  277.       del         Delete line from program.
  278.       clr pgm     Delete entire program.
  279.  
  280.    Control:
  281.  
  282.       label       Mark entry point in program.
  283.                   Must by followed by a valid label.
  284.  
  285.       goto        Jump to entry point. Must by followed by a valid label.
  286.                   May be used to start a program.
  287.  
  288.       gosub       Subroutine call. Must by followed by a valid label.
  289.                   May be used to start a program.
  290.  
  291.       return      Return from subroutine.
  292.  
  293.       stop        Terminates program execution.
  294.  
  295.       integ.      Numerical integration of a user defined function over
  296.                   the interval y to x. Must by followed by a valid label.
  297.                   Results
  298.                      x = integral
  299.                      y = uncertainty
  300.  
  301.       solve       Numerical solve. Find a root of a user defined function.
  302.                   Must by followed by a valid label.
  303.                   Inputs
  304.                      first guess       = y
  305.                      second guess      = x
  306.                   Results
  307.                      x = root
  308.                      y = F(x)    If y is negligible or zero then x is
  309.                                  a root. If not then x is where  | F(x) |
  310.                                  has a local minimum.
  311.  
  312.                   If these test operations fail, the next operation
  313.                   will be skipped. If they are true, they have no effect.
  314.  
  315.       set   f
  316.          0 - 7    Set flag number 0 - 7.
  317.          9        Set user program error.
  318.       clear f
  319.          0 - 7    Clear flag number 0 - 7.
  320.          9        Clear user program error.
  321.       f ?
  322.          0 - 9    Test flag number 0 - 9. Flags 0 - 7 same as above.
  323.                   Flag number 8 tests for complex mode.
  324.                   Flag number 9 tests for user program error.
  325.  
  326.       x <> 0      x not equal to 0.
  327.       x > 0       x more than 0.
  328.       x < 0       x less than 0.
  329.       x >= 0      x more than or equal to 0.
  330.       x <= 0      x less than or equal to 0.
  331.       x = y       x equal to y.
  332.       x <> y      x not equal to y.
  333.       x > y       x more than y.
  334.       x < y       x less than y.
  335.       x >= y      x more than or equal to y.
  336.  
  337.  
  338.    Files:
  339.  
  340.                         The File Access menu contains the following
  341.                         operations. They present a file name requester
  342.                         where you may enter a file name or cancel the
  343.                         operation. Operations that write ASCII text
  344.                         may be directed to a printer by entering PRT:
  345.                         as a file name. All of these may be included
  346.                         in programs, however, those that load programs
  347.                         will be ignored at run time.
  348.  
  349.       join program      Add program from file to end of existing
  350.                         program.
  351.  
  352.       load program      Load program from file writing over existing
  353.                         program.
  354.  
  355.       load x            Load x register from file. If file contains
  356.                         a matrix load result.
  357.  
  358.       load storage      Load all storage variables from file.
  359.  
  360.       save program      Save copy of program.
  361.  
  362.       save x            Save copy of x register.
  363.  
  364.       save storage      Save copy of all storage variables.
  365.  
  366.       list program      Save program as ASCII text.
  367.  
  368.       write x           Save x as ASCII text. If x is a matrix each
  369.                         element will be separated by a comma ","
  370.                         and a line feed. Such a list may be pasted
  371.                         into documents and programs.
  372.  
  373.       write strip       Opens a file and begins writing an ASCII
  374.                         record of each operation that follows.
  375.  
  376.       disable strip     Closes file opened by write strip.
  377.  
  378.  
  379.  Errors and Messages:
  380.  
  381.       Messages appear in the screen title bar and remain until
  382.    another operation is performed.
  383.  
  384.       Numerical errors such as "divide by zero" are not fatal
  385.    and will not interfere with program execution. The results
  386.    however, may be undesirable.
  387.  
  388.       Nonsense errors such as "incorrect type" ( example: trying to
  389.    take the integer portion of a matrix ) or "file error" ( file not
  390.    found or volume is full ) are fatal and will stop a program.
  391.  
  392.       User program error ( set f  9 ) is not displayed until the
  393.    end of a program.
  394.  
  395.  
  396.  Freeware:
  397.  
  398.       You are welcome to copy this program for all of your friends.
  399.  
  400.  
  401.             Gary Teachout
  402.             10532   66 place   W
  403.             Everett   Wa   98204
  404.  
  405.