home *** CD-ROM | disk | FTP | other *** search
-
-
-
- R P S C 1.1
-
- Reverse Polish Scientific Calculator
-
-
- Copyright 1989
-
- by
-
- Gary Teachout
-
-
-
-
- A programable RPN calculator in the Hewlett-Packard tradition
-
-
-
-
- Contents:
-
- Introduction
- Reverse Polish Notation
- Programs and User Defined Functions
- Summary of Functions and Operations
- Stack
- Modes
- Storage
- Arithmetic
- Programing
- Control
- Files
- Errors and Messages
- Freeware
-
-
- Introduction:
-
- RPSC is a programable reverse polish notation calculator for
- the Amiga which may be run from the Workbench or the CLI.
- It suports operations with real numbers, complex numbers,
- matrices, and 3-D vectors. As well as storage and recall of
- labeled variables. Data and programs may be saved to, loaded from,
- or writen as ASCII text to AmigaDOS files. It uses the Intuition
- user interface of Gadgets and Menus. The numeric keypad as well as
- the letters and symbols to the right of each function gadget
- may be used as keybord alternatives.
-
- RPSC may be terminated at any time by pressing the escape key
- or selecting the Esc button.
-
-
- Reverse Polish Notation:
-
- In Reverse Polish Notation ( RPN ) also called postfix notation
- numbers are specified before the operation to be performed.
- For example the sum of five and seven could be written:
-
- 5 + 7 algebra or infix notation.
- + 5 7 polish or prefix notation.
- 5 7 + reverse polish or postfix notation.
-
- The advantage of RPN is apparent in the more complex example:
-
- ( 141 + 15 ) / ( ( 3 * 11 ) - 21 ) algebra
- 141 15 + 3 11 * 21 - / RPN
-
- To perform this on an algebraic calculator requires that you
- store the result of some operations while performing others.
- On an RPN calculator it may be keyed in as is using the ENTER
- key or an operation to separate numbers:
-
- 1 4 1 ENTER 1 5 + 3 ENTER 1 1 * 2 1 - /
-
- The result ( 13 in this case ) is displayed and is available
- to further operations.
-
- RPSC stores numbers in a group of four registers known as
- the "stack". The registers are labeled "x", "y", "z" and "t".
- Each register may contain a real number, a complex number, or
- the descriptor of a matrix or vector. Input numbers are keyed into
- the x register. A push operation loads the x register and copies the
- previous contents of each register up to the next register. The
- previous contents of the t register are discarded. A pull or pop
- operation removes the contents of the x register and copies the
- previous contents of each register down to the next register. The
- t register is unchanged. Inputs to each operation are popped off the
- stack, the operation is performed, and the result is pushed back on
- to the stack.
-
-
- Programs and User Defined Functions:
-
- Almost any sequence of operations may be entered as a program.
- Programs must begin with a label and should end with a return.
- The usual way to run a program is gosub followed by the label of the
- program.
-
- User defined functions are programs that accept a single input and
- return a single result. User defined functions can expect the stack
- to be filled with the input variable. Such programs may be evaluated
- ( Extra 0 ), graphed ( Extra 1 ), numerically integrated ( integ. ),
- or numerically solved ( solve ). These operations first fill the stack
- with the input variable then call the function as a subroutine.
-
-
- Summary of Functions and Operations:
-
- Stack:
-
- Enter Push x make room for next input.
- E exp Enter exponent
- E im Enter imaginary portion of complex number.
- <--- Clear x make room for next input.
- pop Pop x off of stack and discard.
- up Rotate stack up.
- down Rotate stack down.
- x <-> y Swap x and y.
- a <-> b Swap real and imaginary portions of x.
-
- Modes:
-
- degrees Interpret angles as degrees.
- radians Interpret angles as radians.
-
- fixed
- 1 - 9 Display numbers in fixed point notation.
- sci
- 1 - 9 Display numbers in scientific notation.
- 1 - 9 Number of digits precision.
-
- complex Initiate complex mode. Show complex stack.
- real Terminate complex mode.
-
- fast Speed up programs by turning off the display.
- slow Terminate fast mode. Display normal.
-
- program Enter or exit program mode.
-
- Storage:
-
- Any button with a letter to its right may be used
- as a label to identify a variable.
- Storage operations must be followed by a label.
-
- dim Define variable as matrix of dimension x * y.
- If x = 0 or y = 0 undimension.
- rcl M Recall Matrix and push descriptor on to stack.
- result Specify variable to receive matrix result.
- store I Store x in matrix index.
- rcl I Recall matrix index into x.
- store If label specifies a matrix store x into the
- indexed element then increment index.
- If not a matrix store x at label.
- rcl If label specifies a matrix recall the
- indexed element into x then increment index.
- If not a matrix recall from label into x.
- rcl-(I) If label specifies a matrix decrement index then
- recall the indexed element into x.
- If not a matrix recall from label into x.
-
- Arithmetic:
-
- + Add numbers or like matrices.
- - Subtract numbers or like matrices.
- * Multiply numbers or compatible matrices.
- Scale matrix or vector.
- / Divide numbers.
-
- int Integer portion of real x.
- frac Fractional portion of real x.
- abs Absolute value of real x.
- Magnitude of complex, vector, or matrix.
- chs± Change sign of real x.
- mod Modulus remainder after division.
- % Percent.
- x ! Factorial x or Gamma of ( x + 1 ) .
- 1 / x Invert.
- x 1/2 Square root or x to the power 1/2.
- y 1/x x root of y.
- x ² x squared.
-
- sin Sine.
- cos Cosine.
- tan Tangent.
- sin -1 Inverse Sine.
- cos -1 Inverse Cosine.
- tan -1 Inverse Tangent.
-
- sinh Hyperbolic Sine.
- cosh Hyperbolic Cosine.
- tanh Hyperbolic Tangent.
- sinh -1 Inverse Hyperbolic Sine.
- cosh -1 Inverse Hyperbolic Cosine.
- tanh -1 Inverse Hyperbolic Tangent.
-
- y^x y to the power x.
- e^x e to the power x.
- 10^x 10 to the power x.
- logx y Base x Logarithm of y.
- loge x Base e Logarithm of x. Natural Logarithm.
- log10 x Base 10 Logarithm of x. Common Logarithm.
-
- random Random number between 0 and 0.999...
- e Natural Logarithm base = 2.7182818...
- pi Pi = 3.1415926...
-
- These must be followed by a digit.
-
- Vector A vector may be any three element matrix.
- An orthogonal basis is a three by three matrix where
- each row is a perpendicular unit vector here
- labeled I, J, and K.
- 0 Vector sum y + x.
- 1 Vector difference y - x.
- 2 Vector product y dot x.
- 3 Vector product y cross x.
- 4 Angle between two vectors.
- 5 Project vector y into basis x.
- 6 Rotate y basis vectors I J angle x.
- 7 Rotate y basis vectors J K angle x.
- 8 Rotate y basis vectors K I angle x.
- Rotate operations act directly on the basis y.
-
- Matrix
- 0 x = transpose of x.
- 1 Result = transpose of x.
- 2 x = inverse of x.
- 3 Result = inverse of x.
- 4 x = determinant of x.
- 5 Result = copy of x.
- All of these accept one matrix as input.
-
- Extra The first two of these must be followed by the label
- of a user defined function.
- 0 Compute user defined function F(x).
- 1 Display graph of user defined function.
- top of display = t
- bottom of display = z
- left edge of display = y
- right edge of display = x
- 2 Time in hours since midnight.
-
- Convert
- 0 Polar coordinates to rectangular.
- 1 Rectangular coordinates to polar.
- In polar coordinates x = magnitude y = angle.
- 2 Degrees to radians.
- 3 Radians to degrees.
- 4 Gradians to radians.
- 5 Radians to gradians.
- 6 Hours to hours minutes seconds.
- 7 Hours minutes seconds to hours.
-
- Programing:
-
- Programs in RPSC consist of almost any sequence of
- key strokes. While in program mode all but the
- following will be recorded as part of the program.
-
- The up and down arrow keys may be used to scroll
- through the program. Shift up and down arrow keys
- scroll ten lines at a time.
-
- program Enter or exit program mode.
- When you exit program mode the program is scanned
- for labeled entry points.
-
- forward Scroll forward through program one line.
- Same as curser down.
- back Scroll backward through program one line.
- Same as curser up.
-
- del Delete line from program.
- clr pgm Delete entire program.
-
- Control:
-
- label Mark entry point in program.
- Must by followed by a valid label.
-
- goto Jump to entry point. Must by followed by a valid label.
- May be used to start a program.
-
- gosub Subroutine call. Must by followed by a valid label.
- May be used to start a program.
-
- return Return from subroutine.
-
- stop Terminates program execution.
-
- integ. Numerical integration of a user defined function over
- the interval y to x. Must by followed by a valid label.
- Results
- x = integral
- y = uncertainty
-
- solve Numerical solve. Find a root of a user defined function.
- Must by followed by a valid label.
- Inputs
- first guess = y
- second guess = x
- Results
- x = root
- y = F(x) If y is negligible or zero then x is
- a root. If not then x is where | F(x) |
- has a local minimum.
-
- If these test operations fail, the next operation
- will be skipped. If they are true, they have no effect.
-
- set f
- 0 - 7 Set flag number 0 - 7.
- 9 Set user program error.
- clear f
- 0 - 7 Clear flag number 0 - 7.
- 9 Clear user program error.
- f ?
- 0 - 9 Test flag number 0 - 9. Flags 0 - 7 same as above.
- Flag number 8 tests for complex mode.
- Flag number 9 tests for user program error.
-
- x <> 0 x not equal to 0.
- x > 0 x more than 0.
- x < 0 x less than 0.
- x >= 0 x more than or equal to 0.
- x <= 0 x less than or equal to 0.
- x = y x equal to y.
- x <> y x not equal to y.
- x > y x more than y.
- x < y x less than y.
- x >= y x more than or equal to y.
-
-
- Files:
-
- The File Access menu contains the following
- operations. They present a file name requester
- where you may enter a file name or cancel the
- operation. Operations that write ASCII text
- may be directed to a printer by entering PRT:
- as a file name. All of these may be included
- in programs, however, those that load programs
- will be ignored at run time.
-
- join program Add program from file to end of existing
- program.
-
- load program Load program from file writing over existing
- program.
-
- load x Load x register from file. If file contains
- a matrix load result.
-
- load storage Load all storage variables from file.
-
- save program Save copy of program.
-
- save x Save copy of x register.
-
- save storage Save copy of all storage variables.
-
- list program Save program as ASCII text.
-
- write x Save x as ASCII text. If x is a matrix each
- element will be separated by a comma ","
- and a line feed. Such a list may be pasted
- into documents and programs.
-
- write strip Opens a file and begins writing an ASCII
- record of each operation that follows.
-
- disable strip Closes file opened by write strip.
-
-
- Errors and Messages:
-
- Messages appear in the screen title bar and remain until
- another operation is performed.
-
- Numerical errors such as "divide by zero" are not fatal
- and will not interfere with program execution. The results
- however, may be undesirable.
-
- Nonsense errors such as "incorrect type" ( example: trying to
- take the integer portion of a matrix ) or "file error" ( file not
- found or volume is full ) are fatal and will stop a program.
-
- User program error ( set f 9 ) is not displayed until the
- end of a program.
-
-
- Freeware:
-
- You are welcome to copy this program for all of your friends.
-
-
- Gary Teachout
- 10532 66 place W
- Everett Wa 98204
-
-