home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / calculat / monkey.zip / MONKEY.HLP < prev    next >
Text File  |  1988-01-31  |  42KB  |  1,066 lines

  1.                   >> Matrix Manipulator Monkey  V1.0 <<
  2.  
  3. Help is Available on the Following Topics.  Simply Type 'HELP topic' for
  4. the particular information you need.  The Capital Letters are the minimum
  5. abbreviation for both the help information and the Command itself.
  6.  
  7. In all of the help entries, a [] will indicate an option part of a command.
  8. The symbols used are:
  9.     m, m1, m2, ...        ---  A Matrix Name
  10.     r                     ---  A Row Specification
  11.     c                     ---  A Column Specification
  12.     s                     ---  A Scaler
  13.     filename              ---  Refers to a filename
  14.  
  15. >> General Info on the Program and How to Use it
  16. General_info      Information on Monkey, How to Get Started, Read this First
  17. Objects           How Scalers, Matrix Names, Memory, Row/Column specs are used
  18. SOurce            Information on how to Get the Source, and Compile it
  19. DOcumentation     Generation of Printable Documentation on Monkey
  20.  
  21. >> System Commands
  22. Load              Load a Matrix (keyboard -> memory).
  23. Print             Output a Matrix (memory -> screen).
  24. Z                 Set Default Matrix.
  25. DUmp              Print all Matrices currently in Memory.
  26. LIst              List all Matrices currently in Memory.
  27. Copy              Copy a Matrix (matrix -> matrix).
  28. Get               Copy another Matrix into the Default Matrix.
  29. PUt               Copy the Default Matrix into another Matrix.
  30. Kill              Kill a Matrix (Remove it from Memory).
  31. Swap              Swap Two Matrices.
  32. Quit              Leave Monkey.
  33. Help [?]          Help System (This Message).
  34.  
  35. >> File Commands
  36. FDump             Dump all the Matrices in Memory into a File.
  37. FLoad             Load a Matrix from a File.
  38. FPrint            Print a single Matrix to a File.
  39. FMacro            Read Commands from a Macro File.
  40.  
  41. >> Matrix Manipulations
  42. Add [+]           Add Matrices, Rows/Columns.
  43. Multiply [*]      Multiply Matrices, Matrix by Scaler, Row/Column by Scaler.
  44. IDentity          Make an Identity Matrix
  45. Invert [`]        Invert a Matrix.
  46. Transpose [']     Transpose a Matrix.
  47. Upper_Triangular  Use Basic Operations to Satisfy Upper Triangular Property.
  48. Lower_Triangular  Use Basic Operations to Satisfy Lower Triangular Property.
  49. Determinant       Calculate Determinant of Matrix.
  50. SOlve             Solve Matrix (Solution Space in Vector Form).
  51.  
  52. >> Basic Row/Column Manipulations
  53. Swap              Swap Rows/Columns, Matrices.
  54. Reduce            Reduce one Row/Column by Scaler*Row/Column.
  55. Multiply          Multiply Row/Column by Scaler.
  56. @g?@ General Information
  57.  
  58.                   >> Matrix Manipulator Monkey  V1.0 <<
  59.  
  60. Purpose:
  61.  
  62.     Monkey is a Linear Algebra calculator.  It will add, multiply, invert,
  63.     solve, etc. any number of matrices, as well as the simple elementary
  64.     row/column manipulations.  Monkey is designed to be used by anyone,
  65.     not just computer science people and mathematicians.  To this end, a
  66.     full help system has been included, with all commands explained, and
  67.     examples provided.
  68.  
  69.     Monkey uses a unique method of doing math.  It uses fractions to
  70.     represent numbers, instead of converting everything to floating point.
  71.     This allows precise calculations on numbers, with no loss of precision.
  72.     But since floating point is suited for very large (and small) numbers,
  73.     this options is included, and if a calculation can not be done with
  74.     fractions, the floating point will take over.
  75.  
  76. How to Use it:
  77.  
  78.     At the command line, type:
  79.  
  80.         % monkey
  81.  
  82.     This will get you into the system.  At this point, you will be stared at
  83.     by something like:
  84.  
  85.         (default) answer:
  86.  
  87.         > _
  88.  
  89.     This is telling you that the default matrix to be worked on is 'answer'
  90.     and if it had anything in it, it would have shown it to you.  The '> _'
  91.     is your prompt and your cursor.  At this point you can enter any of
  92.     monkey's commands (help, load, eval, quit, etc.)  After every operation,
  93.     the screen will show you any matrices which have been changed, and the
  94.     default matrix.  So, let's try something:
  95.  
  96.         > load
  97.         1> _
  98.  
  99.     Our prompt has been changed by the load command.  The '1' is now telling
  100.     you that the first row of the matrix is to be typed in.  Since we did
  101.     not specify a matrix to load, it will go in the default matrix.
  102.  
  103.         1> 1 2 3
  104.         2> 9 8 2
  105.         3> 7 1 3
  106.         4>
  107.  
  108.         (default) answer:
  109.            1    2    3
  110.            9    8    2
  111.            7    1    3
  112.  
  113.         > _
  114.  
  115.     The blank like on '4>' indicates that you are done with this matrix,
  116.     and it repeated the matrix back to you.  Your prompt is back so we can
  117.     play with this matrix:
  118.  
  119.         > reduce r3 5 r1
  120.  
  121.         (default) answer:
  122.            1    2    3
  123.            9    8    2
  124.           12   11   18
  125.  
  126.         > _
  127.  
  128.     We just added 5 times row 1 to row 3.  And from here you could do any
  129.     number of commands.
  130.  
  131.     Almost all of the commands take the form of:
  132.  
  133.            > command   matrix_to_act_on    what_to_do_to_it
  134.  
  135.     If no matrix name is given in 'matrix_to_act_on', the default matrix is
  136.     assumed.
  137.  
  138.     After you are done with monkey, simply type 'quit':
  139.  
  140.         > quit
  141.  
  142.         % _
  143.  
  144.     and you will return to the operating system.
  145.  
  146.     This has been a short run through a simple example.  All of the
  147.     commands are listed in the HELP index, simple type 'help' at your
  148.     monkey prompt.  There are many features to keep in mind, and many things
  149.     monkey can and can't do.  But it can do a great many of the rudimentary,
  150.     mechanical operations of linear algebra.
  151.  
  152. If you Have Problems:
  153.  
  154.     Simply consult the help system, by using the 'help' command:
  155.  
  156.         > help
  157.  
  158.     This will provide you with a list of possible other places to go for
  159.     further help, as well as a listing of what monkey can do for you.
  160. @so@ Source Information
  161.  
  162. This program is distributed as a binary program, with no sources included.
  163. As for the binaries, feel free to give copies to others, so long as nothing
  164. has been changed in the original files.  The binaries of this program are
  165. hereby placed in the public domain.
  166.  
  167. This version of the IBM binary was compiled under the Small Memory Model.
  168. If you begin to run out of dynamic memory, the source can be compiled
  169. into the compact model without any problem (obviously, you must have the
  170. source to do this).
  171.  
  172. The source is written completely in ANSI standard C (as closely as I could),
  173. and compiles without modification under MSC 4.0, Turbo C 1.5, Sun C,
  174. Unix 4.2/4.3 C Compilers, and probably many more.  The code is a
  175. standard form for C programs, and is commented to some extent.  The
  176. very low level add and multiply routines (only three) are written in
  177. assembly code for the IBM PC (80x86) and Suns (68020), but a C equivalent
  178. is included for any machine (the assembly is just a great deal faster,
  179. it's very hard to get C to determine if an integer operation has overflowed).
  180.  
  181. This project is ongoing with me.  The next additions will have to be
  182. eigenvalues, eigenvectors, adjuncts, and perhaps symbolic math; but for
  183. now I just wanted to get what I had out.
  184.  
  185. If you would like a copy of the source code, I only ask a small donation
  186. to the Monkey cause, of perhaps $20.  I will send you an MS-DOS disk
  187. (5-1/4 inch) with the full sources and the latest binaries.  If you are
  188. using a unix machine, I could send you a TAR tape (either sun cartridge or
  189. a mag tape, but you must supply the tape), or I could send it to you
  190. through the E-Mail.
  191.  
  192. The address:
  193.  
  194. @#
  195.  
  196. In any case, I hope you enjoy the program.  If you find any bugs, or
  197. have any suggestions, PLEASE let me know.
  198.  
  199. --- greg, january 1988
  200.  
  201. Disclaimer:
  202. I make no warranty of any kind for this package, it is distributed "as is"
  203. and I shall not be liable for any damages or losses due to its use.
  204. @o?@ Objects
  205.  
  206. There are four basic data types that Monkey can understand.  These data
  207. types may be entered in any order, at any time while using Monkey, but
  208. context does govern which data types make sense, and where.  White space
  209. is used to separate arguments.
  210.  
  211. Scalers:
  212.  
  213.     Scalers are the entries in a matrix, constants times matrices, etc.
  214.     In Monkey, they are stored as fractions, that is a numerator and
  215.     denominator is kept for all numbers, as in:
  216.  
  217.         5/4    3/2     12     13/1234     1/999999
  218.  
  219.     Normally, a numerical program would convert these to floating point,
  220.     and then proceed with the calculation, often losing precision
  221.     (as in 1/3, which can not be expressed precisely as a finite decimal).
  222.     But, if the numbers can be kept in fractions, the calculations become
  223.     precise.  Of course, not all numbers can be stored conveniently on a
  224.     computer in this way (ie, 1e30 would be a very large number), thus, if
  225.     monkey sees that a number will overflow this scheme, it will revert to
  226.     floating point (depending on the machine be run on, a 32 bit floating
  227.     point number may be able to span a range of 1e300 to 1e-300).  Thus,
  228.     monkey uses the best of both worlds.  All calculations derived from a
  229.     floating point number will then be carried out in floating point.
  230.  
  231.     As for input, any algebraic expression may be used consisting of:
  232.  
  233.         '('   ')'   '+'    '-'    '*'    '/'
  234.  
  235.     Thus, during a load operation on a matrix, the following line might
  236.     be entered:
  237.  
  238.         (5+6/2)*1/32*(((9/2+1/2)*8*1.234)/12)
  239.  
  240.     which would be evaluated to 617/600.  ANYWHERE a scaler would be entered,
  241.     an algebraic expression may be used.
  242.  
  243.     Numbers may be integers, or floating point, or exponential.  Output is
  244.     controlled by the set variable 'display', and the set variable 'width'.
  245.     If a number drops into floating point, all representations from then
  246.     on will be in exponential.  To force entry of a floating point number,
  247.     use exponential notation (a decimal number such as '1.3' would be
  248.     converted into 13/10, while 1.3e0 will stay in floating point).
  249.  
  250.  
  251. Rows and Columns:
  252.  
  253.     Rows and columns are specified by giving the letter 'r' or 'c' before
  254.     a row or column number.  As in:
  255.  
  256.         r1     c12      r23
  257.  
  258.     which specified 'row 1', 'column 12', 'row 23' respectively.
  259.  
  260.  
  261. Matrix Names:
  262.  
  263.     The first character of a matrix name may be any letter or the underscore
  264.     ('_') character.  Subsequent characters can be any letter, number, or
  265.     the underscore, and are significant to 32 characters.  If an 'r' or 'c' was
  266.     used as the first character, a digit may NOT be in the second character
  267.     (which would interfere with the row/column specification syntax).
  268.  
  269.     Matrices are formed out of dynamic memory, and come and go as needed.
  270.     When specifying a matrix to work on, or a target matrix, call it by
  271.     name.  A listing of the current matrices can be displayed with the
  272.     'list' command.
  273.  
  274.  
  275. File Names:
  276.  
  277.      Any valid file name on the machine in use may be used (that includes
  278.      any kind of a path specification).
  279. @do@ Documentation: Abbreviation 'DO'
  280.  
  281. This command will output a copy of the Help file for printing purposes.
  282. The output file will contain all information in the Help system, nicely
  283. paginated, and sorted.  The idea is that this command will output a
  284. printable file, which can then be sent to a line printer.
  285.  
  286. Options to the command are:
  287.  
  288.      -lnum             --- Sets Number of Lines per Page (default: 66)
  289.      -tnum             --- Sets Top Margin (default: 3)
  290.      -bnum             --- Sets Bottom Margin (default: 3)
  291.      -p                --- Use a '^L' for page breaks instead of padding
  292.      -ffilename        --- Sets file name for output (default: 'monkey.doc')
  293.  
  294. Form:
  295.     > documentation [-lnum] [-tnum] [-bnum] [-p] [-ffilename]
  296.  
  297. Examples:
  298.     > documentation -flpt1   --- Sends Documentation to 'lpt1'
  299.                                  (most PC users have a parallel printer here)
  300.  
  301. See Also:
  302.     HELP
  303. @li@ LIST: Abbreviation 'LI'
  304.  
  305. LIST will provide a list of all the matrices currently in memory.  The
  306. matrices themselves will not be shown, just their name.  All matrices which
  307. are currently empty (0x0 Matrix) and all system matrices (starting with '__')
  308. will not be shown.  After the list is displayed, individual matrices can
  309. be displayed with the PRINT command, and all matrices can be dumped with the
  310. DUMP command.
  311.  
  312. Form:
  313.     > list
  314.  
  315. Examples:
  316.     > list                 -- Displays List of all Current Matrices in Memory
  317.     Current Matrices:
  318.       happy
  319.       e1
  320.       answer
  321.  
  322. See Also:
  323.     DUMP, FDUMP, PRINT, FPRINT, Objects.
  324. @l?@ LOWER_TRIANGULAR: Abbreviation 'LT'
  325.  
  326. This command will attempt to make the given matrix into a matrix which
  327. has only one entry per column that is non-zero.  This is done through the
  328. use of basic row operations.  Normally, if the matrix is upper triangular,
  329. and the diagonal is completely non-zero, this will place the matrix
  330. very close to a row echelon matrix (the only difference being that the
  331. pivot points will not be ideally 1).  In other words, the matrix will
  332. be reduced as far as possible (or nearly).  The command is governed
  333. by the set variable 'lower_triangular_swap' and 'triangular_seek'.
  334.  
  335. In a technical sense, this is what it does:
  336.     for column := last_column to first_row do
  337.        find a non-zero entry (searches from last_row to first_row)
  338.        reduce all other rows by this row (the reduce command)
  339.  
  340. Form:
  341.     > ltriangular [m]                   -- Make matrix lower triangular
  342.  
  343. Examples:
  344.     happy:                              -- From the Upper Triangular Command
  345.         2   -3   -1    2    3    4
  346.         0    2    1    0    5   -4
  347.         0    0    0    0    1    1
  348.         0    0    0    0    0    0
  349.     > ltriangular happy
  350.     happy:
  351.         2    0   1/2   2    0  -25/2    -- Reduce the matrix, note that
  352.         0    2    1    0    0    -9     -- not every row has only one entry,
  353.         0    0    0    0    1    1      -- since this matrix can not satisfy
  354.         0    0    0    0    0    0      -- that property.
  355.     > load another
  356.     1> 0 -1 1 3
  357.     2> 1 -1 -1 0
  358.     3> -1 0 -1 -3
  359.     4>
  360.     > utriangular another               -- Take the Upper Triangular
  361.     another:
  362.         1   -1   -1    0
  363.         0   -1    1    3
  364.         0    0   -3   -6
  365.     > ltriangular another               -- Take the Lower Triangular
  366.     another:                            -- The values for the solution
  367.         1    0    0    1                -- can now be read directly off
  368.         0   -1    0    1                -- the matrix.
  369.         0    0   -3   -6
  370.  
  371. See Also:
  372.     UPPER_TRIANGULAR, SOLVE, Objects.
  373. @l?@ LOAD: Abbreviation 'L'
  374.  
  375. The Load command allows the user to enter a matrix into memory, which can
  376. later be manipulated.  There are two basic forms of this command, one in
  377. which the user explicitly specifies the size of the matrix, and another
  378. in which it is read implicitly from the input.  In most cases the implicit
  379. version is fine, but it has limitations (less than 50 rows).  A blank line
  380. in the input when using the implicit form will finish the matrix.  When
  381. the matrix is being input, the first number is the Next Row to be Input, and
  382. the second number (if present) is the column location to be input.
  383.  
  384. Form:
  385.     > load [m] [r c]
  386.         Note: "[r c]" specifies explicitly the number of rows and columns.
  387.         Note: "[r c]" can also be given as "[c r]", order is not important.
  388.  
  389. Examples:
  390.     > load                -- Loads the Default Matrix, Implicitly
  391.     1> 1 3
  392.     2> 4 5
  393.     3>
  394.     > load happy r2 c2    -- Loads the Matrix 'Happy', a 2x2 Matrix
  395.     1,1> 1/2
  396.     1,2> 3/4 5/8
  397.     2,2> 9/89
  398.  
  399. See Also:
  400.     Objects.
  401. @pu@ PUT: Abbreviation 'PU'
  402.  
  403. PUT allows the user to store the default matrix away in some memory location.
  404. It works much like a calculators store key.  A copy of the default matrix
  405. is made, and placed in the named memory location.  This copy is a completely
  406. independent copy, and will not be effected by changes to the default matrix
  407. (or vice versa, changes to the copy will not affect the default).  PUT is
  408. the opposite of GET.  PUT accomplishes the same effect as the copy command in
  409. '> copy destination_matrix default_matrix'.
  410.  
  411. Form:
  412.    > put m               -- Makes a copy of the default matrix in 'm'
  413.  
  414. Examples:
  415.    > put happy           -- Make a copy of the default matrix in 'happy'
  416.  
  417. See Also:
  418.     COPY, GET, SWAP, Objects.
  419. @p?@ PRINT: Abbreviation 'P'
  420.  
  421. PRINT will output a matrix that is in memory.  If the matrix is undefined,
  422. nothing will happen.  Since after every command, the matrix that was changed
  423. is output; and before every command, the default matrix is output, this
  424. command is really only used when working with multiple matrices.
  425.  
  426. Form:
  427.     > print [m]
  428.  
  429. Examples:
  430.     > print               -- Output the Default Matrix
  431.     > print happy         -- Output the Matrix 'happy'
  432.     happy:
  433.     1   2   3
  434.     4   5   6
  435.     7   8   9
  436.  
  437. See Also:
  438.     DUMP, FDUMP, LIST, Objects.
  439. @z?@ Change Default Matrix: Abbreviation 'Z'
  440.  
  441. The 'Z' command will change the current default matrix.  From this point on,
  442. all subsequent commands which do NOT contain an explicit matrix name will
  443. refer to this matrix, and this matrix will be displayed before each command
  444. (unless the 'z_print' option has been set to 'no', see 'set' for more info).
  445. Initially, the program starts up with the 'answer' matrix as the default.
  446. If the current default matrix is cleared (either 'killed' or has 0 columns
  447. or rows), the 'answer' matrix will again become the default.
  448.  
  449. Form:
  450.     > z m
  451.  
  452. Examples:
  453.     > z happy             -- Make the Matrix 'happy' the Default
  454.  
  455. See Also:
  456.     Objects, Set.
  457. @g?@ GET: Abbreviation 'G'
  458.  
  459. GET allows the user to retrieve a matrix from memory and place it in the
  460. default.  It works in much the same way as a calculator with a recall memory
  461. key.  The name of the default matrix remains the same, and the source
  462. matrix is unaffected.  This command does exactly the same thing as the
  463. COPY command in the form '> copy default_matrix source_matrix', or more simply
  464. as '> copy source_matrix'.  GET is the opposite of PUT.
  465.  
  466. Form:
  467.     > get m               -- Makes a copy of 'm' in the default matrix
  468.  
  469. Examples:
  470.     > get happy           -- Make a copy of 'happy' in the Default Matrix
  471.  
  472. See Also:
  473.     COPY, PUT, SWAP, Objects.
  474. @du@ DUMP: Abbreviation 'DU'
  475.  
  476. DUMP will display all of the matrices that are currently in memory.  All
  477. matrices which have nothing in them (0x0 Matrix) and all system matrices
  478. (starting with '__') will not be displayed.  The default matrix will be
  479. displayed after the others have been displayed, as it normally would be.
  480. This command is equivalent to do a standard PRINT on all of the matrices
  481. in memory.
  482.  
  483. Form:
  484.     > dump
  485.  
  486. Examples:
  487.     > dump                -- Outputs All Matrices Currently in Memory
  488.  
  489. See Also:
  490.     PRINT, LIST, FDUMP, Objects.
  491. @d?@ DETERMINANT: Abbreviation 'D'
  492.  
  493. This function will calculate the Determinant of a given matrix.  As usual,
  494. the given matrix must be square.  The method by which this calculation is
  495. done, is to form an Upper Triangular (just as if it had been done by the
  496. user, with the set attributes in effect) and to multiply together the
  497. diagonal.  The determinant is displayed on the screen, and is NOT stored
  498. anywhere.
  499.  
  500. Form:
  501.     > determinant [m]      -- Calculates Determinant of Matrix 'm'
  502.  
  503. Examples:
  504.     > load happy                             -- Load a Matrix
  505.     1> 1/2 3/4 5/6
  506.     2> 9.23 4/3 1/2
  507.     3> 3/4 45/2 3
  508.     4>
  509.     > determinant happy                      -- Calculate Determinant
  510.     Determinant of 'happy': 355483/2400
  511.  
  512. See Also:
  513.     UPPER_TRIANGULAR, Objects.
  514. @t?' TRANSPOSE: Abbreviation 'T', '''
  515.  
  516. Transpose will swap the A[i][j] with the A[j][i] of a given matrix.  Thus,
  517. an M x N matrix will have the size N x M, and all the columns will be
  518. swapped with the rows, and the rows with the columns.  Obviously, the
  519. transpose of the transpose will result in the original matrix.
  520.  
  521. Form:
  522.     > transpose [m]             -- Transpose Matrix 'm'
  523.  
  524. Examples:
  525.     > print happy               -- The Original 'happy'
  526.     happy:
  527.       1    2    3
  528.       4    5    6
  529.     > transpose happy           -- After Being Transposed
  530.     happy:
  531.       1    4
  532.       2    5
  533.       3    6
  534.  
  535. See Also:
  536.     Objects
  537. @u?@ UPPER_TRIANGULAR: Abbreviation 'U'
  538.  
  539. The given matrix will be manipulated (with basic row operations) until
  540. the upper triangular property is satisfied.  This property is:
  541.  
  542.     1. Any row consisting only of zeros is below any row that
  543.        contains at least one non-zero entry.
  544.     2. The first (reading from left to right) non-zero entry of any row
  545.        is to the left of the first non-zero entry of any lower row.
  546.  
  547. Two set variables control the behavior of the basic row operations.  The
  548. Upper_Triangular_Swap allows for swapping as one of the possible basic
  549. operations (normally, this is fine, and the default is to allow it).  If
  550. Swaps are allowed, non-zero entries (in each column) are always favored;
  551. between these, the Triangular_Seek variable controls if high or low numbers
  552. are favored at the top of the matrix (normally, this is small; but it has
  553. been shown that seeking for larger numbers may give better results).
  554.  
  555. By using this command with the lower triangular command, row-reduced
  556. echelon form may be obtained.
  557.  
  558. Form:
  559.     > utriangular [m]                     -- Satisfy Upper Triangular
  560.  
  561. Examples:
  562.     > set upper_triangular_swap yes       -- OK to swap (the default)
  563.     > set triangular_seek small           -- Go for the Small Guys
  564.     > load happy                          -- Load up a matrix
  565.     1> 2 -3 -1 2 3 4
  566.     2> 4 -4 -1 4 11 4
  567.     3> 2 -5 -2 2 -1 9
  568.     4> 0 2 1 0 4 -5
  569.     5>
  570.     happy:                                -- Display of the Matrix Entered
  571.         2   -3   -1    2    3    4
  572.         4   -4   -1    4   11    4
  573.         2   -5   -2    2   -1    9
  574.         0    2    1    0    4   -5
  575.     > utriangular happy                   -- Make it Upper Triangular
  576.     happy:
  577.         2   -3   -1    2    3    4
  578.         0    2    1    0    5   -4
  579.         0    0    0    0    1    1
  580.         0    0    0    0    0    0
  581.     >
  582.  
  583. See Also:
  584.     SOLVE, LOWER_TRIANGULAR, SET, Objects
  585. @se@ SET: Abbreviation 'SE'
  586.  
  587. The set command sets certain attributes of the commands.  Alone, the set
  588. command will display the current settings, which by default are:
  589.  
  590.         > set
  591.         upper_triangular_swap = yes
  592.         lower_triangular_swap = no
  593.         triangular_seek = small
  594.         solve_type = augmented
  595.         display_mode = fraction
  596.         z_print = yes
  597.         width = 4.4
  598.         num_lines = 24                    (varies from machine to machine)
  599.         print_separation = ' '
  600.  
  601. To change one of these items, use the command in the form:
  602. [the item and the value may be abbreviated by their first letter]
  603.  
  604.         > set item = value
  605.  
  606. The set items and their valid values are:
  607.  
  608.         upper_triangular_swap = yes | no
  609.  
  610.             This variable controls wether swapping is permitted when
  611.             calculating the upper triangular version of a matrix.  Normally,
  612.             it is desireable to have this set to 'yes', so that if a number
  613.             can be moved (which is also depends on the 'triangular_seek' item,
  614.             and the ordering of the values in the column being processed),
  615.             the program will go ahead and do it.  Since the determinant
  616.             function also uses upper triangular, this set variable may effect
  617.             the values for the determinants (as well as solves).
  618.  
  619.         lower_triangular_swap = yes | no
  620.  
  621.             This variable controls wether swapping is permitted when
  622.             calculating the lower triangular version of a matrix.  When
  623.             used after an upper_triangular command, it would be desired
  624.             to have this value 'no', so as a row-echelon matrix results.
  625.  
  626.         triangular_seek = big | small
  627.  
  628.             This determines which values are most desirable at the top of
  629.             the column (row) when doing upper_triangular (lower_triangular)
  630.             operations.  It has been shown that better results are obtained
  631.             with bigger numbers at the top, while smaller numbers keep the
  632.             values in the matrix down as far as possible.
  633.  
  634.         solve_type = homogeneous | augmented
  635.  
  636.             The matrix to be solved is described by this variable.  If the
  637.             matrix is homogeneous (all equations equal to zero, with this
  638.             column not being represented), then use this value.  Otherwise,
  639.             it will expect the last column to be equal to the values of the
  640.             equations.
  641.  
  642.         display_type = fraction | mixed | decimal | exponential
  643.  
  644.             All output to the terminal, and to the files, is controlled through
  645.             this set value.  The actual numbers inside the matrix are not
  646.             changed by a change to this set variable, only how they are output.
  647.  
  648.             As an example, assume the numbers are entered in the following way:
  649.             [see 'help scalers' for more information on internal
  650.             representations of the numbers]
  651.  
  652.                     1/2       27/5       -.43       1.234e10
  653.  
  654.             fraction:     Display the number as a numerator and denominator
  655.  
  656.                     1/2       27/5      -43/100     1.234e10
  657.  
  658.             mixed:        Display the number as a whole number and a fraction
  659.  
  660.                     1/2       5+2/5     -43/100     1.234e10
  661.  
  662.             decimal:      Display the numbers in floating point
  663.  
  664.                     .5         5.4       -.43       1.234e10
  665.  
  666.             exponential:  Display the numbers in scientific notation
  667.  
  668.                     5e-1      5.4e0     -4.3e-1     1.234e10
  669.  
  670.         z_print = yes | no
  671.  
  672.             Normally, before each command, the default matrix is printed.
  673.             With this variable set to 'no', the default matrix will not be
  674.             printed, only its name will appear.
  675.  
  676.         width = num1.num2, num1 and num2 are arbitrary (>=0)
  677.  
  678.             Width controls how the numbers are output, how much space is
  679.             dedicated to each of the numbers, so that if each number will fit
  680.             in a particular width, then the numbers will line up vertically
  681.             quite nicely.
  682.  
  683.         num_lines = num, num is arbitrary (>=0)
  684.  
  685.             Num_lines controls how many lines there are on your terminal.
  686.             Normally, this is filled in for you.  An entry of '0' means that
  687.             your terminal has infinite number of lines, and no page pausing
  688.             will take place.
  689.  
  690.         print_separation = 'c', c is an arbitrary character
  691.  
  692.             This is the character which is placed between entries across
  693.             on the matrix.  Normally, it is ok to use a '<space>', but
  694.             sometimes, numbers may start to collide with one another, in
  695.             which case a '|' might be nice to resolve which column things
  696.             are in.
  697. @so@ SOLVE: Abbreviation 'SO'
  698.  
  699. Solves a Matrix (or rather the linear system represented by the matrix).
  700. It will solve the matrix, and return the result as a linear combination
  701. of vectors which represent the solution's sub-space.  Depending on the
  702. SET variable 'solve_type', a homogeneous or augmented matrix may be solved.
  703. The matrix is solved by using Upper Triangular, and then Back Substitution,
  704. where appropriate adding parameters as it goes.  The result is returned to
  705. the screen and NOT stored.  If it is an augmented matrix, a inconsistent
  706. system will be reported to the user.  Parameters are assigned the letters
  707. 's' through 'z', then 'a' through 'z', etc.
  708.  
  709. For those not familiar with the vector solution:  If you just want the
  710. solution, it will appear as the first vector.  If there is more than one
  711. vector, than there are an infinite number of solutions, and the parameters
  712. govern the qualifications for a valid solution.  But, if you just need
  713. one solution, take the top vector (the one without a parameter); it
  714. should always be a valid solution.
  715.  
  716. Form:
  717.     > solve [m]
  718.  
  719. Examples:
  720.     > set solve_type augmented  -- We are going to solve an augmented equation
  721.     > load happy                -- Load the Matrix to Solve
  722.     1>1 2 3 4
  723.     2>5 6 7 8
  724.     3>9 10 11 12
  725.     4>
  726.     > solve happy               -- Solve Matrix 'Happy'
  727.     Vector Solution to 'happy':
  728.      (  -2,  3,  0 )+
  729.     s(   1, -2,  1 )
  730.  
  731. See Also:
  732.     UPPER_TRIANGULAR, SET, Objects.
  733. @id@ IDENTITY: Abbreviation 'ID'
  734.  
  735. Identity will build an identity matrix into a matrix of the specified
  736. size.  If no matrix name is given, the current default matrix is used.
  737. If no size is given, the current default matrix's size is used (allowing
  738. an identity matrix to be built of the same size in another matrix).
  739.  
  740. Form:
  741.     > identity [m] [r c]
  742.  
  743. Examples:
  744.     > identity r5 c5            -- Build a 5x5 identity into current matrix
  745.     (default) happy:
  746.       1  0  0  0  0
  747.       0  1  0  0  0
  748.       0  0  1  0  0
  749.       0  0  0  1  0
  750.       0  0  0  0  1
  751.     > identity howdy            -- Build 5x5 identity into howdy
  752.     > identity spam r3 c3       -- Build 3x3 identity into spam
  753.  
  754. See Also:
  755.     Objects
  756. @i?` INVERSE: Abbreviation 'I', '`'
  757.  
  758. Inverse will calculate the inverse of a matrix.  The Matrix specified will be
  759. inverted, and will replace that matrix.  Thus, if you still need a copy of
  760. the original matrix, store it in another memory location before invoking this
  761. command.  The matrix must be invertible, which implies that it must be
  762. square and it's determinant not equal to zero.  The procedure used is the
  763. standard concatenation with the identity matrix [A|I], where an upper
  764. triangular is made, and then a lower, and then subsequent divisions until
  765. the matrix is on the left is the identity matrix [I|A`].  The calls to
  766. Upper_Triangular are controlled by the set variable (for swaps).  Obviously,
  767. the inverse of the inverse is the original matrix.
  768.  
  769. Form:
  770.     > inverse [m]
  771.  
  772. Examples:
  773.     > load happy                    -- Load the Matrix to be Inverted
  774.     1> 9 8 3
  775.     2> 4 5 2
  776.     3> 2 3 1
  777.     > put copy_happy                -- Make a Copy, so We can Multiply Later
  778.     > inverse happy                 -- Invert the Matrix 'Happy'
  779.     > print happy                   -- Display the Inverse Matrix
  780.     happy:
  781.       1/3    -1/3    -1/3
  782.       0      -1       2
  783.      -2/3    11/3   -13/3
  784.     > multiply happy copy_happy     -- Multiply by Original, Have ID Matrix
  785.     happy:
  786.       1       0       0
  787.       0       1       0
  788.       0       0       1
  789.  
  790. See Also:
  791.     UPPER_TRIANGULAR, SET, MULTIPLY, Objects.
  792. @e?@ EVAL: Abbreviation 'E'
  793.  
  794. Eval will evaluate a matrix expression.  This expression can consist of any
  795. previously loaded matrices, operators (*, +, -, ', `, =), scalers, or
  796. parenthesis.  The valid operators, and their level of precedence are (the
  797. horizontal bars separate these levels):
  798.  
  799.     FORM        EXAMPLES            COMMENTS
  800.     Highest Level of Precedence
  801.     ()          A*(B+C)             Multiply A by the sum of B and C
  802.                 (A+(B*D*E)')`       Multiply A by the transpose of the product
  803.                                     of B, D, and E.  Then Invert it.
  804.     ----------------------------
  805.     '           A'                  Transpose of A
  806.     `           B`                  Inverse of B
  807.                 C'`                 Inverse of the Transpose of C
  808.     ----------------------------
  809.     -           A * -B              Product of A and -B (B * -1)
  810.     ----------------------------
  811.     *           A * B               Produce of A and B
  812.                 A + B * C           Sum of A and the Product of B and C
  813.     ----------------------------
  814.     +           A + B               Sum of A and B
  815.     Lowest Level of Precedence
  816.  
  817. All operators evaluate from left to right, and all operators on the same
  818. level evaluate from left to right.  If the equal sign is missing, the default
  819. matrix is used to hold the answer.  If an equal sign is present, it must
  820. appear behind a matrix name, and before the expression, as in:
  821.  
  822.     > eval A = ((B * C)' + (C * U)`) * E
  823.  
  824. If an error occurs in the processing, the matrix that the result would have
  825. been stored in will be unchanged.  All the different operations map directly
  826. into the standard commands themselves.  Thus, the answer received should be
  827. the same as the answer received by the user using all of the basic commands.
  828.  
  829. Form:
  830.     > eval [m =] expression         -- Evaluate Expression
  831.  
  832. See Also:
  833.     MULTIPLY, ADD, TRANSPOSE, INVERSE, Objects
  834. @fd@ FDUMP: Abbreviation 'FD'
  835.  
  836. FDUMP stands for File Dump, and basically the same thing that occurs when
  837. one does a DUMP to the screen will be done, except that output will be sent
  838. to a file that you name.  This file can then be looked at outside of the the
  839. program (with a standard text editor) or later FLOADed back into the program.
  840. The matrices in the file will also contain their appropriate sizes (r? and c?).
  841. All information in the file prior to this command will be lost.
  842.  
  843. Form:
  844.     > fdump filename            -- Dumps all matrices in memory to FileName
  845.  
  846. Examples:
  847.     > fdump happy.out           -- Write to File 'happy.out', all of memory
  848.  
  849. See Also:
  850.     DUMP, FLOAD, FPRINT, LIST, Objects
  851. @fp@ FPRINT: Abbreviation 'FP'
  852.  
  853. FPRINT stands for File Print, and basically will save the contents of a matrix
  854. into the designated file.  Only one matrix will be saved, as opposed to
  855. FDUMP, in which all of memory is saved.  The form of the output is exactly the
  856. same as the form of a PRINT, except that the size is included on the output
  857. (that is, the size of the matrix, in r? and c?).  All information in the
  858. file prior to this command will be lost.  Matrices saved can be read by
  859. FLOAD, or any text editor.  Note that the standard matrix conventions
  860. concerning the default matrix act differently for this command.
  861.  
  862. Form:
  863.     > fprint filename [m]    -- Dumps matrix 'm' into FileName
  864.  
  865. Examples:
  866.     > fprint howdy.out       -- Write the default matrix into 'howdy.out'
  867.     > fprint fox.out fox     -- Write the matrix 'fox' to the file 'fox.out'
  868.  
  869. See Also:
  870.     FDUMP, DUMP, FLOAD, Objects
  871. @fl@ FLOAD: Abbreviation 'FL'
  872.  
  873. FLOAD stands for File Load, and basically will load matrices from a File.
  874. It reads the same format as the FPRINT and FDUMP commands, which consists of
  875. one or more matrices of the following format:
  876.  
  877.         === Top of File ===
  878.  
  879.         name_of_the_matrix: [r? c?]
  880.            matrix[1][1]   matrix[1][2]  ....
  881.            matrix[2][1]   ....
  882.            ....
  883.  
  884.         name_of_second_matrix  [r? c?]
  885.            matrix2[1][1]   ....
  886.            ....
  887.  
  888.         === Bottom of File ===
  889.  
  890. Basically it is the same as a Load command, and the same type of scalers can
  891. be input here.  The row and column specification is not necessary, but it
  892. is output by the FPRINT and FDUMP commands, and is generally a good idea.
  893. It is not mandatory; if they are not there, then the implicit load will be
  894. assumed.
  895.  
  896. All matrices in the file will be restored back into memory.  Matrices in the
  897. file must be separated by at least one blank line.
  898.  
  899. Form:
  900.     > fload filename            -- Load matrices from Filename
  901.  
  902. Examples:
  903.     > fload happy.out           -- Load all matrices from 'happy.out'
  904.  
  905. See Also:
  906.     FDUMP, FPRINT, LOAD, Objects
  907. @fm@ FMACRO: Abbreviation 'FM'
  908.  
  909. File Macro will read subsequent commands from 'filename' until the end of
  910. that file is reached.  These commands will be echoed on the screen, as each
  911. one is executed.  Unfortunately, at this time, there is no way to nest
  912. file macros.  All commands are just as if you had typed them at the keyboard.
  913. At the end of file, control is returned to the keyboard.
  914.  
  915. Form:
  916.     > fmacro FileName               -- Read Commands from FileName
  917. @m?* MULTIPLY: Abbreviation 'M', '*'
  918.  
  919. Multiply will multiply two matrices together, a row/column by a scaler, or
  920. a matrix by a scaler (which is solely defined by the input).  If two matrices
  921. are to be multiplied, the number of columns of the first matrix must equal
  922. the number of rows of the second matrix.
  923.  
  924. Form:
  925.     > multiply m            -- Multiply Default Matrix by another Matrix
  926.     > multiply m1 m2        -- Multiply Two Matrices, Answer back in 'm1'
  927.     > multiply [m] s        -- Multiply Matrix by a Scaler
  928.     > multiply [m] r/c s    -- Multiply Row/Column by a Scaler
  929.  
  930. Examples:
  931.     > multiply -3/45        -- Multiplies Default Matrix by -3/45
  932.     > multiply happy        -- Multiplies Default Matrix by Matrix 'Happy'
  933.     > multiply tiger fox    -- Multiplies Matrix 'Tiger' by Matrix 'Fox'
  934.     > multiply snake 98/3   -- Multiplies Matrix 'Snake' by 98/3
  935.     > multiply r4 -87/2     -- Multiplies Row 4 of the Default Matrix by -87/2
  936.     > multiply heart c6 5/2 -- Multiply Column 6 of 'heart' by 5/2
  937.  
  938. See Also:
  939.     DIVIDE, ADD, SUBTRACT, Objects
  940. @a?+ ADD: Abbreviation 'A', '+'
  941.  
  942. Add will add two matrices or two rows/columns.  If two matrices are to be
  943. added, the sizes of the matrices (both in rows and columns) must be equal.
  944.  
  945. Form:
  946.     > add m                 -- Add another matrix to the default matrix
  947.     > add m1 m2             -- Add two matrices, Result in 'm1'
  948.     > add [m] r/c1 r/c2     -- Add 'r/c2' to 'r/c1'
  949.  
  950. Examples:
  951.     > add happy             -- Add matrix 'happy' to the default matrix
  952.     > add fox trot          -- Add matrix 'trot' to matrix 'fox'
  953.     > add r3 r4             -- Add Row 4 to Row 3 in the default matrix
  954.     > add hi c3 c1          -- Add Column 1 to Column 3 in matrix 'hi'
  955.  
  956. See Also:
  957.     REDUCE, SUBTRACT, MULTIPLY, DIVIDE, Objects
  958. @r?@ REDUCE: Abbreviation 'R'
  959.  
  960. Reduce will multiply a scaler by a row/column and then add the result to
  961. another row/column.  Operations are from rows to rows, or columns to columns.
  962. Algebraically it looks something like:
  963.  
  964.     row/column[i] := row/column[i] + (row/column[j] * s)
  965.  
  966. Form:
  967.     > reduce [m] r/c1 r/c2 s    -- Both of these forms do the same thing,
  968.     > reduce [m] r/c1 s r/c2    -- namely, r/c1 := r/c1 + (r/c2 * s)
  969.  
  970. Examples:
  971.     > load                      -- Load the Default Matrix
  972.     1> 1 2 3
  973.     2> 4 5 6
  974.     3> 7 8 9
  975.     4>
  976.     > reduce r2 r1 3            -- Add to r2, r1 * 3
  977.     (default):
  978.       1    2    3
  979.       7   11   15
  980.       7    8    9
  981.     > reduce c3 c1 1/2          -- Add to c3, c1 / 2
  982.     (default):
  983.       1    2    7/2
  984.       7   11   37/2
  985.       7    8   25/2
  986.  
  987. See Also:
  988.     ADD, MULTIPLY, SUBTRACT, DIVIDE, Objects
  989. @c?@ COPY: Abbreviation 'C'
  990.  
  991. Copy will copy a Matrix from one Matrix name to another.  The original matrix
  992. will be unaltered, and the contents that were in the destination matrix will
  993. be lost.  Copy does not simply bind one matrix name to another, it will make
  994. a literal copy.  The two matrices can then be used independently of one
  995. another.  If the default is specified as the destination matrix, then this
  996. command works just like a 'get' command.
  997.  
  998. Form:
  999.     > copy [m1] m2              -- Copies from 'm2' to 'm1' (or default)
  1000.  
  1001. Examples:
  1002.     > copy happy                -- Makes a copy of 'happy' in default (GET)
  1003.     > copy fox trot             -- Makes a copy of 'trot' in 'fox'
  1004.  
  1005. See Also:
  1006.     GET, PUT, Objects
  1007. @s?@ SWAP: Abbreviation 'S'
  1008.  
  1009. Swap will swap two rows/columns or two matrices.  If two rows/columns are
  1010. to be swapped, each element on the row/column will be swapped with the
  1011. corresponding element on the other row/column.  Rows can be swapped with
  1012. Rows, and Columns can be swapped with Columns.  If two matrices are swapped,
  1013. the effect is if the two names had been swapped, the data is left alone.
  1014.  
  1015. Form:
  1016.     > swap [m] r/c1 r/c2        -- Swap r/c1 with r/c2 in matrix 'm'
  1017.     > swap [m1] m2              -- Swap m1 with m2
  1018.  
  1019. Examples:
  1020.     > load happy
  1021.     1> 1 2 3
  1022.     2> 4 5 6
  1023.     3> 7 8 9
  1024.     > swap happy r1 r3
  1025.     happy:
  1026.       7   8   9
  1027.       4   5   6
  1028.       1   2   3
  1029.     > z happy
  1030.     > swap c2 c1
  1031.     (default) happy:
  1032.       7   9   8
  1033.       4   6   5
  1034.       1   3   2
  1035.     > swap happy howdy
  1036.  
  1037. See Also:
  1038.     MULTIPLY, ADD, REDUCE, COPY, GET, PUT, Objects
  1039. @k?@ KILL: Abbreviation 'K'
  1040.  
  1041. Kill will remove a matrix from memory.  Once this is done, the data will
  1042. be unrecoverable, so use this command with care.  Note that the default
  1043. matrix can not be specified implicitly, simply as a safety measure.
  1044.  
  1045. Form:
  1046.     > kill m                    -- Kills matrix 'm', Removes it from Memory
  1047.  
  1048. Examples:
  1049.     > kill happy                -- Kills matrix 'happy'
  1050.  
  1051. See Also:
  1052.     GET, PUT, Objects
  1053. @q?@ QUIT: Abbreviation 'Q'
  1054.  
  1055. Quit will exit the Monkey program, and get back to the operating system.
  1056. It will first prompt you to insure that indeed you wish to leave (an answer
  1057. beginning with a 'y' or 'Y' is considered a yes).  Obviously, any matrices
  1058. in memory will be lost (you may want to FDUMP prior to doing this).
  1059.  
  1060. Form:
  1061.     > quit
  1062.  
  1063. See Also:
  1064.     FDUMP, FLOAD, Objects
  1065. @@
  1066.