home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d103 / calc.lha / Calc / Calc.doc < prev    next >
Text File  |  1987-10-22  |  41KB  |  789 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.                             ******************
  22.                             *****  CALC  *****
  23.                             *  Version 1.00  *
  24.                             *  by Bob Brooks *
  25.                             * Copyright 1987 *
  26.                             ==================
  27.                             User Documentation
  28.                             ******************
  29.  
  30.           1) Introduction
  31.              Congratulations!  You are now the owner of CALC, a highly
  32.              programmable calculator program with similarities to a 
  33.              hand-held RPN calculator but with much more power.  CALC
  34.              allows you to operate in either an interactive mode
  35.              (entering commands from the keyboard directly) or by
  36.              pre-defined programs which you have written and stored in
  37.              disk files.  CALC provides the user with four work 
  38.              registers (X, Y, Z, T) and 100 long-term storage registers
  39.              (numbered 00 through 99).  This version of CALC provides
  40.              the following functions:
  41.  
  42.                  1) Arithmetic
  43.                  2) Exponentiation
  44.                  3) Logarithms
  45.                  4) Trigonometry
  46.                  5) Factorials
  47.                  6) Square-root
  48.                  7) Integer and Fractional portions of numbers
  49.                  8) Time/Angle conversions
  50.                  9) Reciprocal
  51.                 10) Rounding-off numbers
  52.                 11) Hyperbolic functions
  53.                 12) Direct register manipulation
  54.  
  55.              Whether you need an answer to a quick computation or want 
  56.              to run a long and complicated program, CALC can handle it.
  57.              However, this version of CALC only operates from CLI.  To
  58.              execute CALC from CLI, you need only type
  59.  
  60.                              CALC
  61.  
  62.              from the CLI prompt.  CALC will then begin running.
  63.  
  64.              CALC can actually be thought of as a mathmatical programm-
  65.              ing language.  Its command structure is very simple with,
  66.              as is true of any programming language, a fairly strict
  67.              syntax for those commands.  Every attempt has been made to
  68.              name the commands so that their name describes what they do.
  69.              All of its number munching and crunching is performed in
  70.              double precision for extreme accuracy even with very large
  71.              and very small numbers.  Variable output formats allow you 
  72.              to see the 15 most significant digits in all four work
  73.              registers.  Numbers larger than 15 digits or too small to
  74.              show in 15 decimal places are displayed in exponential
  75.              format.  A small set of commands provide direct control of 
  76.              CALC, making it possible to tell CALC from where it should 
  77.              get its input and how to handle output.  A brief online
  78.              Help menu is available which gives a short description of
  79.              each CALC command.  
  80.  
  81.              Section 2 of this document will explain what each command is 
  82.              and does.  The third section will explain how to use CALC in 
  83.              both the Keyboard and File modes, including how to build a 
  84.              program file on disk.  Finally, several sample programs are 
  85.              provided to help you to learn to program CALC.  A quick-ref
  86.              appendix appears at the end of the document.
  87.  
  88.              A Special Note to the Users of CALC:
  89.              This is Public Supported Software and, as such, can be
  90.              propogated and distributed by its users unchanged and free-
  91.              of-charge.  Feel free to put it on any bulletin boards, etc
  92.              along with this documentation.  This also means that if you
  93.              like CALC, then a $20.00 donation sent to:
  94.                            Bob Brooks
  95.                            7352 Amestoy Ave.
  96.                            Van Nuys, CA   91406
  97.              would be greatly appreciated.  As a special service, all paid
  98.              users will be notified by mail when the upgrade is available.
  99.              An upgraded version will be released in the future and will 
  100.              incorporate such capabilities as BREAK/CONT, Program Labels/GOTO,
  101.              single stepping through your programs and maybe some very nice 
  102.              surprizes if the response to Version 1.00 is good enough.
  103.  
  104.              Now, with all of the formalities out of the way, let's get 
  105.              started.
  106.  
  107.           2) CALC Command List
  108.              This is a complete list of all currently active CALC commands.
  109.              The command is shown followed by a description of what the
  110.              command actually does.  The work registers (X, Y, Z, T) are
  111.              represented by either the letter r or R.  Memory registers are 
  112.              indicated by use of the ## symbol.  
  113.      
  114.          +                Addition.  Adds contents of Y register to contents 
  115.                           of X register and puts result in X register.
  116.  
  117.          -                Subtraction.  Subtracts the contents of the Y 
  118.                           register from the contents of the X register and 
  119.                           puts the result in the X register.  
  120.  
  121.          *                Multiplication.  Multiply the contents of the Y 
  122.                           register by the contents of the X register and put 
  123.                           the result in the X register.  
  124.  
  125.          /                Division.  Divides the contents of the X register
  126.                           by the contents of the Y register and puts the result
  127.                           into the X register.  The Y register MUST contain a
  128.                           non-zero number (division by zero is undefined).
  129.  
  130.          E                This command loads the value of the constant 'e' 
  131.                           (2.7182818285) into the X register.
  132.  
  133.          **               Raise to a Power. This command will raise the 
  134.                           contents of the X register to the power that is 
  135.                           contained in the Y register.  Both X and Y can be
  136.                           Real numbers BUT X must be only a positive Real or
  137.                           zero.  If X is a negative number, then CALC will
  138.                           issue an error message and not perform the requested
  139.                           function.  The result is put into the X register.
  140.  
  141.          LN               Natural Logarithm.  This command takes the natural
  142.                           logarithm (Log to the base e) of the contents of the
  143.                           X register and puts the result into the X register.
  144.                           X may only be a positive Real number.  If X is zero
  145.                           or negative, CALC will issue an error message and
  146.                           not perform the requested action.
  147.  
  148.          PI               This command loads the value of the constant PI 
  149.                           (3.1415926536) into the X register.
  150.                           
  151.          **2              Square of a Number.  Computes the square of the 
  152.                           contents of the X register and puts the result in
  153.                           the X register.  This command will process all
  154.                           numbers, positive, negative, or zero.
  155.  
  156.          **3              Cube of a Number.  Computes the cube of the 
  157.                           contents of the X register and puts the result in
  158.                           the X register.  This command will process all
  159.                           numbers, positive, negative, or zero.
  160.  
  161.          ABS              Absolute Value.  Take the absolute value of the 
  162.                           contents of the X register and put the result in
  163.                           the X register.  
  164.                           
  165.          CLR              Clear all Work Registers.  Sets the contents of the
  166.                           X, Y, Z, and T registers to 0.0000000   
  167.                           
  168.          EXP              Raise e to a Power. Raises the constant 'e' 
  169.                           (2.7182818285) to the power of the contents of the
  170.                           X register and puts the result in the X register.
  171.                           
  172.          INT              Integer Part.  Take the integer portion of the 
  173.                           contents of the X register and put result in the
  174.                           X register.  The integer portion of a number is
  175.                           that pert to the left of the decimal point.
  176.                           
  177.          LOG              Common Logarithm.  Takes the common logarithm (Log
  178.                           to base 10) of the contents of the X register and 
  179.                           puts the result into the X register.  X may contain
  180.                           any positive Real number.  If X is zero or negative,
  181.                           CALC will issue an error message and not perform 
  182.                           the requested action.
  183.  
  184.          SIN, COS, TAN    Trigonometric functions.  Computes the requested
  185.          CSC, SEC, COT    trigonometric function for the angle contained in
  186.                           the X register.  All angles must be in degrees.
  187.                           The result is put into the X register.
  188.  
  189.          RCL ## r         Recall from a Memory Register.  This command will
  190.                           get whatever the contents of storage register ##
  191.                           is and put that value into the work register
  192.                           specified in the 'r' field.  The value of the ##
  193.                           field can be 00 through 99.  The 'r' field is 
  194.                           optional.  The 'r' field can be any of the work 
  195.                           registers (X, Y, Z, or T).  If the 'r' field is 
  196.                           left blank or omitted, then CALC assumes that the
  197.                           contents of Mem Reg ## is to be put into the X
  198.                           work register.  
  199.                           For example, the command RCL 02 Y would get the 
  200.                           value stored in Mem Reg number 2 and put it into
  201.                           work register Y.  The command RCL 00 would get the
  202.                           value stored in Mem Reg 0 and put it into the X
  203.                           work register since no destination register 'r'
  204.                           was provided.  The syntax of this command is very
  205.                           important.  The RCL must be followed by one space,
  206.                           then a two digit Mem Reg number, then a blank space,
  207.                           and, finally, the optional destination register.
  208.                           
  209.          STO ##           Store to a Memory Register.  This command will put
  210.                           the value of work register X into memory register
  211.                           ##.  The ## field can be from 00 through 99.  The
  212.                           syntax is STO followed by one blank space and then
  213.                           the Mem Reg number ##.
  214.  
  215.          SUM ##           Add to a Memory Register.  Adds the contents of the
  216.                           X work register to whatever value is already stored
  217.                           in Mem Reg ##.  The ## field can be any number from 
  218.                           00 through 99.  
  219.                           For example, if Mem Reg 14 contained the value 23.00
  220.                           and work register X contained 56.00000, then after 
  221.                           executing a SUM 14 command, Mem Reg 14 would contain
  222.                           79.0000 (23+56).  The syntax is SUM followed by one
  223.                           blank space, then the memory number ##.
  224.                           
  225.          ASIN, ACOS, ATAN Inverse Trigonometric Functions.  Computes the
  226.                           requested inverse trigonometric function for the
  227.                           value contained in the X register and puts the
  228.                           result into the X register.  The result is expressed
  229.                           in degrees.
  230.                           
  231.          CLRX             Clear X Register Only.  Set value of X to 0.0000000   
  232.                           
  233.          EXCH r R         Exchange Work Registers.  Exchanges the value in 
  234.                           work register 'r' with that stored in work register
  235.                           'R.'  Both 'r' and 'R' can take on the values 
  236.                           X, Y, Z, or T.  If 'R' or 'r' are not one of these 
  237.                           or if they are the same (R=r), then CALC will issue
  238.                           an error message and ignore the request.  For example,
  239.                           EXCH X Y would be a valid request and would result
  240.                           in the values stored in register X and register Y
  241.                           being swapped.  Now what was in X would be in Y and
  242.                           what was in Y would be in X.  An example of an 
  243.                           invalid use of this command would be EXCH X X.  
  244.                           Also, the order that you enter 'r' and 'R' is not 
  245.                           important.  EXCH Y T and EXCH T Y produce the same
  246.                           effect, to exchange the Y and T registers.  The 
  247.                           syntax of this command is EXCH followed by one blank
  248.                           space, then one of the registers ('r'), then another
  249.                           blank space, and finally the other register ('R').
  250.                           
  251.          FACT             Factorial.  Computes the factorial of the integer
  252.                           portion of the number stored in the X register and
  253.                           puts the result into the X register.  This function
  254.                           will compute from 1! to 50!.  Any zero or negative 
  255.                           value in X will result in an error message being 
  256.                           issued and CALC not performing the requested action.
  257.                           
  258.          FILE             Program File Input.  Open a program file and run it.
  259.                           When this command is entered, CALC will request that
  260.                           you enter the name of your program file.  CALC will
  261.                           read this program file and execute the commands in
  262.                           it until it reaches either the end of the file, a
  263.                           KEYBRD command or a STOP or END command.
  264.                           
  265.          FRAC             Fractional Part.  Take the fractional portion of the
  266.                           number in the X register and put the result into the
  267.                           X register.  The fractional portion of a number is
  268.                           that part to the right of the decimal point.
  269.                           
  270.          HHMS             Decimal Hours/Degrees to Mixed Units.  Converts 
  271.                           decimal hours/degrees in the X register to 
  272.                           hours/degrees, minutes, and seconds.  The result is
  273.                           put into the X register in the format HHMMSS where
  274.                           HH is the hours/degrees, MM is the minutes, and
  275.                           SS is the seconds.
  276.                           An example of this would be if the X register 
  277.                           contained 16.505555.  entering HHMS would give the
  278.                           value 163020.0000 in the X register.  This translates
  279.                           to 16 hours/degrees, 30 minutes, and 20 seconds.
  280.                           
  281.          HMSH             Mixed Units to Decimal Hours/Degrees.  This really
  282.                           just performs the opposite function that the previous
  283.                           command performs.  It takes mixed units in the HHMMSS
  284.                           format from the X register and converts them to 
  285.                           decimal hours/degrees, putting the result into the
  286.                           X register.
  287.                           Using the example from the previous command, if the
  288.                           X register contains 163020.0000, then entering this
  289.                           command would give the result 16.50555 in the X
  290.                           register.
  291.                           
  292.          SHOW (ON/OFF)    Turn ON/OFF display of X, Y, Z, and T.  Entering
  293.                           SHOW ON will display the contents of the work reg-
  294.                           isters after each command is executed by CALC.  If
  295.                           you enter SHOW OFF then CALC will not display the
  296.                           work registers until a SHOW ON command is entered
  297.                           or, if you are running a program, until the end of
  298.                           the program file is reached.  The syntax of this
  299.                           command is SHOW followed by one blank space, and then
  300.                           either ON or OFF.
  301.                           
  302.          SINH, COSH, TANH Hyperbolic functions.  Computes the appropriate
  303.                           hyperbolic function using the contents of the X
  304.                           register and puts the result into the X register.
  305.                           
  306.          SQRT             Square-Root.  Take the square-root of the value in
  307.                           the X register and put the result into the X
  308.                           register.  The contents of the X register must be
  309.                           a positive number or zero.  If X is negative, then
  310.                           CALC will issue an error message and not perform the
  311.                           requested function.
  312.                           
  313.          RECIP r          Reciprocal.  Take the reciprocal of the value of
  314.                           'r' register and put the result into the 'r' register.
  315.                           'r' can be any of the work registers (X, Y, Z, or T).
  316.                           If 'r' is omitted, CALC assumes that you want the 
  317.                           reciprocal of the X register.  Register 'r' can
  318.                           contain any non-zero value.  If it equals zero, then
  319.                           CALC will issue an error message and not perform the
  320.                           requested function.
  321.                           
  322.          ROUND            Round-off.  Round-off the value in the X register to
  323.                           the nearest integer.
  324.                           This means that if X contains 23.45763, then if it
  325.                           is rounded, it will become 23.0000.  If X is set to
  326.                           23.51703, then entering ROUND would round X up to
  327.                           24.0000.
  328.                           
  329.          CHSIGN r         Change Sign.  Change the sign of the value in the
  330.                           'r' work register.  In other words, a positive number
  331.                           will become a negative number and a negative will
  332.                           become positive.  The 'r' field can be any one of
  333.                           X, Y, Z, or T.  If the 'r' field is omitted, then
  334.                           CALC assumes that you want to change the sign of the
  335.                           X register.
  336.                           
  337.          KEYBRD           Read CALC program statements from the Keyboard.   
  338.                           
  339.          ROLLDN           Rotate Work Registers.  Rotate the X, Y, Z, T 
  340.                           registers counter-clockwise so that the following
  341.                           occurs: X=Y, Y=Z, Z=T, T=X.  This allows you to use
  342.                           the work registers as a FIFO stack.  
  343.                           For those who don't know what FIFO means, it's an
  344.                           acronym for First-In-First-Out.
  345.                           
  346.          STOP, END        Quit running CALC and exit to CLI.
  347.  
  348.           3) How to write programs for CALC
  349.              CALC reads its input from either the keyboard or from disk files.
  350.           When in keyboard mode, CALC tells you, each time, what the values of
  351.           the four work registers are.  As an example, from the CALC prompt
  352.           for input, type the number 30 and hit return.  Notice that 30 is now
  353.           stored in the X register.  All of the others are still zero.  Now
  354.           type EXCH X Y.  Be sure that the syntax is exactly as described in 
  355.           the previous section.  This command caused the value in X to be put
  356.           in Y and the value in Y to be put into X.  Now type 25 and hit
  357.           return.  CALC now shows X equal to 25 and Y equal to 30.  If we
  358.           wanted to multiply these two numbers, we would simply type  *  and
  359.           CALC would do the multiplication and put the result into the X regis-
  360.           ter.  The  *  symbol is the instruction to CALC that it should mult-
  361.           iply the value in X by that in Y.  In this case, the result is 750
  362.           and that is precisely what we see in X.  This is the basis on which
  363.           CALC operates.  You enter your initial data to CALC and then tell
  364.           it how to process those data.  A description of all valid CALC
  365.           commands is provided in the previous section.  
  366.              Of course, what you have just done is to use CALC in its inter-
  367.           active, or keyboard mode.  The other mode that CALC can operate in 
  368.           is the File mode.  You may have a long set of calculations to make
  369.           to arrive at some final value.  And you may want to keep that program
  370.           stored away where you can get at it when you need it in the future
  371.           to do the same calculations again but with different data.  Rather
  372.           than just writing these commands down on a piece of paper and then
  373.           retyping those commands over again to rerun the program, CALC allows
  374.           you to store your commands in ASCII disk files and then simply tell
  375.           CALC to read the commands from the file and process just as though
  376.           you were entering those commands from the keyboard, but much more
  377.           efficiently and quickly.  Your program file can contain any command
  378.           which is acceptable to CALC with the single exception of the FILE
  379.           command.  CALC only allows one program file to be open at a time
  380.           and asking to open a file from another file will cause CALC to issue
  381.           an error message and then to ignore the requested command.  Other-
  382.           wise, you can enter numbers and commands in whatever order will make
  383.           CALC do the computations you need.  
  384.              When CALC is processing in FILE mode, it will continue until it 
  385.           reaches the end of the program file, a KEYBRD command, or a STOP
  386.           or END command.  When CALC encounters the end of a file, it will
  387.           automatically put you back in keyboard mode.  When it sees a STOP
  388.           or END command, it exits CALC and returns to the system.
  389.              As mentioned earlier, CALC is very sensitive to syntax.  Both
  390.           upper and lower case are acceptable, but your commands must be 
  391.           syntactically correct.  Violations of the syntactical rules which
  392.           were identified in the command definitions section of this document
  393.           will result in CALC issuing an error message and, in FILE mode,
  394.           asking you if it should stop processing so you can fix the error or
  395.           just continue.  
  396.              To build your program files, you can use any text editor or word
  397.           processor that writes its files in ASCII.  In the Amiga, the ED text
  398.           editor is quite good for this purpose.  Your AmigaDOS documentation
  399.           should be consulted for more information about ED.  
  400.              In your program files, the first 35 characters of each line are
  401.           reserved for your CALC commands.  From column 36 to the end of the 
  402.           line you can enter any comments you might want to make regarding
  403.           just what your program is doing.  This will help you when you are
  404.           debugging your programs as well as when you look at them long after
  405.           writing them and can't remember what they were supposed to be doing.
  406.  
  407.              Several sample problems and the programs that will solve them 
  408.           are provided below to help you learn how to program CALC.
  409.  
  410.           Some helpful hints on writing programs:
  411.              1) When writing a program, break your problem down into the 
  412.              smallest pieces possible.  Then work on those little parts one 
  413.              at a time and save the results in the various work and memory
  414.              registers for later retrieval.  This method is a standard
  415.              programming technique and helps enormously when you have to 
  416.              debug your programs.
  417.  
  418.              2) If some of the values to your program change with each run,
  419.              then try to design your programs to retrieve those values from
  420.              the memory registers.  Then, each time that you run a program,
  421.              you can initialize those memory registers with the values that
  422.              you want to use with that run.  This would be done by entering
  423.              the values by hand and then STOing them into the appropriate
  424.              register.  Once they are stored away, you can enter a FILE 
  425.              command and start cranking away.
  426.  
  427.           Amiga and AmigaDOS are trademarks of Commodore-Amiga, Inc.
  428.  
  429.           4) Sample programs:
  430.              Most of the sample programs given deal with mathematical 
  431.           problems, though two do temperature conversions and another 
  432.           computes the monthly payment for a loan.  Their order of present-
  433.           ation is from simplest to most complex.  Most are designed to be
  434.           general use programs and, therefore, require you to initialize 
  435.           them before running them.  When this is required, the initializa-
  436.           tion commands are entered from the keyboard and appear under the
  437.           heading 
  438.                      "Program Initialization:"
  439.           The stored program commands are listed under the heading
  440.                      "Program Listing:"
  441.              Read each example and then try entering the program first via 
  442.           the keyboard one statement at a time.  Then build a program file
  443.           and run the file through CALC.  You should be pleased with the 
  444.           increase in efficiency and speed.  By the way, you don't need to
  445.           enter the comments for each line when doing keyboard entry, only
  446.           the commands themselves.
  447.  
  448. 1) Convert -30 degrees Celcius to degrees Kelvin.
  449.    The equation is: K=C+273.15
  450.              where: K is the temperature in degrees Kelvin
  451.                     C is the temperature in degrees Celcius
  452.  
  453.    Program Initialization:
  454.     -30
  455.     STO 00
  456.  
  457.    Program Listing:
  458. 273.15                             DIFFERENCE BETWEEN CELCIUS AND KELVIN IN X
  459. RCL 00 Y                           LOAD DEGREES CELCIUS FROM MEM REG 00 INTO Y
  460. +                                  COMPUTE KELVIN=CELCIUS+273.15
  461.  
  462.  
  463. 2) Convert 513 degrees Fahrenheit to degrees Celcius.
  464.    The equation is: C=(5/9)*(F-32)
  465.              where: C is the temperature in degrees Celcius
  466.                     F is the temperature in degrees Fahrenheit
  467.  
  468.    Program Initialization:
  469.     513
  470.     STO 00
  471.  
  472.    Program Listing:
  473. 9                                  LOAD 9 INTO X REG
  474. EXCH X Y                           MOVE IT TO THE Y REG
  475. 5                                  LOAD 5 INTO X REG
  476. /                                  COMPUTE (5/9) TERM
  477. EXCH X Z                           SAVE THAT IN THE Z REG FOR SAFE KEEPING
  478. 32                                 LOAD 32 INTO THE X REG
  479. EXCH X Y                           MOVE IT TO THE Y REG
  480. RCL 00                             GET DEGREES F FROM MEM REG 00 PUT IN X
  481. -                                  COMPUTE (F-32) TERM
  482. EXCH Y Z                           MOVE (5/9) FROM Z TO Y
  483. *                                  COMPUTE C=(5/9)*(F-32)
  484.  
  485.  
  486. 3) Convert angular 61 degrees to radians.
  487.    The equations are: number of Radians per Degree = PI/180
  488.                       Radians=(PI/180)*Degrees
  489.  
  490.    Program Initialization:
  491.     61
  492.     STO 00
  493.  
  494.    Program Listing:
  495. 180                                DEGREES IN A HALF CIRCLE
  496. EXCH X Y                           STICK IT IN THE Y REG
  497. PI                                 RADIANS IN A HALF CIRCLE
  498. /                                  COMPUTE CONVERSION FACTOR DEG TO RAD
  499. RCL 00 Y                           GET ANGLE IN DEGREES FROM 00 AND PUT IN Y
  500. *                                  COMPUTE ANGLE IN RADIANS
  501.  
  502.  
  503. 4) Compute the circumference of a circle with radius of 10 inches.
  504.    The equation is: C=2*PI*R
  505.              where: C is the circumference of the circle
  506.                     R is the radius of the circle
  507.  
  508.    Program Initialization:
  509.     10
  510.     STO 00
  511.  
  512.    Program Listing:
  513. PI                                GET VALUE OF PI AND PUT IT IN X
  514. EXCH X Y                          MOVE PI TO Y REG
  515. 2                                 LOAD 2 INTO X REG
  516. *                                 COMPUTE (2*PI) TERM
  517. RCL 00 Y                          GET CIRCLE RADIUS (R) FROM MEM REG 00 INTO Y
  518. *                                 COMPUTE CIRCUM=2*PI*R
  519.  
  520.  
  521. 5) Compute the area of a circle with radius of 4 inches.
  522.    The equation is: A=PI*(R**2)
  523.              where: A is the area of the circle
  524.                     R is the radius of the circle
  525.  
  526.    Program Initialization:
  527.     4
  528.     STO 00
  529.  
  530.    Program Listing:
  531. PI                                PUT VALUE OF PI INTO X REG
  532. EXCH X Y                          MOVE PI TO Y REG
  533. RCL 00                            GET RADIUS (R) OF CIRCLE FROM MEM REG 00 TO X
  534. **2                               COMPUTE SQUARE OF RADIUS
  535. *                                 COMPUTE AREA=PI*(R**2)
  536.  
  537.  
  538. 6) Use the Pythagorean Theorem to compute the length of the hypotenuse of a
  539.    right triangle with sides of 6 inches and 8 inches.
  540.    The equation is: C=SQRT((A**2)+(B**2))
  541.              where: C is the length of the hypotenuse
  542.                     A and B are the two sides of the triangle
  543.  
  544.    Program Initialization:
  545.     6
  546.     STO 00
  547.     8
  548.     STO 01
  549.  
  550.    Program Listing:
  551. RCL 00                             GET ONE OF THE SIDES FROM MEM REG 00
  552. **2                                SQUARE THAT SIDE
  553. EXCH X Y                           AND MOVE RESULT OVER TO REG Y
  554. RCL 01                             GET OTHER SIDE FROM REG 01
  555. **2                                SQUARE THAT SIDE
  556. +                                  COMPUTE THE SUM OF THE SQUARES
  557. SQRT                               TAKE SQUARE-ROOT TO GET LENGTH OF THIRD SIDE
  558.  
  559.  
  560. 7) Compute the volume of a sphere with radius of 5 inches.
  561.    The equation is: V=(4/3)*PI*(R**3)
  562.              where: V is the volume of the sphere
  563.                     R is the radius of the sphere
  564.  
  565.    Program Initialization:
  566.     5
  567.     STO 00
  568.  
  569.    Program Listing:
  570. PI                                GET VALUE OF PI AND PUT IN X REG
  571. EXCH X Y                          MOVE PI TO Y REG
  572. 4                                 LOAD 4 INTO X
  573. *                                 COMPUTE (4*PI) TERM
  574. EXCH X Y                          MOVE THAT TO Y REG
  575. 3                                 LOAD 3 INTO X
  576. EXCH X Y                          SWAP X REG AND Y REG
  577. /                                 COMPUTE (4*PI/3) TERM
  578. EXCH X Y                          PUT THAT IN THE Y REG FOR LATER USE
  579. RCL 00                            GET RADIUS (R) OF SPHERE FROM MEM REG 00
  580. **3                               COMPUTE (R**3) TERM
  581. *                                 COMPUTE VOL=(4*PI/3)*(R**3)
  582.  
  583.  
  584. 8) Use the Law of Cosines to find the length of the third side of a triangle
  585.    whose other two sides measure 16 inches and 18 inches and with the angle
  586.    between those two sides equal to 40 degrees.
  587.    The equation is: A**2=(B**2)+(C**2)-(2*B*C*COS(ALPHA))
  588.              where: A is the length of the third side
  589.                     B and C are the lengths of the two given sides
  590.                     ALPHA is the angle between sides B and C
  591.  
  592.    Program Initialization:
  593.     16
  594.     STO 00
  595.     18
  596.     STO 01
  597.     40
  598.     STO 02
  599.  
  600.    Program Listing:
  601. RCL 00                             GET ONE OF THE SIDES
  602. RCL 01 Y                           GET THE OTHER SIDE
  603. *                                  COMPUTE (B*C) TERM
  604. EXCH X Z                           SAVE RESULT IN Z REG FOR NOW
  605. RCL 00                             GET ONE OF THE SIDES IN X REG
  606. **2                                COMPUTE (B**2) TERM
  607. STO 00                             SAVE RESULT IN MEM REG 00
  608. RCL 01                             GET OTHER SIDE IN X REG
  609. **2                                COMPUTE (C**2) TERM
  610. SUM 00                             COMPUTE (B**2)+(C**2) AND STORE IN MEM REG 00
  611. EXCH Y Z                           GET THE (B*C) TERM FROM Z REG PUT IN Y REG
  612. 2                                  GET READY TO COMPUTE (2*B*C) TERM
  613. *                                  COMPUTE (2*B*C) TERM
  614. EXCH X Y                           STICK IT IN THE Y REG
  615. RCL 02                             GET THE ANGLE (ALPHA) BETWEEN LINES B & C
  616. COS                                TAKE COSINE OF THAT ANGLE
  617. *                                  COMPUTE (2*B*C*COS(ALPHA)) TERM
  618. EXCH X Y                           SAVE IT IN THE Y REG FOR LATER USE
  619. RCL 00                             GET THE (B**2)+(C**2) TERM FROM MEM REG 00
  620. -                                  COMPUTE ((B**2)+(C**2)-(2*B*C*COS(ALPHA)))
  621. SQRT                               TAKE SQUARE-ROOT TO COMPUTE THIRD SIDE
  622.  
  623.  
  624. 9) Compute the monthly payment for a loan on a house for $100,000.00 at 12.5
  625.    percent annual interest rate and with a term of 30 years.
  626.    The equation is: P=(R*A*((R+1)**N))/(((R+1)**N)-1)
  627.              where: P is the MONTHLY payment
  628.                     R is the MONTHLY interest rate (computed from annual rate)
  629.                     A is the amount of the loan
  630.                     N is the total number of payments (computed from term)
  631.  
  632.    Program Initialization:
  633.     12.5
  634.     STO 00
  635.     30
  636.     STO 01
  637.     100000
  638.     STO 02
  639.  
  640.    Program Listing:
  641. RCL 01 Y                           GET TERM OF LOAN IN YEARS
  642. 12                                 NUMBER OF MONTHS IN A YEAR
  643. *                                  COMPUTE TOTAL NUMBER OF PAYMENTS
  644. STO 01                             STORE RESULT BACK IN 01
  645. RCL 00 Y                           GET ANNUAL INTEREST RATE
  646. 1200                               12 MON/YR * 100 PERCENT
  647. EXCH X Y                           SWAP X AND Y FOR DIVISION
  648. /                                  COMPUTE MONTHLY INTEREST RATE
  649. STO 00                             STORE RESULT BACK IN 00
  650. EXCH X Y                           PUT MONTHLY INT RATE IN Y REG
  651. 1                                  TO COMPUTE THE (R+1) TERM
  652. +                                  COMPUTE THE (R+1) TERM
  653. RCL 01 Y                           GET TOTAL NUMBER OF PAYMENTS
  654. **                                 COMPUTE ((R+1)**N) TERM
  655. EXCH X Y                           PUT IT IN Y REG
  656. 1                                  FOR COMPUTATION OF DENOMINATOR
  657. -                                  COMPUTE (1-(R+1)**N)
  658. CHSIGN X                           THEN CHANGE SIGN TO GET (((R+1)**N)-1)
  659. EXCH X Y                           GET ((R+1)**N) TERM IN X
  660. /                                  COMPUTE ((R+1)**N)/(((R+1)**N)-1)
  661. RCL 02 Y                           GET TOTAL AMOUNT OF LOAN
  662. *                                  COMPUTE A*((R+1)**N)/(((R+1)**N)-1)
  663. RCL 00 Y                           GET MONTHLY INTEREST RATE
  664. *                                  COMPUTE TOTAL MONTHLY PAYMENT
  665. EXCH X Y                           PUT IT IN THE Y REG
  666. 100                                GET READY TO ROUND OFF THE PAYMENT
  667. EXCH X Y                           WILL NEED THAT 100 AGAIN LATER
  668. *                                  STILL GETTING READY TO ROUND
  669. ROUND                              ROUND IT OFF TO NEAREST PENNY
  670. /                                  TAKE IT BACK TO DOLLARS AND CENTS
  671. KEYBRD                             GO BACK TO KEYBOARD INPUT
  672.  
  673.  
  674.           5) Command quick reference lists.
  675.  
  676.              General Command List
  677.          Command          Description
  678.          ---------------------------------------------------------------
  679.          ?                Help.
  680.          +                Addition.
  681.          -                Subtraction.
  682.          *                Multiplication.
  683.          /                Division.
  684.          E                Load 'e' (2.7182818285) into the X register.
  685.          **               Raise to a Power.
  686.          LN               Natural Logarithm.
  687.          PI               Load PI (3.1415926536) into the X register.
  688.          **2              Square of a Number. 
  689.          **3              Cube of a Number.
  690.          ABS              Absolute Value.
  691.          CLR              Clear all Work Registers.
  692.          END              Quit running CALC and exit to the System.
  693.          EXP              Raise e to a Power.
  694.          INT              Integer Part.
  695.          LOG              Common Logarithm.
  696.          SIN              Trigonometric function Sine.
  697.          COS              Trigonometric function Cosine.
  698.          TAN              Trigonometric function Tangent.
  699.          CSC              Trigonometric function Cosecant.
  700.          SEC              Trigonometric function Secant.
  701.          COT              Trigonometric function Cotangent.
  702.          RCL ## r         Recall from a Memory Register.
  703.          STO ##           Store to a Memory Register.
  704.          SUM ##           Add to a Memory Register.
  705.          ASIN             Inverse Trigonometric Function Arcsine.
  706.          ACOS             Inverse Trigonometric Function Arccosine.
  707.          ATAN             Inverse Trigonometric Function Arctangent.
  708.          CLRX             Clear X Register Only.
  709.          EXCH r R         Exchange Work Registers.
  710.          FACT             Factorial.
  711.          FILE             Program File Input.
  712.          FRAC             Fractional Part.
  713.          HELP             Help.
  714.          HHMS             Decimal Hours/Degrees to Mixed Units.
  715.          HMSH             Mixed Units to Decimal Hours/Degrees.
  716.          SHOW (ON/OFF)    Turn ON/OFF display of X, Y, Z, and T.
  717.          SINH             Hyperbolic Sine function.
  718.          COSH             Hyperbolic Cosine function.
  719.          TANH             Hyperbolic Tangent function.
  720.          SQRT             Square-Root.
  721.          STOP             Quit running CALC and exit to the System.
  722.          RECIP r          Reciprocal.
  723.          ROUND            Round-off.
  724.          CHSIGN r         Change Sign.
  725.          KEYBRD           Read CALC program statements from the Keyboard.   
  726.          ROLLDN           Rotate Work Registers.
  727.  
  728.              Functional Command List
  729.          Function                 Associated Commands
  730.          --------------------------------------------
  731.          CALC control commands    ?
  732.                                   END
  733.                                   FILE
  734.                                   HELP
  735.                                   SHOW
  736.                                   STOP
  737.                                   KEYBRD
  738.                                   
  739.          Register Manipulation    CLR
  740.                                   RCL
  741.                                   STO
  742.                                   SUM
  743.                                   CLRX
  744.                                   EXCH
  745.                                   ROLLDN
  746.                                   
  747.          Arithmetic               +
  748.                                   -
  749.                                   *
  750.                                   /
  751.                                   ROUND
  752.                                   
  753.          Constants                E
  754.                                   PI
  755.                                   
  756.          Portions of numbers      INT
  757.                                   FRAC
  758.                                   
  759.          Algebraic                **
  760.                                   **2
  761.                                   **3
  762.                                   ABS
  763.                                   EXP
  764.                                   FACT
  765.                                   SQRT
  766.                                   RECIP
  767.                                   CHSIGN
  768.                                   
  769.          Logarithms               LN
  770.                                   LOG
  771.                                   
  772.          Trigonometry             SIN
  773.                                   COS
  774.                                   TAN
  775.                                   CSC
  776.                                   SEC
  777.                                   COT
  778.                                   ASIN
  779.                                   ACOS
  780.                                   ATAN
  781.                                   
  782.          Hyperbolic functions     SINH
  783.                                   COSH
  784.                                   TANH
  785.                                   
  786.          Time/Angle conversions   HHMS
  787.                                   HMSH
  788.  
  789.