{"id":2970,"date":"2018-02-05T12:00:15","date_gmt":"2018-02-05T17:00:15","guid":{"rendered":"https:\/\/blogs.mathworks.com\/cleve\/?p=2970"},"modified":"2018-02-06T10:27:37","modified_gmt":"2018-02-06T15:27:37","slug":"the-historic-matlab-users-guide","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/cleve\/2018\/02\/05\/the-historic-matlab-users-guide\/","title":{"rendered":"The Historic MATLAB Users&#8217; Guide"},"content":{"rendered":"<div class=\"content\"><!--introduction--><p>In the 1970s and early 1980s, while I was working on the <a href=\"https:\/\/blogs.mathworks.com\/cleve\/2018\/01\/23\/linpack-linear-equation-package\">LINPACK<\/a> and <a href=\"https:\/\/blogs.mathworks.com\/cleve\/2018\/01\/02\/eispack-matrix-eigensystem-routines\">EISPACK<\/a> projects that I discussed in two previous posts, I was a Professor of Mathematics and then of Computer Science at the University of New Mexico in Albuquerque. I was teaching courses in Linear Algebra and Numerical Analysis. I wanted my students to have easy access to LINPACK and EISPACK without writing  Fortran programs.  By \"easy access\" I meant not going through the remote batch processing and the repeated edit-compile-link-load-execute process that was ordinarily required on the campus central mainframe computer.<\/p><p>So, I studied Niklaus Wirth's book <i>Algorithms + Data Structures = Programs<\/i> and learned how to parse programming languages.  Wirth calls his example language PL\/0.  (A <i>zinger<\/i> aimed at PL\/I, the monolithic, committee-designed language being promoted by IBM and the U.S. Defense Department at the time.)  PL\/0 was a pedagogical subset of Wirth's Pascal, which, in turn, was his response to Algol. Quoting Wirth, \"In the realm of data types, however, PL\/0 adheres to the demand of simplicity without compromise: integers are its only data type.\"<\/p><p>Following Wirth's approach, I wrote the first MATLAB -- an acronym for Matrix Laboratory -- in Fortran, as a dialect of PL\/0 with matrix as the only data type.  The project was a kind of hobby, a new aspect of programming for me to learn and something for my students to use.  There was never any formal outside support and certainly no business plan.  MathWorks was a few years in the future.<\/p><p>This first MATLAB was not a programming language; it was just a simple interactive matrix calculator.  There were no m-files, no toolboxes, no graphics.  And no ODEs or FFTs. This snapshot of the start-up screen shows all the reserved words and functions. There are only 71 of them.  If you wanted to add another function, you would get the source code from me, write a Fortran subroutine, add your new name to the parse table, and recompile MATLAB.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/cleve\/files\/what.png\" alt=\"\"> <\/p><p>Here is the first Users' Guide, in its entirety, from 1981.<\/p><!--\/introduction--><h3>Contents<\/h3><div><ul><li><a href=\"#d628e14a-b996-4466-956b-5bffbebb3185\">Users' Guide<\/a><\/li><li><a href=\"#c9424a9c-4b04-4592-a306-6982477c559c\">1.  Elementary operations<\/a><\/li><li><a href=\"#89e95492-9829-41fc-a176-efecd2a7058a\">2.  MATLAB functions<\/a><\/li><li><a href=\"#b3d89f07-feea-45d1-9d4f-819d0c9dde6c\">3.  Rows, columns and submatrices<\/a><\/li><li><a href=\"#5ef5f8a1-00bf-4ba3-8665-ee119735ab87\">4.  FOR, WHILE and IF<\/a><\/li><li><a href=\"#6cc09bdb-128b-4e44-ac00-87212f4721fb\">5.  Commands, text, files and macros.<\/a><\/li><li><a href=\"#70f0981b-41e3-49d1-8660-63420a6d81c2\">6.  Census example<\/a><\/li><li><a href=\"#8739d432-c5e3-469a-bab3-d50dbab976cc\">7.  Partial differential equation example<\/a><\/li><li><a href=\"#fc4c85ff-61c4-44ac-af8e-ebb62c8ec439\">8.  Eigenvalue sensitivity example<\/a><\/li><li><a href=\"#17336a39-c078-4383-870a-f855af36b9f0\">9.  Syntax diagrams<\/a><\/li><li><a href=\"#bb3c2050-6d2e-4162-9f13-5c348036a7be\">10.  The parser-interpreter<\/a><\/li><li><a href=\"#b60d8a32-affb-4040-9e97-b22eab56e16a\">11.  The numerical algorithms<\/a><\/li><li><a href=\"#51e52b1a-7f48-45ae-8688-acf2b7f910dc\">12.  FLOP and CHOP<\/a><\/li><li><a href=\"#28a145d0-40af-4836-a44a-946a10942a6a\">13.  Communicating with other programs<\/a><\/li><li><a href=\"#563524e7-7415-4226-b8d4-45d40a500685\">Appendix.  The HELP document<\/a><\/li><\/ul><\/div><h4>Users' Guide<a name=\"d628e14a-b996-4466-956b-5bffbebb3185\"><\/a><\/h4><pre>                         MATLAB Users' Guide\r\n                              May, 1981<\/pre><pre>                             Cleve Moler\r\n                   Department of Computer Science\r\n                      University of New Mexico<\/pre><pre>       ABSTRACT.  MATLAB is an  interactive  computer  program\r\n       that   serves   as   a   convenient   \"laboratory\"  for\r\n       computations  involving  matrices.   It  provides  easy\r\n       access  to matrix software developed by the LINPACK and\r\n       EISPACK projects.  The program is  written  in  Fortran\r\n       and  is  designed  to  be  readily  installed under any\r\n       operating system which permits interactive execution of\r\n       Fortran programs.<\/pre><pre>       MATLAB is an interactive computer program that serves  as  a\r\n  convenient  \"laboratory\" for computations involving matrices.  It\r\n  provides easy access to matrix software developed by the  LINPACK\r\n  and EISPACK projects [1-3].  The capabilities range from standard\r\n  tasks such as solving simultaneous linear equations and inverting\r\n  matrices, through symmetric and nonsymmetric eigenvalue problems,\r\n  to fairly sophisticated matrix tools such as the  singular  value\r\n  decomposition.<\/pre><pre>       It is expected that one of MATLAB's primary uses will be  in\r\n  the  classroom.   It  should be useful in introductory courses in\r\n  applied linear algebra, as  well  as  more  advanced  courses  in\r\n  numerical analysis, matrix theory, statistics and applications of\r\n  matrices to other disciplines.  In nonacademic  settings,  MATLAB\r\n  can  serve as a \"desk calculator\" for the quick solution of small\r\n  problems involving matrices.<\/pre><pre>       The program is written in Fortran  and  is  designed  to  be\r\n  readily  installed  under  any  operating  system  which  permits\r\n  interactive  execution  of  Fortran  programs.    The   resources\r\n  required  are  fairly  modest.  There are less than 7000 lines of\r\n  Fortran  source  code,  including   the   LINPACK   and   EISPACK\r\n  subroutines  used.   With  proper use of overlays, it is possible\r\n  run the system on a minicomputer with only 32K bytes of memory.<\/pre><pre>       The size of the matrices  that  can  be  handled  in  MATLAB\r\n  depends  upon  the  amount  of storage that is set aside when the\r\n  system is compiled on a particular machine.  We have  found  that\r\n  an  allocation of 5000 words for matrix elements is usually quite\r\n  satisfactory.  This provides room for several 20 by 20  matrices,\r\n  for  example.   One  implementation  on  a  virtual memory system\r\n  provides 100,000 elements.  Since most  of  the  algorithms  used\r\n  access  memory  in  a  sequential  fashion,  the  large amount of\r\n  allocated storage causes no difficulties.<\/pre><pre>       In some ways, MATLAB  resembles  SPEAKEASY  [4]  and,  to  a\r\n  lesser  extent, APL.  All are interactive terminal languages that\r\n  ordinarily accept single-line  commands  or  statements,  process\r\n  them  immediately,  and  print  the  results.  All have arrays or\r\n  matrices as principal data types.  But for MATLAB, the matrix  is\r\n  the  only  data  type  (although  scalars,  vectors  and text are\r\n  special cases), the underlying system is  portable  and  requires\r\n  fewer resources, and the supporting subroutines are more powerful\r\n  and, in some cases, have better numerical properties.<\/pre><pre>       Together, LINPACK and EISPACK represent the state of the art\r\n  in software for matrix computation.  EISPACK is a package of over\r\n  70 Fortran subroutines for various matrix eigenvalue computations\r\n  that are based for the most part on Algol procedures published by\r\n  Wilkinson, Reinsch  and  their  colleagues  [5].   LINPACK  is  a\r\n  package  of  40  Fortran subroutines (in each of four data types)\r\n  for solving  and  analyzing  simultaneous  linear  equations  and\r\n  related matrix problems.  Since MATLAB is not primarily concerned\r\n  with either execution time  efficiency  or  storage  savings,  it\r\n  ignores  most  of  the special matrix properties that LINPACK and\r\n  EISPACK subroutines  use  to  advantage.   Consequently,  only  8\r\n  subroutines   from  LINPACK  and  5  from  EISPACK  are  actually\r\n  involved.<\/pre><pre>       In  more  advanced  applications,  MATLAB  can  be  used  in\r\n  conjunction  with other programs in several ways.  It is possible\r\n  to define new MATLAB functions and add them to the system.   With\r\n  most  operating  systems,  it  is  possible to use the local file\r\n  system to  pass  matrices  between  MATLAB  and  other  programs.\r\n  MATLAB  command  and statement input can be obtained from a local\r\n  file  instead  of  from  the  terminal.   The  most   power   and\r\n  flexibility  is obtained by using MATLAB as a subroutine which is\r\n  called by other programs.<\/pre><pre>       This document first gives an overview  of  MATLAB  from  the\r\n  user's  point  of  view. Several extended examples involving data\r\n  fitting, partial differential equations,  eigenvalue  sensitivity\r\n  and other topics are included.  A formal definition of the MATLAB\r\n  language and an brief description of the parser  and  interpreter\r\n  are   given.   The  system  was  designed  and  programmed  using\r\n  techniques described by Wirth [6], implemented  in  nonrecursive,\r\n  portable  Fortran.   There  is  a brief discussion of some of the\r\n  matrix algorithms and of their numerical properties.   The  final\r\n  section  describes  how  MATLAB  can be used with other programs.\r\n  The appendix includes the HELP documentation available on-line.<\/pre><h4>1.  Elementary operations<a name=\"c9424a9c-4b04-4592-a306-6982477c559c\"><\/a><\/h4><pre>       MATLAB works with essentially only one  kind  of  object,  a\r\n  rectangular matrix with complex elements.  If the imaginary parts\r\n  of the elements are all zero, they  are  not  printed,  but  they\r\n  still  occupy  storage.   In  some situations, special meaning is\r\n  attached to 1 by 1 matrices, that is scalars, and to 1 by n and m\r\n  by 1 matrices, that is row and column vectors.<\/pre><pre>       Matrices can be introduced into  MATLAB  in  four  different\r\n  ways:\r\n          --  Explicit list of elements,\r\n          --  Use of FOR and WHILE statements,\r\n          --  Read from an external file,\r\n          --  Execute an external Fortran program.<\/pre><pre>       The explicit list is surrounded by angle brackets,  '&lt;'  and\r\n  '&gt;', and uses the semicolon ';' to indicate the ends of the rows.\r\n  For example, the input line<\/pre><pre>     A = &lt;1 2 3; 4 5 6; 7 8 9&gt;<\/pre><pre>  will result in the output<\/pre><pre>     A     =<\/pre><pre>         1.    2.   3.\r\n         4.    5.   6.\r\n         7.    8.   9.<\/pre><pre>  The matrix A  will  be  saved  for  later  use.   The  individual\r\n  elements  are separated by commas or blanks and can be any MATLAB\r\n  expressions, for example<\/pre><pre>     x = &lt; -1.3, 4\/5, 4*atan(1) &gt;<\/pre><pre>  results in<\/pre><pre>     X     =<\/pre><pre>       -1.3000   0.8000   3.1416<\/pre><pre>  The elementary functions available include sqrt, log,  exp,  sin,\r\n  cos, atan, abs, round, real, imag, and conjg.<\/pre><pre>       Large matrices can be spread  across  several  input  lines,\r\n  with  the  carriage  returns replacing the semicolons.  The above\r\n  matrix could also have been produced by<\/pre><pre>     A = &lt; 1 2 3\r\n           4 5 6\r\n           7 8 9 &gt;<\/pre><pre>       Matrices can be input from the local  file  system.   Say  a\r\n  file named 'xyz' contains five lines of text,<\/pre><pre>     A = &lt;\r\n     1 2 3\r\n     4 5 6\r\n     7 8 9\r\n     &gt;;<\/pre><pre>  then the  MATLAB  statement  EXEC('xyz')  reads  the  matrix  and\r\n  assigns it to A .<\/pre><pre>       The FOR statement allows the generation  of  matrices  whose\r\n  elements  are  given  by  simple formulas.  Our example matrix  A\r\n  could also have been produced by<\/pre><pre>     for i = 1:3, for j = 1:3, a(i,j) = 3*(i-1)+j;<\/pre><pre>  The semicolon at the end of the  line  suppresses  the  printing,\r\n  which  in  this  case  would  have  been  nine versions of A with\r\n  changing elements.<\/pre><pre>       Several statements may be given  on  a  line,  separated  by\r\n  semicolons or commas.<\/pre><pre>       Two  consecutive  periods  anywhere  on  a   line   indicate\r\n  continuation.   The  periods  and  any  following  characters are\r\n  deleted, then another line is input  and  concatenated  onto  the\r\n  previous line.<\/pre><pre>       Two  consecutive  slashes  anywhere  on  a  line  cause  the\r\n  remainder  of  the  line  to  be  ignored.   This  is  useful for\r\n  inserting comments.<\/pre><pre>       Names of variables are formed by a letter, followed  by  any\r\n  number of letters and digits, but only the first 4 characters are\r\n  remembered.<\/pre><pre>       The special character  prime  (')  is  used  to  denote  the\r\n  transpose of a matrix, so<\/pre><pre>     x = x'<\/pre><pre>  changes the row vector above into the column vector<\/pre><pre>     X     =<\/pre><pre>       -1.3000\r\n        0.8000\r\n        3.1416<\/pre><pre>       Individual matrix elements may be  referenced  by  enclosing\r\n  their  subscripts  in  parentheses.  When any element is changed,\r\n  the entire matrix is reprinted.  For  example,  using  the  above\r\n  matrix,\r\n     a(3,3) = a(1,3) + a(3,1)<\/pre><pre>  results in<\/pre><pre>     A     =<\/pre><pre>         1.    2.    3.\r\n         4.    5.    6.\r\n         7.    8.   10.<\/pre><pre>       Addition, subtraction and  multiplication  of  matrices  are\r\n  denoted  by  +, -, and * .  The operations are performed whenever\r\n  the matrices have the proper dimensions.  For example,  with  the\r\n  above  A  and  x,  the  expressions  A  + x and x*A are incorrect\r\n  because A is 3 by 3 and x is now 3 by 1.  However,<\/pre><pre>     b = A*x<\/pre><pre>  is correct and results in the output<\/pre><pre>     B     =<\/pre><pre>        9.7248\r\n       17.6496\r\n       28.7159<\/pre><pre>  Note that both upper and lower case letters are allowed for input\r\n  (on  those  systems  which  have  both),  but  that lower case is\r\n  converted to upper case.<\/pre><pre>       There are two \"matrix division\" symbols in MATLAB, \\ and \/ .\r\n  (If  your  terminal  does not have a backslash, use $ instead, or\r\n  see CHAR.) If A and B are matrices, then A\\B and  B\/A  correspond\r\n  formally  to left and right multiplication of B by the inverse of\r\n  A , that is inv(A)*B and B*inv(A), but  the  result  is  obtained\r\n  directly  without  the computation of the inverse.  In the scalar\r\n  case, 3\\1 and 1\/3 have the  same  value,  namely  one-third.   In\r\n  general,  A\\B  denotes the solution X to the equation A*X = B and\r\n  B\/A denotes the solution to X*A = B.<\/pre><pre>       Left division, A\\B, is defined whenever B has as  many  rows\r\n  as   A  .   If  A  is  square,  it  is  factored  using  Gaussian\r\n  elimination.   The  factors  are  used  to  solve  the  equations\r\n  A*X(:,j) = B(:,j) where B(:,j) denotes the j-th column of B.  The\r\n  result is a matrix X with the same dimensions  as  B.   If  A  is\r\n  nearly  singular  (according  to the LINPACK condition estimator,\r\n  RCOND), a warning message is printed.  If A is not square, it  is\r\n  factored   using   Householder   orthogonalization   with  column\r\n  pivoting.   The  factors  are  used  to  solve  the   under-   or\r\n  overdetermined equations in a least squares sense.  The result is\r\n  an m by n matrix X where m is the number of columns of A and n is\r\n  the  number  of  columns  of  B .  Each column of X has at most k\r\n  nonzero components, where k is the effective rank of A .<\/pre><pre>       Right division,  B\/A,  can  be  defined  in  terms  of  left\r\n  division by  B\/A = (A'\\B')'.<\/pre><pre>       For example, since our vector  b   was computed as  A*x, the\r\n  statement<\/pre><pre>     y = A\\b<\/pre><pre>  results in<\/pre><pre>     Y     =<\/pre><pre>       -1.3000\r\n        0.8000\r\n        3.1416<\/pre><pre>  Of course,  y  is  not  exactly  equal  to   x   because  of  the\r\n  roundoff  errors involved in both  A*x  and  A\\b , but we are not\r\n  printing enough digits to see the difference.  The result of  the\r\n  statement<\/pre><pre>     e = x - y<\/pre><pre>  depends upon the particular computer being used.  In one case  it\r\n  produces<\/pre><pre>     E     =<\/pre><pre>        1.0e-15 *<\/pre><pre>          .3053\r\n         -.2498\r\n          .0000<\/pre><pre>  The quantity 1.0e-15 is a scale factor which multiplies  all  the\r\n  components  which  follow.  Thus our vectors  x  and  y  actually\r\n  agree to about 15 decimal places on this computer.<\/pre><pre>       It   is   also   possible   to   obtain   element-by-element\r\n  multiplicative  operations.  If A and B have the same dimensions,\r\n  then A .* B denotes the matrix  whose  elements  are  simply  the\r\n  products  of the individual elements of A and B . The expressions\r\n  A .\/ B and A .\\ B give the quotients of the individual elements.<\/pre><pre>       There are several possible output formats.  The statement<\/pre><pre>     long, x<\/pre><pre>  results in<\/pre><pre>     X     =\r\n        -1.300000000000000\r\n          .800000000000000\r\n         3.141592653589793<\/pre><pre>  The statement<\/pre><pre>     short<\/pre><pre>  restores the original format.<\/pre><pre>       The expression A**p means  A  to  the  p-th  power.   It  is\r\n  defined  if  A  is a square matrix and p is a scalar.  If p is an\r\n  integer greater than one,  the  power  is  computed  by  repeated\r\n  multiplication.   For  other values of p the calculation involves\r\n  the eigenvalues and eigenvectors of A.<\/pre><pre>       Previously defined matrices and matrix  expressions  can  be\r\n  used inside brackets to generate larger matrices, for example<\/pre><pre>     C = &lt;A, b; &lt;4 2 0&gt;*x, x'&gt;<\/pre><pre>  results in<\/pre><pre>     C     =<\/pre><pre>        1.0000   2.0000   3.0000   9.7248\r\n        4.0000   5.0000   6.0000  17.6496\r\n        7.0000   8.0000  10.0000  28.7159\r\n       -3.6000  -1.3000   0.8000   3.1416<\/pre><pre>       There are four predefined variables,  EPS,  FLOP,  RAND  and\r\n  EYE.  The variable EPS is used as a tolerance is determining such\r\n  things as near singularity and rank.  Its initial  value  is  the\r\n  distance  from  1.0  to the next largest floating point number on\r\n  the particular computer being used.  The user may reset  this  to\r\n  any other value, including zero. EPS is changed by CHOP, which is\r\n  described in section 12.<\/pre><pre>       The value of RAND is a random variable, with a choice  of  a\r\n  uniform or a normal distribution.<\/pre><pre>       The name EYE is used  in  place  of  I  to  denote  identity\r\n  matrices  because  I is often used as a subscript or as sqrt(-1).\r\n  The dimensions of EYE are determined by context.  For example,<\/pre><pre>     B = A + 3*EYE<\/pre><pre>  adds 3 to the diagonal elements of A and<\/pre><pre>     X = EYE\/A<\/pre><pre>  is one of several ways in MATLAB to invert a matrix.<\/pre><pre>       FLOP provides a  count  of  the  number  of  floating  point\r\n  operations, or \"flops\", required for each calculation.<\/pre><pre>       A statement may consist of an  expression  alone,  in  which\r\n  case a variable named ANS is created and the result stored in ANS\r\n  for possible future use.  Thus<\/pre><pre>     A\\A - EYE<\/pre><pre>  is the same as<\/pre><pre>     ANS = A\\A - EYE<\/pre><pre>  (Roundoff error usually causes this result  to  be  a  matrix  of\r\n  \"small\" numbers, rather than all zeros.)<\/pre><pre>       All computations are done  using  either  single  or  double\r\n  precision  real  arithmetic,  whichever  is  appropriate  for the\r\n  particular computer.  There  is  no  mixed-precision  arithmetic.\r\n  The  Fortran  COMPLEX  data type is not used because many systems\r\n  create  unnecessary  underflows  and   overflows   with   complex\r\n  operations and because some systems do not allow double precision\r\n  complex arithmetic.<\/pre><h4>2.  MATLAB functions<a name=\"89e95492-9829-41fc-a176-efecd2a7058a\"><\/a><\/h4><pre>       Much of MATLAB's computational power comes from the  various\r\n  matrix functions available.  The current list includes:<\/pre><pre>     INV(A)          - Inverse.\r\n     DET(A)          - Determinant.\r\n     COND(A)         - Condition number.\r\n     RCOND(A)        - A measure of nearness to singularity.\r\n     EIG(A)          - Eigenvalues and eigenvectors.\r\n     SCHUR(A)        - Schur triangular form.\r\n     HESS(A)         - Hessenberg or tridiagonal form.\r\n     POLY(A)         - Characteristic polynomial.\r\n     SVD(A)          - Singular value decomposition.\r\n     PINV(A,eps)     - Pseudoinverse with optional tolerance.\r\n     RANK(A,eps)     - Matrix rank with optional tolerance.\r\n     LU(A)           - Factors from Gaussian elimination.\r\n     CHOL(A)         - Factor from Cholesky factorization.\r\n     QR(A)           - Factors from Householder orthogonalization.\r\n     RREF(A)         - Reduced row echelon form.\r\n     ORTH(A)         - Orthogonal vectors spanning range of A.\r\n     EXP(A)          - e to the A.\r\n     LOG(A)          - Natural logarithm.\r\n     SQRT(A)         - Square root.\r\n     SIN(A)          - Trigonometric sine.\r\n     COS(A)          - Cosine.\r\n     ATAN(A)         - Arctangent.\r\n     ROUND(A)        - Round the elements to nearest integers.\r\n     ABS(A)          - Absolute value of the elements.\r\n     REAL(A)         - Real parts of the elements.\r\n     IMAG(A)         - Imaginary parts of the elements.\r\n     CONJG(A)        - Complex conjugate.\r\n     SUM(A)          - Sum of the elements.\r\n     PROD(A)         - Product of the elements.\r\n     DIAG(A)         - Extract or create diagonal matrices.\r\n     TRIL(A)         - Lower triangular part of A.\r\n     TRIU(A)         - Upper triangular part of A.\r\n     NORM(A,p)       - Norm with p = 1, 2 or 'Infinity'.\r\n     EYE(m,n)        - Portion of identity matrix.\r\n     RAND(m,n)       - Matrix with random elements.\r\n     ONES(m,n)       - Matrix of all ones.\r\n     MAGIC(n)        - Interesting test matrices.\r\n     HILBERT(n)      - Inverse Hilbert matrices.\r\n     ROOTS(C)        - Roots of polynomial with coefficients C.\r\n     DISPLAY(A,p)    - Print base p representation of A.\r\n     KRON(A,B)       - Kronecker tensor product of A and B.\r\n     PLOT(X,Y)       - Plot Y as a function of X .\r\n     RAT(A)          - Find \"simple\" rational approximation to A.\r\n     USER(A)         - Function defined by external program.<\/pre><pre>       Some of these functions have different interpretations  when\r\n  the  argument  is  a  matrix  or  a  vector and some of them have\r\n  additional optional arguments.  Details are  given  in  the  HELP\r\n  document in the appendix.<\/pre><pre>       Several of these functions can  be  used  in  a  generalized\r\n  assignment statement with two or three variables on the left hand\r\n  side.  For example<\/pre><pre>     &lt;X,D&gt; = EIG(A)<\/pre><pre>  stores the eigenvectors of A in  the  matrix  X  and  a  diagonal\r\n  matrix containing the eigenvalues in the matrix D.  The statement<\/pre><pre>     EIG(A)<\/pre><pre>  simply computes the eigenvalues and stores them in ANS.<\/pre><pre>       Future versions of MATLAB will probably  include  additional\r\n  functions, since they can easily be added to the system.<\/pre><h4>3.  Rows, columns and submatrices<a name=\"b3d89f07-feea-45d1-9d4f-819d0c9dde6c\"><\/a><\/h4><pre>       Individual elements of a matrix can be  accessed  by  giving\r\n  their subscripts in parentheses, eg. A(1,2), x(i), TAB(ind(k)+1).\r\n  An expression used as a  subscript  is  rounded  to  the  nearest\r\n  integer.<\/pre><pre>       Individual rows and columns can be accessed  using  a  colon\r\n  ':' (or a '|') for the free subscript. For example, A(1,:) is the\r\n  first row of A and A(:,j) is the j-th column.  Thus<\/pre><pre>     A(i,:) = A(i,:) + c*A(k,:)<\/pre><pre>  adds c times the k-th row of A to the i-th row.<\/pre><pre>       The colon is used in several other ways in MATLAB,  but  all\r\n  of the uses are based on the following definition.<\/pre><pre>     j:k    is the same as  &lt;j, j+1, ..., k&gt;\r\n     j:k    is empty if  j &gt; k .\r\n     j:i:k  is the same as  &lt;j, j+i, j+2i, ..., k&gt;\r\n     j:i:k  is empty if  i &gt; 0 and j &gt; k or if i &lt; 0 and j &lt; k .<\/pre><pre>  The colon is usually used with integers, but it  is  possible  to\r\n  use arbitrary real scalars as well.  Thus<\/pre><pre>     1:4  is the same as  &lt;1, 2, 3, 4&gt;\r\n     0: 0.1: 0.5 is the same as &lt;0.0, 0.1, 0.2, 0.3, 0.4, 0.5&gt;<\/pre><pre>       In general, a subscript can be a vector.  If  X  and  V  are\r\n  vectors, then X(V) is &lt;X(V(1)), X(V(2)), ..., X(V(n))&gt; . This can\r\n  also be used with matrices.  If V has m components and  W  has  n\r\n  components,  then  A(V,W)  is  the  m by n matrix formed from the\r\n  elements of A whose subscripts are  the  elements  of  V  and  W.\r\n  Combinations  of the colon notation and the indirect subscripting\r\n  allow manipulation of various submatrices. For example,<\/pre><pre>     A(&lt;1,5&gt;,:) = A(&lt;5,1&gt;,:)  interchanges rows 1 and 5 of A.\r\n     A(2:k,1:n)  is the submatrix formed from rows 2 through k\r\n        and columns 1 through n of A .\r\n     A(:,&lt;3 1 2&gt;)  is a permutation of the first three columns.<\/pre><pre>       The notation A(:) has a special meaning.  On the right  hand\r\n  side  of  an assignment statement, it denotes all the elements of\r\n  A, regarded as a single column.  When an expression  is  assigned\r\n  to  A(:),  the  current  dimensions  of  A,  rather  than  of the\r\n  expression, are used.<\/pre><h4>4.  FOR, WHILE and IF<a name=\"5ef5f8a1-00bf-4ba3-8665-ee119735ab87\"><\/a><\/h4><pre>       The FOR clause allows statements to be repeated  a  specific\r\n  number of times.  The general form is<\/pre><pre>     FOR variable = expr,  statement, ..., statement, END<\/pre><pre>  The END and the comma before it may be omitted.  In general,  the\r\n  expression  may be a matrix, in which case the columns are stored\r\n  one at a time in the variable and the following statements, up to\r\n  the  END or the end of the line, are executed.  The expression is\r\n  often of the form j:k, and its \"columns\" are simply  the  scalars\r\n  from j to k.  Some examples (assume n has already been assigned a\r\n  value):<\/pre><pre>     for i = 1:n, for j = 1:n, A(i,j) = 1\/(i+j-1);<\/pre><pre>  generates the Hilbert matrix.<\/pre><pre>     for j = 2:n-1, for i = j:n-1, ...\r\n        A(i,j) = 0; end; A(j,j) = j; end; A<\/pre><pre>  changes all but the \"outer edge\" of the lower triangle  and  then\r\n  prints the final matrix.<\/pre><pre>     for h = 1.0: -0.1: -1.0, (&lt;h, cos(pi*h)&gt;)<\/pre><pre>  prints a table of cosines.<\/pre><pre>     &lt;X,D&gt; = EIG(A); for v = X, v, A*v<\/pre><pre>  displays eigenvectors, one at a time.<\/pre><pre>       The  WHILE  clause  allows  statements  to  be  repeated  an\r\n  indefinite number of times.  The general form is<\/pre><pre>     WHILE expr relop expr,   statement,..., statement, END<\/pre><pre>  where relop is =, &lt;,  &gt;,  &lt;=,  &gt;=,  or  &lt;&gt;  (not  equal)  .   The\r\n  statements  are  repeatedly  executed  as  long  as the indicated\r\n  comparison between the real parts of the first components of  the\r\n  two  expressions  is true.  Here are two examples.  (Exercise for\r\n  the reader: What do these segments do?)<\/pre><pre>     eps = 1;\r\n     while 1 + eps &gt; 1, eps = eps\/2;\r\n     eps = 2*eps<\/pre><pre>     E = 0*A;  F = E + EYE; n = 1;\r\n     while NORM(E+F-E,1) &gt; 0, E = E + F; F = A*F\/n; n = n + 1;\r\n     E<\/pre><pre>       The IF clause allows conditional  execution  of  statements.\r\n  The general form is<\/pre><pre>     IF expr relop expr,   statement, ..., statement,\r\n        ELSE statement, ..., statement<\/pre><pre>  The first group of statements are executed  if  the  relation  is\r\n  true  and the second group are executed if the relation is false.\r\n  The ELSE and the statements following it  may  be  omitted.   For\r\n  example,<\/pre><pre>     if abs(i-j) = 2, A(i,j) = 0;<\/pre><h4>5.  Commands, text, files and macros.<a name=\"6cc09bdb-128b-4e44-ac00-87212f4721fb\"><\/a><\/h4><pre>       MATLAB has several commands which control the output  format\r\n  and the overall execution of the system.<\/pre><pre>       The HELP command allows on-line access to short portions  of\r\n  text   describing   various  operations,  functions  and  special\r\n  characters.   The  entire  HELP  document  is  reproduced  in  an\r\n  appendix.<\/pre><pre>       Results are usually printed in a scaled fixed  point  format\r\n  that shows 4 or 5 significant figures.  The commands SHORT, LONG,\r\n  SHORT E, LONG E and LONG Z alter the output format,  but  do  not\r\n  alter the precision of the computations or the internal storage.<\/pre><pre>       The WHO, WHAT and WHY commands provide information about the\r\n  functions and variables that are currently defined.<\/pre><pre>       The CLEAR command erases all variables,  except  EPS,  FLOP,\r\n  RAND  and  EYE.  The  statement  A = &lt;&gt; indicates that a \"0 by 0\"\r\n  matrix is to be stored in A.  This causes A to be erased so  that\r\n  its storage can be used for other variables.<\/pre><pre>       The RETURN and EXIT commands cause return to the  underlying\r\n  operating system through the Fortran RETURN statement.<\/pre><pre>       MATLAB has a limited facility for handling text.  Any string\r\n  of characters delineated by quotes (with two quotes used to allow\r\n  one quote within the string) is saved  as  a  vector  of  integer\r\n  values  with '1' = 1, 'A' = 10, ' ' = 36, etc. (The complete list\r\n  is in the appendix under CHAR.) For example<\/pre><pre>     '2*A + 3'  is the same as  &lt;2 43 10 36 41 36 3&gt;<\/pre><pre>  It is possible,  though  seldom  very  meaningful,  to  use  such\r\n  strings  in matrix operations.  More frequently, the text is used\r\n  as a special argument to various functions.<\/pre><pre>     NORM(A,'inf')    computes the infinity norm of A .\r\n     DISPLAY(T)       prints the text stored in T .\r\n     EXEC('file')     obtains MATLAB input from an external file.\r\n     SAVE('file')     stores all the current variables in a file.\r\n     LOAD('file')     retrieves all the variables from a file.\r\n     PRINT('file',X)  prints X on a file.\r\n     DIARY('file')    makes a copy of the complete MATLAB session.<\/pre><pre>       The text can also be used in a limited  string  substitution\r\n  macro  facility.   If a variable, say T, contains the source text\r\n  for a MATLAB statement or expression, then the construction<\/pre><pre>     &gt; T &lt;<\/pre><pre>  causes T to be executed or evaluated.  For example<\/pre><pre>     T = '2*A + 3';\r\n     S = 'B = &gt;T&lt; + 5'\r\n     A = 4;\r\n     &gt; S &lt;<\/pre><pre>  produces<\/pre><pre>     B     =<\/pre><pre>        16.<\/pre><pre>  Some other examples are given under MACRO in the appendix.   This\r\n  facility  is  useful for fairly short statements and expressions.\r\n  More complicated MATLAB \"programs\" should use the EXEC facility.<\/pre><pre>       The operations which access external files cannot be handled\r\n  in  a  completely  machine-independent manner by portable Fortran\r\n  code.  It  is  necessary  for  each  particular  installation  to\r\n  provide  a  subroutine  which associates external text files with\r\n  Fortran logical unit numbers.<\/pre><h4>6.  Census example<a name=\"70f0981b-41e3-49d1-8660-63420a6d81c2\"><\/a><\/h4><pre>       Our  first  extended   example   involves   predicting   the\r\n  population  of  the  United States in 1980 using extrapolation of\r\n  various fits to the census data from 1900  through  1970.   There\r\n  are eight observations, so we begin with the MATLAB statement<\/pre><pre>     n = 8<\/pre><pre>  The values of the dependent variable, the population in millions,\r\n  can be entered with<\/pre><pre>     y = &lt; 75.995   91.972  105.711  123.203   ...\r\n          131.669  150.697  179.323  203.212&gt;'<\/pre><pre>  In order to produce a reasonably scaled matrix,  the  independent\r\n  variable,  time,  is transformed from the interval [1900,1970] to\r\n  [-1.00,0.75].  This can be accomplished directly with<\/pre><pre>     t = -1.0:0.25:0.75<\/pre><pre>  or in a fancier, but perhaps clearer, way with<\/pre><pre>     t = 1900:10:1970;   t = (t - 1940*ones(t))\/40<\/pre><pre>  Either of these is equivalent to<\/pre><pre>     t = &lt;-1 -.75 -.50 -.25 0 .25 .50 .75&gt;<\/pre><pre>       The interpolating polynomial of  degree   n-1   involves  an\r\n  Vandermonde  matrix  of  order   n   with  elements that might be\r\n  generated by<\/pre><pre>     for i = 1:n, for j = 1:n, a(i,j) = t(i)**(j-1);<\/pre><pre>  However, this results in an error caused by 0**0  when  i = 5 and\r\n  j = 1 .  The preferable approach is<\/pre><pre>     A = ones(n,n);\r\n     for i = 1:n, for j = 2:n, a(i,j) = t(i)*a(i,j-1);<\/pre><pre>  Now the statement<\/pre><pre>     cond(A)<\/pre><pre>  produces the output<\/pre><pre>     ANS   =<\/pre><pre>        1.1819E+03<\/pre><pre>  which indicates that transformation  of  the  time  variable  has\r\n  resulted in a reasonably well conditioned matrix.<\/pre><pre>       The statement<\/pre><pre>     c = A\\y<\/pre><pre>  results in<\/pre><pre>     C     =<\/pre><pre>       131.6690\r\n        41.0406\r\n       103.5396\r\n       262.4535\r\n      -326.0658\r\n      -662.0814\r\n       341.9022\r\n       533.6373<\/pre><pre>  These are the coefficients in the interpolating polynomial<\/pre><pre>                            n-1\r\n        c  + c t + ... + c t\r\n         1    2           n<\/pre><pre>  Our transformation of the time variable has resulted in   t  =  1\r\n  corresponding  to  the year 1980.  Consequently, the extrapolated\r\n  population is simply the sum of the coefficients.   This  can  be\r\n  computed by<\/pre><pre>     p = sum(c)<\/pre><pre>  The result is<\/pre><pre>     P     =<\/pre><pre>       426.0950<\/pre><pre>  which indicates a 1980 population of over 426 million.   Clearly,\r\n  using  the seventh degree interpolating polynomial to extrapolate\r\n  even a fairly short distance beyond the end of the data  interval\r\n  is not a good idea.<\/pre><pre>       The coefficients in least squares  fits  by  polynomials  of\r\n  lower  degree can be computed using fewer than  n  columns of the\r\n  matrix.<\/pre><pre>     for k = 1:n, c = A(:,1:k)\\y,  p = sum(c)<\/pre><pre>  would produce the coefficients of these  fits,  as  well  as  the\r\n  resulting  extrapolated  population.   If we do not want to print\r\n  all the coefficients, we can simply generate  a  small  table  of\r\n  populations  predicted  by  polynomials  of  degrees zero through\r\n  seven.  We also compute the maximum deviation between the  fitted\r\n  and observed values.<\/pre><pre>     for k = 1:n, X = A(:,1:k);  c = X\\y;  ...\r\n        d(k) = k-1;  p(k) = sum(c);  e(k) = norm(X*c-y,'inf');\r\n     &lt;d, p, e&gt;<\/pre><pre>  The resulting output is<\/pre><pre>        0   132.7227  70.4892\r\n        1   211.5101   9.8079\r\n        2   227.7744   5.0354\r\n        3   241.9574   3.8941\r\n        4   234.2814   4.0643\r\n        5   189.7310   2.5066\r\n        6   118.3025   1.6741\r\n        7   426.0950   0.0000<\/pre><pre>  The zeroth degree fit, 132.7 million, is the result of fitting  a\r\n  constant  to  the  data  and  is simply the average.  The results\r\n  obtained with polynomials of degree one through four  all  appear\r\n  reasonable.   The  maximum  deviation  of  the degree four fit is\r\n  slightly greater than the degree three, even though  the  sum  of\r\n  the  squares  of the deviations is less.  The coefficients of the\r\n  highest powers in the fits of degree five and six turn out to  be\r\n  negative  and  the predicted populations of less than 200 million\r\n  are probably unrealistic.  The hopefully absurd prediction of the\r\n  interpolating polynomial concludes the table.<\/pre><pre>       We  wish  to  emphasize  that  roundoff   errors   are   not\r\n  significant  here.  Nearly identical results would be obtained on\r\n  other computers, or with other algorithms.   The  results  simply\r\n  indicate   the  difficulties  associated  with  extrapolation  of\r\n  polynomial fits of even modest degree.<\/pre><pre>       A stabilized fit by  a  seventh  degree  polynomial  can  be\r\n  obtained  using  the  pseudoinverse,  but  it  requires  a fairly\r\n  delicate choice of a tolerance. The statement<\/pre><pre>     s = svd(A)<\/pre><pre>  produces the singular values<\/pre><pre>     S     =<\/pre><pre>        3.4594\r\n        2.2121\r\n        1.0915\r\n        0.4879\r\n        0.1759\r\n        0.0617\r\n        0.0134\r\n        0.0029<\/pre><pre>  We see that the last three singular values are less  than  0.1  ,\r\n  consequently,   A   can be approximately by a matrix of rank five\r\n  with an error less than 0.1 .  The Moore-Penrose pseudoinverse of\r\n  this  rank  five  matrix  is  obtained  from  the  singular value\r\n  decomposition with the following statements<\/pre><pre>     c = pinv(A,0.1)*y, p = sum(c), e = norm(a*c-y,'inf')<\/pre><pre>  The output is<\/pre><pre>     C     =<\/pre><pre>      134.7972\r\n       67.5055\r\n       23.5523\r\n        9.2834\r\n        3.0174\r\n        2.6503\r\n       -2.8808\r\n        3.2467<\/pre><pre>     P     =<\/pre><pre>      241.1720<\/pre><pre>     E     =<\/pre><pre>        3.9469<\/pre><pre>  The resulting seventh degree polynomial  has  coefficients  which\r\n  are much smaller than those of the interpolating polynomial given\r\n  earlier.  The predicted population and the maximum deviation  are\r\n  reasonable.   Any  choice  of the tolerance between the fifth and\r\n  sixth singular values would produce the same results, but choices\r\n  outside this range result in pseudoinverses of different rank and\r\n  do not work as well.<\/pre><pre>       The one term exponential approximation<\/pre><pre>       y(t) = k exp(pt)<\/pre><pre>  can  be  transformed  into  a  linear  approximation  by   taking\r\n  logarithms.<\/pre><pre>       log(y(t)) = log k + pt<\/pre><pre>                 = c  + c t\r\n                    1    2<\/pre><pre>  The following segment makes use of the fact that a function of  a\r\n  vector is the function applied to the individual components.<\/pre><pre>     X = A(:,1:2);\r\n     c = X\\log(y)\r\n     p = exp(sum(c))\r\n     e = norm(exp(X*c)-y,'inf')<\/pre><pre>  The resulting output is<\/pre><pre>     C     =<\/pre><pre>        4.9083\r\n        0.5407<\/pre><pre>     P     =<\/pre><pre>      232.5134<\/pre><pre>     E     =<\/pre><pre>        4.9141<\/pre><pre>  The   predicted   population   and   maximum   deviation   appear\r\n  satisfactory  and  indicate  that  the  exponential  model  is  a\r\n  reasonable one to consider.<\/pre><pre>       As a curiousity, we return to  the  degree  six  polynomial.\r\n  Since  the coefficient of the high order term is negative and the\r\n  value of the polynomial at t = 1 is positive, it must have a root\r\n  at some value of  t  greater than one.  The statements<\/pre><pre>     X = A(:,1:7);\r\n     c = X\\y;\r\n     c = c(7:-1:1);  \/\/reverse the order of the coefficients\r\n     z = roots(c)<\/pre><pre>  produce<\/pre><pre>     Z     =<\/pre><pre>        1.1023-  0.0000*i\r\n        0.3021+  0.7293*i\r\n       -0.8790+  0.6536*i\r\n       -1.2939-  0.0000*i\r\n       -0.8790-  0.6536*i\r\n        0.3021-  0.7293*i<\/pre><pre>  There is only one real, positive root.  The corresponding time on\r\n  the original scale is<\/pre><pre>     1940 + 40*real(z(1))<\/pre><pre>       =  1984.091<\/pre><pre>  We conclude that the United States population should become  zero\r\n  early in February of 1984.<\/pre><h4>7.  Partial differential equation example<a name=\"8739d432-c5e3-469a-bab3-d50dbab976cc\"><\/a><\/h4><pre>       Our second extended example is a boundary value problem  for\r\n  Laplace's equation.  The underlying physical problem involves the\r\n  conductivity of a  medium  with  cylindrical  inclusions  and  is\r\n  considered by Keller and Sachs [7].<\/pre><pre>       Find a function  u(x,y)  satisfying Laplace's equation<\/pre><pre>                 u   + u   = 0\r\n                  xx    yy<\/pre><pre>  The domain is a unit square with a quarter circle of  radius  rho\r\n  removed from one corner.  There are Neumann conditions on the top\r\n  and bottom edges and Dirichlet conditions on the remainder of the\r\n  boundary.<\/pre><pre>                           u  = 0\r\n                            n<\/pre><pre>                       -------------\r\n                      |             .\r\n                      |             .\r\n                      |              .\r\n                      |               .  u = 1\r\n                      |                 .\r\n                      |                    .\r\n                      |                       .\r\n               u = 0  |                        |\r\n                      |                        |\r\n                      |                        |\r\n                      |                        |  u = 1\r\n                      |                        |\r\n                      |                        |\r\n                      |                        |\r\n                       ------------------------<\/pre><pre>                                u  = 0\r\n                                 n<\/pre><pre>  The effective conductivity of an medium  is  then  given  by  the\r\n  integral along the left edge,<\/pre><pre>                              1\r\n                   sigma = integral  u (0,y) dy\r\n                             0        n<\/pre><pre>  It is of interest to study the relation between  the  radius  rho\r\n  and  the  conductivity  sigma.   In particular, as rho approaches\r\n  one, sigma becomes infinite.\r\n       Keller and Sachs use a finite difference approximation.  The\r\n  following  technique  makes  use of the fact that the equation is\r\n  actually Laplace's equation and leads to a  much  smaller  matrix\r\n  problem to solve.<\/pre><pre>       Consider an approximate solution of the form<\/pre><pre>                   n      2j-1\r\n             u =  sum  c r    cos(2j-1)t\r\n                  j=1   j<\/pre><pre>  where  r,t  are polar coordinates (t is theta).  The coefficients\r\n  are to be determined.  For any set of coefficients, this function\r\n  already satisfies the differential  equation  because  the  basis\r\n  functions  are  harmonic;  it  satisfies  the  normal  derivative\r\n  boundary condition on the bottom edge of the  domain  because  we\r\n  used   cos  t   in  preference  to   sin t ; and it satisfies the\r\n  boundary condition on the left edge of the domain because we  use\r\n  only odd multiples of  t .<\/pre><pre>       The computational task is to find coefficients  so that  the\r\n  boundary  conditions on the remaining edges are satisfied as well\r\n  as possible.  To accomplish this, pick  m  points  (r,t)  on  the\r\n  remaining edges.  It is desirable to have  m &gt; n  and in practice\r\n  we usually choose m  to be two or three times as large  as   n  .\r\n  Typical  values  of  n  are 10 or 20 and of  m  are 20 to 60.  An\r\n  m  by  n  matrix  A  is generated.  The  i,j  element is the j-th\r\n  basis  function,  or its normal derivative, evaluated at the i-th\r\n  boundary point.  A right hand side with  m   components  is  also\r\n  generated.   In this example, the elements of the right hand side\r\n  are either zero or one.   The  coefficients  are  then  found  by\r\n  solving the overdetermined set of equations<\/pre><pre>              Ac = b<\/pre><pre>  in a least squares sense.<\/pre><pre>       Once the coefficients have been determined, the  approximate\r\n  solution  is  defined  everywhere  on  the  domain.   It  is then\r\n  possible to compute the effective conductivity sigma .  In  fact,\r\n  a very simple formula results,<\/pre><pre>                       n       j-1\r\n             sigma =  sum  (-1)   c\r\n                      j=1          j<\/pre><pre>       To use MATLAB for this problem, the following  \"program\"  is\r\n  first  stored  in  the  local computer file system, say under the\r\n  name \"PDE\".<\/pre><pre>  \/\/Conductivity example.\r\n  \/\/Parameters ---\r\n     rho       \/\/radius of cylindrical inclusion\r\n     n         \/\/number of terms in solution\r\n     m         \/\/number of boundary points\r\n  \/\/initialize operation counter\r\n     flop = &lt;0 0&gt;;\r\n  \/\/initialize variables\r\n     m1 = round(m\/3);   \/\/number of points on each straight edge\r\n     m2 = m - m1;       \/\/number of points with Dirichlet conditions\r\n     pi = 4*atan(1);\r\n  \/\/generate points in Cartesian coordinates\r\n     \/\/right hand edge\r\n     for i = 1:m1, x(i) = 1; y(i) = (1-rho)*(i-1)\/(m1-1);\r\n     \/\/top edge\r\n     for i = m2+1:m, x(i) = (1-rho)*(m-i)\/(m-m2-1); y(i) = 1;\r\n     \/\/circular edge\r\n     for i = m1+1:m2, t = pi\/2*(i-m1)\/(m2-m1+1); ...\r\n        x(i) = 1-rho*sin(t);  y(i) = 1-rho*cos(t);\r\n  \/\/convert to polar coordinates\r\n     for i = 1:m-1, th(i) = atan(y(i)\/x(i));  ...\r\n        r(i) = sqrt(x(i)**2+y(i)**2);\r\n     th(m) = pi\/2;  r(m) = 1;\r\n  \/\/generate matrix\r\n     \/\/Dirichlet conditions\r\n     for i = 1:m2, for j = 1:n, k = 2*j-1; ...\r\n        a(i,j) = r(i)**k*cos(k*th(i));\r\n     \/\/Neumann conditions\r\n     for i = m2+1:m, for j = 1:n, k = 2*j-1; ...\r\n        a(i,j) = k*r(i)**(k-1)*sin((k-1)*th(i));\r\n  \/\/generate right hand side\r\n     for i = 1:m2, b(i) = 1;\r\n     for i = m2+1:m, b(i) = 0;\r\n  \/\/solve for coefficients\r\n     c = A\\b\r\n  \/\/compute effective conductivity\r\n     c(2:2:n) = -c(2:2:n);\r\n     sigma = sum(c)\r\n  \/\/output total operation count\r\n     ops = flop(2)<\/pre><pre>       The program can be used within MATLAB by setting  the  three\r\n  parameters and then accessing the file.  For example,<\/pre><pre>     rho = .9;\r\n     n = 15;\r\n     m = 30;\r\n     exec('PDE')<\/pre><pre>  The resulting output is\r\n     RHO   =<\/pre><pre>        .9000<\/pre><pre>     N     =<\/pre><pre>      15.<\/pre><pre>     M     =<\/pre><pre>      30.<\/pre><pre>     C     =<\/pre><pre>        2.2275\r\n       -2.2724\r\n        1.1448\r\n        0.1455\r\n       -0.1678\r\n       -0.0005\r\n       -0.3785\r\n        0.2299\r\n        0.3228\r\n       -0.2242\r\n       -0.1311\r\n        0.0924\r\n        0.0310\r\n       -0.0154\r\n       -0.0038<\/pre><pre>     SIGM  =<\/pre><pre>        5.0895<\/pre><pre>     OPS   =<\/pre><pre>        16204.<\/pre><pre>       A total of 16204 floating point operations were necessary to\r\n  set  up  the  matrix,  solve for the coefficients and compute the\r\n  conductivity.  The operation count  is  roughly  proportional  to\r\n  m*n**2.   The  results obtained for sigma as a function of rho by\r\n  this approach are essentially the same as those obtained  by  the\r\n  finite   difference  technique  of  Keller  and  Sachs,  but  the\r\n  computational effort involved is much less.<\/pre><h4>8.  Eigenvalue sensitivity example<a name=\"fc4c85ff-61c4-44ac-af8e-ebb62c8ec439\"><\/a><\/h4><pre>       In this example, we construct a matrix whose eigenvalues are\r\n  moderately  sensitive  to  perturbations  and  then  analyze that\r\n  sensitivity. We begin with the statement<\/pre><pre>     B = &lt;3 0 7; 0 2 0; 0 0 1&gt;<\/pre><pre>  which produces<\/pre><pre>     B     =<\/pre><pre>         3.    0.    7.\r\n         0.    2.    0.\r\n         0.    0.    1.<\/pre><pre>       Obviously, the eigenvalues of B are 1, 2 and 3 .   Moreover,\r\n  since   B  is  not  symmetric,  these  eigenvalues  are  slightly\r\n  sensitive to perturbation.  (The value b(1,3) = 7 was  chosen  so\r\n  that the elements of the matrix A below are less than 1000.)<\/pre><pre>       We now generate a similarity transformation to disguise  the\r\n  eigenvalues and make them more sensitive.<\/pre><pre>     L = &lt;1 0 0; 2 1 0; -3 4 1&gt;, M = L\\L'<\/pre><pre>     L     =<\/pre><pre>         1.    0.    0.\r\n         2.    1.    0.\r\n        -3.    4.    1.<\/pre><pre>     M     =<\/pre><pre>         1.0000    2.0000   -3.0000\r\n        -2.0000   -3.0000   10.0000\r\n        11.0000   18.0000  -48.0000<\/pre><pre>  The matrix M has determinant equal to 1 and is  moderately  badly\r\n  conditioned.  The similarity transformation is<\/pre><pre>     A = M*B\/M<\/pre><pre>     A     =<\/pre><pre>       -64.0000   82.0000   21.0000\r\n       144.0000 -178.0000  -46.0000\r\n      -771.0000  962.0000  248.0000<\/pre><pre>  Because  det(M) = 1 , the elements of  A  would be exact integers\r\n  if there were no roundoff.  So,\r\n     A = round(A)<\/pre><pre>     A     =<\/pre><pre>       -64.   82.   21.\r\n       144. -178.  -46.\r\n      -771.  962.  248.<\/pre><pre>       This, then, is our test matrix.  We can now  forget  how  it\r\n  was generated and analyze its eigenvalues.<\/pre><pre>     &lt;X,D&gt; = eig(A)<\/pre><pre>     D     =<\/pre><pre>         3.0000    0.0000    0.0000\r\n         0.0000    1.0000    0.0000\r\n         0.0000    0.0000    2.0000<\/pre><pre>     X     =<\/pre><pre>         -.0891    3.4903   41.8091\r\n          .1782   -9.1284  -62.7136\r\n         -.9800   46.4473  376.2818<\/pre><pre>  Since A is similar to B, its eigenvalues are also  1,  2  and  3.\r\n  They  happen  to  be  computed  in  another  order by the EISPACK\r\n  subroutines.  The fact that the  columns  of  X,  which  are  the\r\n  eigenvectors,  are  so  far  from  being orthonormal is our first\r\n  indication that  the  eigenvalues  are  sensitive.  To  see  this\r\n  sensitivity, we display more figures of the computed eigenvalues.<\/pre><pre>     long, diag(D)<\/pre><pre>     ANS   =<\/pre><pre>        2.999999999973599\r\n        1.000000000015625\r\n        2.000000000011505<\/pre><pre>  We see that, on this computer, the last five significant  figures\r\n  are  contaminated  by  roundoff  error.  A  somewhat  superficial\r\n  explanation of this is provided by<\/pre><pre>     short,  cond(X)<\/pre><pre>     ANS   =<\/pre><pre>        3.2216e+05<\/pre><pre>  The condition number of X gives an upper bound for  the  relative\r\n  error  in  the  computed  eigenvalues.   However,  this condition\r\n  number is affected by scaling.<\/pre><pre>     X = X\/diag(X(3,:)),  cond(X)<\/pre><pre>     X     =<\/pre><pre>          .0909     .0751     .1111\r\n         -.1818    -.1965    -.1667\r\n         1.0000    1.0000    1.0000<\/pre><pre>     ANS   =<\/pre><pre>        1.7692e+03<\/pre><pre>       Rescaling the eigenvectors so that their last components are\r\n  all  equal  to  one  has  two consequences. The condition of X is\r\n  decreased by over two orders of magnitude.  (This  is  about  the\r\n  minimum condition that can be obtained by such diagonal scaling.)\r\n  Moreover, it is now apparent  that  the  three  eigenvectors  are\r\n  nearly parallel.<\/pre><pre>       More  detailed  information  on  the  sensitivity   of   the\r\n  individual eigenvalues involves the left eigenvectors.<\/pre><pre>     Y = inv(X'),  Y'*A*X<\/pre><pre>     Y     =<\/pre><pre>      -511.5000  259.5000  252.0000\r\n       616.0000 -346.0000 -270.0000\r\n       159.5000  -86.5000  -72.0000<\/pre><pre>     ANS   =<\/pre><pre>         3.0000     .0000     .0000\r\n          .0000    1.0000     .0000\r\n          .0000     .0000    2.0000<\/pre><pre>  We are now in a position to  compute  the  sensitivities  of  the\r\n  individual eigenvalues.<\/pre><pre>     for j = 1:3, c(j) = norm(Y(:,j))*norm(X(:,j)); end,  C<\/pre><pre>     C     =<\/pre><pre>       833.1092\r\n       450.7228\r\n       383.7564<\/pre><pre>  These three numbers are the reciprocals of  the  cosines  of  the\r\n  angles  between the left and right eigenvectors.  It can be shown\r\n  that  perturbation  of  the  elements  of  A  can  result  in   a\r\n  perturbation of the j-th eigenvalue which is c(j) times as large.\r\n  In  this  example,  the  first   eigenvalue   has   the   largest\r\n  sensitivity.<\/pre><pre>       We now proceed to show that A is close to a  matrix  with  a\r\n  double eigenvalue.  The direction of the required perturbation is\r\n  given by<\/pre><pre>     E = -1.e-6*Y(:,1)*X(:,1)'<\/pre><pre>     E     =<\/pre><pre>        1.0e-03 *<\/pre><pre>          .0465    -.0930     .5115\r\n         -.0560     .1120    -.6160\r\n         -.0145     .0290    -.1595<\/pre><pre>  With some trial and error which we do not show,  we  bracket  the\r\n  point  where  two  eigenvalues of a perturbed A coalesce and then\r\n  become complex.<\/pre><pre>     eig(A + .4*E),  eig(A + .5*E)<\/pre><pre>     ANS   =<\/pre><pre>         1.1500\r\n         2.5996\r\n         2.2504<\/pre><pre>     ANS   =<\/pre><pre>        2.4067 +  .1753*i\r\n        2.4067 -  .1753*i\r\n        1.1866 + 0.0000*i<\/pre><pre>  Now, a bisecting search, driven by the imaginary part of  one  of\r\n  the eigenvalues, finds the point where two eigenvalues are nearly\r\n  equal.<\/pre><pre>     r = .4;  s = .5;<\/pre><pre>     while s-r &gt; 1.e-14, t = (r+s)\/2; d = eig(A+t*E); ...\r\n       if imag(d(1))=0, r = t; else, s = t;<\/pre><pre>     long,  T<\/pre><pre>     T     =<\/pre><pre>          .450380734134507<\/pre><pre>       Finally, we display the perturbed matrix, which is obviously\r\n  close  to the original, and its pair of nearly equal eigenvalues.\r\n  (We have dropped a few digits from the long output.)<\/pre><pre>     A+t*E,  eig(A+t*E)<\/pre><pre>     A<\/pre><pre>      -63.999979057   81.999958114   21.000230369\r\n      143.999974778 -177.999949557  -46.000277434\r\n     -771.000006530  962.000013061  247.999928164<\/pre><pre>     ANS   =<\/pre><pre>        2.415741150\r\n        2.415740621\r\n        1.168517777<\/pre><pre>       The  first  two  eigenvectors  of  A  +   t*E   are   almost\r\n  indistinguishable  indicating that the perturbed matrix is almost\r\n  defective.<\/pre><pre>     &lt;X,D&gt; = eig(A+t*E);  X = X\/diag(X(3,:))<\/pre><pre>     X     =<\/pre><pre>         .096019578     .096019586    .071608466\r\n        -.178329614    -.178329608   -.199190520\r\n        1.000000000    1.000000000   1.000000000<\/pre><pre>     short,  cond(X)<\/pre><pre>     ANS   =<\/pre><pre>        3.3997e+09<\/pre><h4>9.  Syntax diagrams<a name=\"17336a39-c078-4383-870a-f855af36b9f0\"><\/a><\/h4><pre>       A formal description of the language acceptable  to  MATLAB,\r\n  as well as a flow chart of the MATLAB program, is provided by the\r\n  syntax diagrams or syntax graphs of Wirth [6].  There are  eleven\r\n  non-terminal symbols in the language:<\/pre><pre>     line, statement, clause, expression, term,\r\n     factor, number, integer, name, command, text .<\/pre><pre>  The diagrams define each of the non-terminal  symbols  using  the\r\n  others and the terminal symbols:<\/pre><pre>     letter -- A through Z,\r\n     digit  -- 0 through 9,\r\n     char   -- ( ) ; : + - * \/ \\ = . , &lt; &gt;\r\n     quote  -- '<\/pre><pre>  line<\/pre><pre>         |-----&gt; statement &gt;----|\r\n         |                      |\r\n         |-----&gt; clause &gt;-------|\r\n         |                      |\r\n  -------|-----&gt; expr &gt;---------|------&gt;\r\n       | |                      | |\r\n       | |-----&gt; command &gt;------| |\r\n       | |                      | |\r\n       | |-&gt; &gt; &gt;-&gt; expr &gt;-&gt; &lt; &gt;-| |\r\n       | |                      | |\r\n       | |----------------------| |\r\n       |                          |\r\n       |        |-&lt; ; &lt;-|         |\r\n       |--------|       |---------|\r\n                |-&lt; , &lt;-|<\/pre><pre>  statement<\/pre><pre>       |-&gt; name &gt;--------------------------------|\r\n       |          |                              |\r\n       |          |         |--&gt; : &gt;---|         |\r\n       |          |         |          |         |\r\n       |          |-&gt; ( &gt;---|-&gt; expr &gt;-|---&gt; ) &gt;-|\r\n       |                  |              |       |\r\n  -----|                  |-----&lt; , &lt;----|       |--&gt; = &gt;--&gt; expr &gt;---&gt;\r\n       |                                         |\r\n       |       |--&lt; , &lt;---|                      |\r\n       |       |          |                      |\r\n       |-&gt; &lt; &gt;---&gt; name &gt;---&gt; &gt; &gt;----------------|<\/pre><pre>  clause<\/pre><pre>       |---&gt; FOR   &gt;---&gt; name &gt;---&gt; = &gt;---&gt; expr &gt;--------------|\r\n       |                                                        |\r\n       | |-&gt; WHILE &gt;-|                                          |\r\n       |-|           |-&gt; expr &gt;----------------------           |\r\n       | |-&gt; IF    &gt;-|          |   |   |   |   |   |           |\r\n  -----|                        &lt;   &lt;=  =   &lt;&gt;  &gt;=  &gt;           |----&gt;\r\n       |                        |   |   |   |   |   |           |\r\n       |                        ----------------------&gt; expr &gt;--|\r\n       |                                                        |\r\n       |---&gt; ELSE  &gt;--------------------------------------------|\r\n       |                                                        |\r\n       |---&gt; END   &gt;--------------------------------------------|<\/pre><pre>  expr<\/pre><pre>         |-&gt; + &gt;-|\r\n         |       |\r\n  -------|-------|-------&gt; term &gt;----------&gt;\r\n         |       |    |             |\r\n         |-&gt; - &gt;-|    |  |-&lt; + &lt;-|  |\r\n                      |  |       |  |\r\n                      |--|-&lt; - &lt;-|--|\r\n                         |       |\r\n                         |-&lt; : &lt;-|<\/pre><pre>  term<\/pre><pre>  ---------------------&gt; factor &gt;----------------------&gt;\r\n          |                                   |\r\n          |             |-&lt; * &lt;-|             |\r\n          |  |-------|  |       |  |-------|  |\r\n          |--|       |--|-&lt; \/ &lt;-|--|       |--|\r\n             |-&lt; . &lt;-|  |       |  |-&lt; . &lt;-|\r\n                        |-&lt; \\ &lt;-|<\/pre><pre>  factor<\/pre><pre>       |----------------&gt; number &gt;---------------|\r\n       |                                         |\r\n       |-&gt; name &gt;--------------------------------|\r\n       |          |                              |\r\n       |          |         |--&gt; : &gt;---|         |\r\n       |          |         |          |         |\r\n       |          |-&gt; ( &gt;---|-&gt; expr &gt;-|---&gt; ) &gt;-|\r\n       |                  |              |       |\r\n       |                  |-----&lt; , &lt;----|       |\r\n       |                                         |\r\n  -----|------------&gt; ( &gt;-----&gt; expr &gt;-----&gt; ) &gt;-|-|-------|-----&gt;\r\n       |                                         | |       | |\r\n       |                  |--------------|       | |-&gt; ' &gt;-| |\r\n       |                  |              |       |           |\r\n       |------------&gt; &lt; &gt;-|---&gt; expr &gt;---|-&gt; &gt; &gt;-|           |\r\n       |                    |          |         |           |\r\n       |                    |--&lt;   &lt;---|         |           |\r\n       |                    |          |         |           |\r\n       |                    |--&lt; ; &lt;---|         |           |\r\n       |                    |          |         |           |\r\n       |                    |--&lt; , &lt;---|         |           |\r\n       |                                         |           |\r\n       |------------&gt; &gt; &gt;-----&gt; expr &gt;-----&gt; &lt; &gt;-|           |\r\n       |                                         |           |\r\n       |-----&gt; factor &gt;---&gt; ** &gt;---&gt; factor &gt;----|           |\r\n       |                                                     |\r\n       |------------&gt; ' &gt;-----&gt; text &gt;-----&gt; ' &gt;-------------|<\/pre><pre>  number<\/pre><pre>      |----------|                          |-&gt; + &gt;-|\r\n      |          |                          |       |\r\n  -----&gt; int &gt;-----&gt; . &gt;---&gt; int &gt;-----&gt; E &gt;---------&gt; int &gt;----&gt;\r\n               |                   | |      |       |        |\r\n               |                   | |      |-&gt; - &gt;-|        |\r\n               |                   | |                       |\r\n               |---------------------------------------------|<\/pre><pre>  int<\/pre><pre>  ------------&gt; digit &gt;-----------&gt;\r\n            |           |\r\n            |-----------|<\/pre><pre>  name<\/pre><pre>                    |--&lt; letter &lt;--|\r\n                    |              |\r\n  ------&gt; letter &gt;--|--------------|-----&gt;\r\n                    |              |\r\n                    |--&lt; digit  &lt;--|<\/pre><pre>  command<\/pre><pre>                          |--&gt; name &gt;--|\r\n                          |            |\r\n  --------&gt; name &gt;--------|------------|----&gt;\r\n                          |            |\r\n                          |--&gt; char &gt;--|\r\n                          |            |\r\n                          |---&gt; ' &gt;----|<\/pre><pre>  text<\/pre><pre>                  |-&gt; letter &gt;--|\r\n                  |             |\r\n                  |-&gt; digit &gt;---|\r\n  ----------------|             |--------------&gt;\r\n              |   |-&gt; char &gt;----|   |\r\n              |   |             |   |\r\n              |   |-&gt; ' &gt;-&gt; ' &gt;-|   |\r\n              |                     |\r\n              |---------------------|<\/pre><h4>10.  The parser-interpreter<a name=\"bb3c2050-6d2e-4162-9f13-5c348036a7be\"><\/a><\/h4><pre>       The structure of the parser-interpreter is similar  to  that\r\n  of  Wirth's  compiler  [6] for his simple language, PL\/0 , except\r\n  that MATLAB  is  programmed  in  Fortran,  which  does  not  have\r\n  explicit recursion.  The interrelation of the primary subroutines\r\n  is shown in the following diagram.<\/pre><pre>        MAIN\r\n          |\r\n        MATLAB    |--CLAUSE\r\n          |       |    |\r\n        PARSE-----|--EXPR----TERM----FACTOR\r\n                  |    |       |       |\r\n                  |    |-------|-------|\r\n                  |    |       |       |\r\n                  |  STACK1  STACK2  STACKG\r\n                  |\r\n                  |--STACKP--PRINT\r\n                  |\r\n                  |--COMAND\r\n                  |\r\n                  |\r\n                  |          |--CGECO\r\n                  |          |\r\n                  |          |--CGEFA\r\n                  |          |\r\n                  |--MATFN1--|--CGESL\r\n                  |          |\r\n                  |          |--CGEDI\r\n                  |          |\r\n                  |          |--CPOFA\r\n                  |\r\n                  |\r\n                  |          |--IMTQL2\r\n                  |          |\r\n                  |          |--HTRIDI\r\n                  |          |\r\n                  |--MATFN2--|--HTRIBK\r\n                  |          |\r\n                  |          |--CORTH\r\n                  |          |\r\n                  |          |--COMQR3\r\n                  |\r\n                  |\r\n                  |--MATFN3-----CSVDC\r\n                  |\r\n                  |\r\n                  |          |--CQRDC\r\n                  |--MATFN4--|\r\n                  |          |--CQRSL\r\n                  |\r\n                  |\r\n                  |          |--FILES\r\n                  |--MATFN5--|\r\n                             |--SAVLOD<\/pre><pre>       Subroutine  PARSE  controls  the  interpretation   of   each\r\n  statement.    It  calls  subroutines  that  process  the  various\r\n  syntactic  quantities  such  as  command,  expression,  term  and\r\n  factor.   A  fairly  simple  program stack mechanism allows these\r\n  subroutines to recursively \"call\"  each  other  along  the  lines\r\n  allowed  by  the  syntax  diagrams.   The  four STACK subroutines\r\n  manage the variable memory  and  perform  elementary  operations,\r\n  such as matrix addition and transposition.<\/pre><pre>       The  four  subroutines  MATFN1  though  MATFN4  are   called\r\n  whenever  \"serious\"  matrix  computations are required.  They are\r\n  interface routines which call the  various  LINPACK  and  EISPACK\r\n  subroutines.  MATFN5 primarily handles the file access tasks.<\/pre><pre>       Two large real arrays, STKR and STKI, are used to store  all\r\n  the  matrices.   Four integer arrays are used to store the names,\r\n  the row and column dimensions, and the  pointers  into  the  real\r\n  stacks.  The following diagram illustrates this storage scheme.<\/pre><pre>  TOP         IDSTK     MSTK NSTK LSTK               STKR       STKI\r\n   --      -- -- -- --   --   --   --              --------   --------\r\n  |  |---&gt;|  |  |  |  | |  | |  | |  |-----------&gt;|        | |        |\r\n   --      -- -- -- --   --   --   --              --------   --------\r\n          |  |  |  |  | |  | |  | |  |            |        | |        |\r\n           -- -- -- --   --   --   --              --------   --------\r\n                .         .    .    .                  .          .\r\n                .         .    .    .                  .          .\r\n                .         .    .    .                  .          .\r\n           -- -- -- --   --   --   --              --------   --------\r\n  BOT     |  |  |  |  | |  | |  | |  |            |        | |        |\r\n   --      -- -- -- --   --   --   --              --------   --------\r\n  |  |---&gt;| X|  |  |  | | 2| | 1| |  |-----------&gt;|  3.14  | |  0.00  |\r\n   --      -- -- -- --   --   --   --              --------   --------\r\n          | A|  |  |  | | 2| | 2| |  |---------   |  0.00  | |  1.00  |\r\n           -- -- -- --   --   --   --          \\   --------   --------\r\n          | E| P| S|  | | 1| | 1| |  |-------   -&gt;| 11.00  | |  0.00  |\r\n           -- -- -- --   --   --   --        \\     --------   --------\r\n          | F| L| O| P| | 1| | 2| |  |------  \\   | 21.00  | |  0.00  |\r\n           -- -- -- --   --   --   --       \\  \\   --------   --------\r\n          | E| Y| E|  | |-1| |-1| |  |---    \\ |  | 12.00  | |  0.00  |\r\n           -- -- -- --   --   --   --    \\   | |   --------   --------\r\n          | R| A| N| D| | 1| | 1| |  |-   \\  | |  | 22.00  | |  0.00  |\r\n           -- -- -- --   --   --   --  \\  |  \\ \\   --------   --------\r\n                                       |  \\   \\ -&gt;| 1.E-15 | |  0.00  |\r\n                                       \\   \\   \\   --------   --------\r\n                                        \\   \\   -&gt;|  0.00  | |  0.00  |\r\n                                         \\   \\     --------   --------\r\n                                          \\   \\   |  0.00  | |  0.00  |\r\n                                           \\   \\   --------   --------\r\n                                            \\   -&gt;|  1.00  | |  0.00  |\r\n                                             \\     --------   --------\r\n                                              ---&gt;| URAND  | |  0.00  |\r\n                                                   --------   --------<\/pre><pre>       The top portion of the stack is used for temporary variables\r\n  and the bottom portion for saved variables.  The figure shows the\r\n  situation after the line\r\n     A = &lt;11,12; 21,22&gt;,  x = &lt;3.14, sqrt(-1)&gt;'<\/pre><pre>  has been processed.  The four permanent names,  EPS,  FLOP,  RAND\r\n  and  EYE,  occupy the last four positions of the variable stacks.\r\n  RAND has dimensions 1 by 1, but whenever its value is  requested,\r\n  a random number generator is used instead.  EYE has dimensions -1\r\n  by -1 to indicate that the actual dimensions must  be  determined\r\n  later by context.  The two saved variables have dimensions 2 by 2\r\n  and 2 by 1 and so take up a total of 6 locations.<\/pre><pre>       Subsequent statements involving  A  and  x  will  result  in\r\n  temporary  copies  being  made in the top of the stack for use in\r\n  the actual calculations.  Whenever the top of the  stack  reaches\r\n  the  bottom,  a  message  indicating  memory has been exceeded is\r\n  printed, but the current variables are not affected.<\/pre><pre>       This modular structure makes it possible to implement MATLAB\r\n  on a system with a limited amount of memory.  The object code for\r\n  the MATFN's and the LINPACK-EISPACK subroutines is rarely needed.\r\n  Although  it  is  not  standard,  many  Fortran operating systems\r\n  provide some overlay mechanism so that this code is brought  into\r\n  the  main memory only when required.  The variables, which occupy\r\n  a relatively small portion of the memory, remain in place,  while\r\n  the subroutines which process them are loaded a few at a time.<\/pre><h4>11.  The numerical algorithms<a name=\"b60d8a32-affb-4040-9e97-b22eab56e16a\"><\/a><\/h4><pre>       The algorithms underlying the  basic  MATLAB  functions  are\r\n  described  in the LINPACK and EISPACK guides [1-3]. The following\r\n  list gives the subroutines used by these functions.<\/pre><pre>     INV(A)          - CGECO,CGEDI\r\n     DET(A)          - CGECO,CGEDI\r\n     LU(A)           - CGEFA\r\n     RCOND(A)        - CGECO\r\n     CHOL(A)         - CPOFA\r\n     SVD(A)          - CSVDC\r\n     COND(A)         - CSVDC\r\n     NORM(A,2)       - CSVDC\r\n     PINV(A,eps)     - CSVDC\r\n     RANK(A,eps)     - CSVDC\r\n     QR(A)           - CQRDC,CQRSL\r\n     ORTH(A)         - CQRDC,CSQSL\r\n     A\\B and B\/A     - CGECO,CGESL if A is square.\r\n                     - CQRDC,CQRSL if A is not square.\r\n     EIG(A)          - HTRIDI,IMTQL2,HTRIBK if A is Hermitian.\r\n                     - CORTH,COMQR2         if A is not Hermitian.\r\n     SCHUR(A)        - same as EIG.\r\n     HESS(A)         - same as EIG.<\/pre><pre>       Minor modifications were made to all these subroutines.  The\r\n  LINPACK  routines  were  changed  to  replace the Fortran complex\r\n  arithmetic with explicit references to real and imaginary  parts.\r\n  Since  most of the floating point arithmetic is concentrated in a\r\n  few low-level subroutines which perform  vector  operations  (the\r\n  Basic  Linear  Algebra  Subprograms),  this  was not an extensive\r\n  change.  It also facilitated implementation of the FLOP and  CHOP\r\n  features  which count and optionally truncate each floating point\r\n  operation.<\/pre><pre>       The EISPACK subroutine COMQR2 was modified to  allow  access\r\n  to  the  Schur  triangular  form, ordinarily just an intermediate\r\n  result.   IMTQL2  was  modified  to  make  computation   of   the\r\n  eigenvectors   optional.    Both  subroutines  were  modified  to\r\n  eliminate the machine-dependent accuracy parameter  and  all  the\r\n  EISPACK subroutines were changed to include FLOP and CHOP.<\/pre><pre>       The algorithms employed for the  POLY  and  ROOTS  functions\r\n  illustrate  an  interesting  aspect  of  the  modern  approach to\r\n  eigenvalue computation.   POLY(A)  generates  the  characteristic\r\n  polynomial  of  A  and  ROOTS(POLY(A))  finds  the  roots of that\r\n  polynomial, which are, of course, the eigenvalues of A . But both\r\n  POLY  and  ROOTS  use  EISPACK eigenvalues subroutines, which are\r\n  based on similarity transformations.  So the  classical  approach\r\n  which  characterizes  eigenvalues  as roots of the characteristic\r\n  polynomial is actually reversed.<\/pre><pre>       If A is an n by n matrix, POLY(A) produces the  coefficients\r\n  C(1) through C(n+1), with C(1) = 1, in<\/pre><pre>        DET(z*EYE-A) = C(1)*z**n + ... + C(n)*z + C(n+1) .<\/pre><pre>  The algorithm can be expressed compactly using MATLAB:<\/pre><pre>        Z = EIG(A);\r\n        C = 0*ONES(n+1,1);  C(1) = 1;\r\n        for j = 1:n, C(2:j+1) = C(2:j+1) - Z(j)*C(1:j);\r\n        C<\/pre><pre>  This recursion is easily derived by expanding the product<\/pre><pre>        (z - z(1))*(z - z(2))* ... * (z-z(n)) .<\/pre><pre>  It is possible to prove that POLY(A) produces the coefficients in\r\n  the  characteristic  polynomial of a matrix within roundoff error\r\n  of  A .  This is true even if the  eigenvalues  of  A  are  badly\r\n  conditioned.    The  traditional  algorithms  for  obtaining  the\r\n  characteristic polynomial which do not use the eigenvalues do not\r\n  have such satisfactory numerical properties.<\/pre><pre>       If C is a vector with n+1  components,  ROOTS(C)  finds  the\r\n  roots of the polynomial of degree n ,<\/pre><pre>         p(z) = C(1)*z**n + ... + C(n)*z + C(n+1) .<\/pre><pre>  The algorithm simply involves computing the  eigenvalues  of  the\r\n  companion matrix:<\/pre><pre>        A = 0*ONES(n,n)\r\n        for j = 1:n, A(1,j) = -C(j+1)\/C(1);\r\n        for i = 2:n, A(i,i-1) = 1;\r\n        EIG(A)<\/pre><pre>  It is possible to prove that the results produced are  the  exact\r\n  eigenvalues  of  a  matrix within roundoff error of the companion\r\n  matrix A, but this does not mean that they are the exact roots of\r\n  a  polynomial with coefficients within roundoff error of those in\r\n  C .  There are more accurate, more efficient methods for  finding\r\n  polynomial  roots,  but  this  approach has the crucial advantage\r\n  that it does not require very much additional code.<\/pre><pre>       The elementary functions EXP, LOG, SQRT, SIN, COS  and  ATAN\r\n  are  applied  to  square  matrices  by  diagonalizing the matrix,\r\n  applying the functions to the  individual  eigenvalues  and  then\r\n  transforming back.  For example, EXP(A) is computed by<\/pre><pre>        &lt;X,D&gt; = EIG(A);\r\n        for j = 1:n, D(j,j) = EXP(D(j,j));\r\n        X*D\/X<\/pre><pre>  This is essentially method number 14  out  of  the  19  'dubious'\r\n  possibilities described in [8].  It is dubious because it doesn't\r\n  always work.  The matrix of eigenvectors  X  can  be  arbitrarily\r\n  badly  conditioned  and  all  accuracy lost in the computation of\r\n  X*D\/X.  A warning message is printed if RCOND(X) is  very  small,\r\n  but  this  only  catches the extreme cases.  An example of a case\r\n  not detected is when A has a double eigenvalue, but theoretically\r\n  only  one  linearly  independent  eigenvector associated with it.\r\n  The computed eigenvalues will be separated by  something  on  the\r\n  order  of the square root of the roundoff level.  This separation\r\n  will be reflected in RCOND(X) which will probably  not  be  small\r\n  enough to trigger the error message.  The computed EXP(A) will be\r\n  accurate to only half precision.  Better methods  are  known  for\r\n  computing EXP(A), but they do not easily extend to the other five\r\n  functions and would require a considerable amount  of  additional\r\n  code.<\/pre><pre>       The expression A**p is evaluated by repeated  multiplication\r\n  if p is an integer greater than 1.  Otherwise it is evaluated by<\/pre><pre>        &lt;X,D&gt; = EIG(A);\r\n        for j = 1:n, D(j,j) = EXP(p*LOG(D(j,j)))\r\n        X*D\/X<\/pre><pre>  This suffers from the same potential loss of  accuracy  if  X  is\r\n  badly conditioned.  It was partly for this reason that the case p\r\n  = 1 is included in the general case.  Comparison of A**1  with  A\r\n  gives some idea of the loss of accuracy for other values of p and\r\n  for the elementary functions.<\/pre><pre>       RREF, the reduced row echelon form, is of some  interest  in\r\n  theoretical  linear algebra, although it has little computational\r\n  value.  It is included in MATLAB for  pedagogical  reasons.   The\r\n  algorithm  is essentially Gauss-Jordan elimination with detection\r\n  of negligible columns applied to rectangular matrices.<\/pre><pre>       There are three separate places in MATLAB where the rank  of\r\n  a  matrix  is  implicitly  computed:  in RREF(A), in A\\B for non-\r\n  square A, and in  the  pseudoinverse  PINV(A).   Three  different\r\n  algorithms  with  three  different criteria for negligibility are\r\n  used and so it is possible that three different values  could  be\r\n  produced for the same matrix.  With RREF(A), the rank of A is the\r\n  number of nonzero rows.  The elimination algorithm used for  RREF\r\n  is  the  fastest of the three rank-determining algorithms, but it\r\n  is the least sophisticated numerically and  the  least  reliable.\r\n  With  A\\B,  the  algorithm  is  essentially  that used by example\r\n  subroutine SQRST  in  chapter  9  of  the  LINPACK  guide.   With\r\n  PINV(A),   the   algorithm   is   based  on  the  singular  value\r\n  decomposition and is described  in  chapter  11  of  the  LINPACK\r\n  guide.   The  SVD  algorithm  is the most time-consuming, but the\r\n  most reliable and is therefore also used for RANK(A).<\/pre><pre>       The  uniformly  distributed  random  numbers  in  RAND   are\r\n  obtained  from  the  machine-independent  random number generator\r\n  URAND described in [9].  It is possible  to  switch  to  normally\r\n  distributed   random   numbers,   which   are  obtained  using  a\r\n  transformation also described in [9].<\/pre><pre>       The computation of<\/pre><pre>                  2    2\r\n            sqrt(a  + b )<\/pre><pre>  is  required  in  many  matrix  algorithms,  particularly   those\r\n  involving  complex  arithmetic.   A  new approach to carrying out\r\n  this operation is described by Moler and Morrison [10].  It is  a\r\n  cubically  convergent  algorithm  which  starts with  a  and  b ,\r\n  rather than with their squares, and  thereby  avoids  destructive\r\n  arithmetic underflows and overflows.  In MATLAB, the algorithm is\r\n  used for complex modulus, Euclidean vector norm, plane rotations,\r\n  and  the  shift  calculation in the eigenvalue and singular value\r\n  iterations.<\/pre><h4>12.  FLOP and CHOP<a name=\"51e52b1a-7f48-45ae-8688-acf2b7f910dc\"><\/a><\/h4><pre>       Detailed information about the amount of  work  involved  in\r\n  matrix  calculations  and  the  resulting accuracy is provided by\r\n  FLOP and CHOP.  The basic unit of work is the \"flop\", or floating\r\n  point operation.  Roughly, one flop is one execution of a Fortran\r\n  statement like<\/pre><pre>        S = S + X(I)*Y(I)<\/pre><pre>  or<\/pre><pre>        Y(I) = Y(I) + T*X(I)<\/pre><pre>  In other words, it consists of one floating point multiplication,\r\n  together  with  one  floating  point  addition and the associated\r\n  indexing and storage reference operations.<\/pre><pre>       MATLAB will  print  the  number  of  flops  required  for  a\r\n  particular statement when the statement is terminated by an extra\r\n  comma.  For example, the line<\/pre><pre>        n = 20;  RAND(n)*RAND(n);,<\/pre><pre>  ends with an extra comma.  Two  20  by  20  random  matrices  are\r\n  generated  and  multiplied  together.   The result is assigned to\r\n  ANS, but the semicolon suppresses its printing.  The only  output\r\n  is<\/pre><pre>          8800 flops<\/pre><pre>  This is  n**3 + 2*n**2  flops,  n**2  for each random matrix  and\r\n  n**3 for the product.<\/pre><pre>       FLOP is a predefined vector with two components.  FLOP(1) is\r\n  the number of flops used by the most recently executed statement,\r\n  except that statements with zero flops are ignored.  For example,\r\n  after executing the previous statement,<\/pre><pre>        flop(1)\/n**3<\/pre><pre>  results in<\/pre><pre>        ANS   =<\/pre><pre>            1.1000<\/pre><pre>       FLOP(2) is the cumulative total of all the flops used  since\r\n  the beginning of the MATLAB session.  The statement<\/pre><pre>        FLOP = &lt;0 0&gt;<\/pre><pre>  resets the total.<\/pre><pre>       There are several difficulties  associated  with  keeping  a\r\n  precise  count  of  floating  point  operations.  An  addition or\r\n  subtraction that is not paired with a multiplication  is  usually\r\n  counted as a flop. The same is true of an isolated multiplication\r\n  that is  not  paired  with  an  addition.   Each  floating  point\r\n  division counts as a flop.  But the number of operations required\r\n  by system dependent library functions such as square root  cannot\r\n  be  counted, so most elementary functions are arbitrarily counted\r\n  as using only one flop.<\/pre><pre>       The  biggest  difficulty  occurs  with  complex  arithmetic.\r\n  Almost  all operations on the real parts of matrices are counted.\r\n  However, the operations on the  complex  parts  of  matrices  are\r\n  counted only when they involve nonzero elements.  This means that\r\n  simple operations on nonreal matrices require only about twice as\r\n  many  flops as the same operations on real matrices.  This factor\r\n  of two is not necessarily an accurate  measure  of  the  relative\r\n  costs of real and complex arithmetic.<\/pre><pre>       The result of each floating  point  operation  may  also  be\r\n  \"chopped\" to simulate a computer with a shorter word length.  The\r\n  details of this chopping operation depend upon the format of  the\r\n  floating point word.  Usually, the fraction in the floating point\r\n  word  can  be  regarded  as  consisting  of  several   octal   or\r\n  hexadecimal digits.  The least significant of these digits can be\r\n  set to zero by a logical masking operation.  Thus the statement<\/pre><pre>        CHOP(p)<\/pre><pre>  causes the  p  least significant octal or hexadecimal  digits  in\r\n  the  result  of  each floating point operation to be set to zero.\r\n  For example, if the computer being  used  has  an  IBM  360  long\r\n  floating  point  word with 14 hexadecimal digits in the fraction,\r\n  then CHOP(8) results in simulation of  a  computer  with  only  6\r\n  hexadecimal  digits  in the fraction, i.e. a short floating point\r\n  word. On a computer such as the CDC 6600 with  16  octal  digits,\r\n  CHOP(8)  results in about the same accuracy because the remaining\r\n  8 octal digits represent the same number of bits as 6 hexadecimal\r\n  digits.<\/pre><pre>       Some idea of the effect of CHOP on any particular system can\r\n  be obtained by executing the following statements.<\/pre><pre>        long,   t = 1\/10\r\n        long z, t = 1\/10\r\n        chop(8)\r\n        long,   t = 1\/10\r\n        long z, t = 1\/10<\/pre><pre>       The following Fortran subprograms illustrate more details of\r\n  FLOP  and CHOP. The first subprogram is a simplified example of a\r\n  system-dependent function used within MATLAB itself.  The  common\r\n  variable  FLP  is essentially the first component of the variable\r\n  FLOP.  The common variable CHP is initially zero, but it  is  set\r\n  to  p  by the statement  CHOP(p).  To shorten the DATA statement,\r\n  we assume there are only 6 hexadecimal digits.  We also assume an\r\n  extension  of  Fortran  that  allows .AND. to be used as a binary\r\n  operation between two real variables.<\/pre><pre>        REAL FUNCTION FLOP(X)\r\n        REAL X\r\n        INTEGER FLP,CHP\r\n        COMMON FLP,CHP\r\n        REAL MASK(5)\r\n        DATA MASK\/ZFFFFFFF0,ZFFFFFF00,ZFFFFF000,ZFFFF0000,ZFFF00000\/\r\n        FLP = FLP + 1\r\n        IF (CHP .EQ. 0) FLOP = X\r\n        IF (CHP .GE. 1 .AND. CHP .LE. 5) FLOP = X .AND. MASK(CHP)\r\n        IF (CHP .GE. 6) FLOP = 0.0\r\n        RETURN\r\n        END<\/pre><pre>       The following subroutine illustrates a typical  use  of  the\r\n  previous  function  within MATLAB.  It is a simplified version of\r\n  the Basic Linear Algebra Subprogram that adds a  scalar  multiple\r\n  of  one  vector  to another.  We assume here that the vectors are\r\n  stored with a memory increment of one.<\/pre><pre>        SUBROUTINE SAXPY(N,TR,TI,XR,XI,YR,YI)\r\n        REAL TR,TI,XR(N),XI(N),YR(N),YI(N),FLOP\r\n        IF (N .LE. 0) RETURN\r\n        IF (TR .EQ. 0.0 .AND. TI .EQ. 0.0) RETURN\r\n        DO 10 I = 1, N\r\n           YR(I) = FLOP(YR(I) + TR*XR(I) - TI*XI(I))\r\n           YI(I) = YI(I) + TR*XI(I) + TI*XR(I)\r\n           IF (YI(I) .NE. 0.0D0) YI(I) = FLOP(YI(I))\r\n     10 CONTINUE\r\n        RETURN\r\n        END<\/pre><pre>       The  saxpy  operation  is  perhaps  the   most   fundamental\r\n  operation  within  LINPACK.  It is used in the computation of the\r\n  LU, the QR and the  SVD  factorizations,  and  in  several  other\r\n  places.   We  see  that  adding  a  multiple of one vector with n\r\n  components to another uses n flops if the vectors  are  real  and\r\n  between  n  and  2*n  flops if the vectors have nonzero imaginary\r\n  components.<\/pre><pre>       The permanent MATLAB variable EPS is reset by the  statement\r\n  CHOP(p).   Its new value is usually the smallest inverse power of\r\n  two that satisfies the Fortran logical test<\/pre><pre>              FLOP(1.0+EPS) .GT. 1.0<\/pre><pre>  However, if EPS had been directly reset to a  larger  value,  the\r\n  old value is retained.<\/pre><h4>13.  Communicating with other programs<a name=\"28a145d0-40af-4836-a44a-946a10942a6a\"><\/a><\/h4><pre>       There  are  four  different  ways  MATLAB  can  be  used  in\r\n  conjunction with other programs:\r\n        -- USER,\r\n        -- EXEC,\r\n        -- SAVE and LOAD,\r\n        -- MATZ, CALL and RETURN .<\/pre><pre>       Let us illustrate each of  these  by  the  following  simple\r\n  example.<\/pre><pre>        n = 6\r\n        for i = 1:n, for j = 1:n, a(i,j) = abs(i-j);\r\n        A\r\n        X = inv(A)<\/pre><pre>       The example  A  could be introduced into MATLAB  by  writing\r\n  the following Fortran subroutine.<\/pre><pre>           SUBROUTINE USER(A,M,N,S,T)\r\n           DOUBLE PRECISION A(1),S,T\r\n           N = IDINT(A(1))\r\n           M = N\r\n           DO 10 J = 1, N\r\n           DO 10 I = 1, N\r\n              K = I + (J-1)*M\r\n              A(K) = IABS(I-J)\r\n        10 CONTINUE\r\n           RETURN\r\n           END<\/pre><pre>  This subroutine should be compiled  and  linked  into  MATLAB  in\r\n  place   of  the  original  version  of  USER.   Then  the  MATLAB\r\n  statements<\/pre><pre>        n = 6\r\n        A = user(n)\r\n        X = inv(A)<\/pre><pre>  do the job.<\/pre><pre>       The example A could be generated by  storing  the  following\r\n  text in a file named, say, EXAMPLE .<\/pre><pre>        for i = 1:n, for j = 1:n, a(i,j) = abs(i-j);<\/pre><pre>  Then the MATLAB statements<\/pre><pre>        n = 6\r\n        exec('EXAMPLE',0)\r\n        X = inv(A)<\/pre><pre>  have the desired effect.  The 0 as the optional second  parameter\r\n  of exec indicates that the text in the file should not be printed\r\n  on the terminal.<\/pre><pre>       The matrices A and X could also be  stored  in  files.   Two\r\n  separate main programs would be involved.  The first is:<\/pre><pre>           PROGRAM MAINA\r\n           DOUBLE PRECISION A(10,10)\r\n           N = 6\r\n           DO 10 J = 1, N\r\n           DO 10 I = 1, N\r\n              A(I,J) = IABS(I-J)\r\n        10 CONTINUE\r\n           OPEN(UNIT=1,FILE='A')\r\n           WRITE(1,101) N,N\r\n       101 FORMAT('A   ',2I4)\r\n           DO 20 J = 1, N\r\n              WRITE(1,102) (A(I,J),I=1,N)\r\n        20 CONTINUE\r\n       102 FORMAT(4Z18)\r\n           END<\/pre><pre>  The OPEN statement may take different forms on different systems.\r\n  It  attaches  Fortran  logical unit number 1 to the file named A.\r\n  The FORMAT  number  102  may  also  be  system  dependent.   This\r\n  particular one is appropriate for hexadecimal computers with an 8\r\n  byte double precision floating point  word.   Check,  or  modify,\r\n  MATLAB subroutine SAVLOD.<\/pre><pre>       After this program is executed, enter MATLAB  and  give  the\r\n  following statements:<\/pre><pre>        load('A')\r\n        X = inv(A)\r\n        save('X',X)<\/pre><pre>  If all goes according to plan, this will read the matrix  A  from\r\n  the  file A, invert it, store the inverse in X and then write the\r\n  matrix X on the file X .  The following program can then access X\r\n  .<\/pre><pre>           PROGRAM MAINX\r\n           DOUBLE PRECISION X(10,10)\r\n           OPEN(UNIT=1,FILE='X')\r\n           REWIND 1\r\n           READ (1,101) ID,M,N\r\n       101 FORMAT(A4,2I4)\r\n           DO 10 J = 1, N\r\n              READ(1,102) (X(I,J),I=1,M)\r\n        10 CONTINUE\r\n       102 FORMAT(4Z18)\r\n           ...\r\n           ...<\/pre><pre>       The most elaborate mechanism  involves  using  MATLAB  as  a\r\n  subroutine within another program.  Communication with the MATLAB\r\n  stack is accomplished using subroutine MATZ which is  distributed\r\n  with  MATLAB,  but  which  is  not  used  by  MATLAB itself.  The\r\n  preample of MATZ is:<\/pre><pre>        SUBROUTINE MATZ(A,LDA,M,N,IDA,JOB,IERR)\r\n        INTEGER LDA,M,N,IDA(1),JOB,IERR\r\n        DOUBLE PRECISION A(LDA,N)\r\n  C\r\n  C     ACCESS MATLAB VARIABLE STACK\r\n  C     A IS AN M BY N MATRIX, STORED IN AN ARRAY WITH\r\n  C         LEADING DIMENSION LDA.\r\n  C     IDA IS THE NAME OF A.\r\n  C         IF IDA IS AN INTEGER K LESS THAN 10, THEN THE NAME IS 'A'K\r\n  C         OTHERWISE, IDA(1:4) IS FOUR CHARACTERS, FORMAT 4A1.\r\n  C     JOB =  0  GET REAL A FROM MATLAB,\r\n  C         =  1  PUT REAL A INTO MATLAB,\r\n  C         = 10  GET IMAG PART OF A FROM MATLAB,\r\n  C         = 11  PUT IMAG PART OF A INTO MATLAB.\r\n  C     RETURN WITH NONZERO IERR AFTER MATLAB ERROR MESSAGE.\r\n  C\r\n  C     USES MATLAB ROUTINES STACKG, STACKP AND ERROR<\/pre><pre>       The preample of subroutine MATLAB is:<\/pre><pre>        SUBROUTINE MATLAB(INIT)\r\n  C     INIT = 0 FOR FIRST ENTRY, NONZERO FOR SUBSEQUENT ENTRIES<\/pre><pre>       To do our example, write the following program:<\/pre><pre>           DOUBLE PRECISION A(10,10),X(10,10)\r\n           INTEGER IDA(4),IDX(4)\r\n           DATA LDA\/10\/\r\n           DATA IDA\/'A',' ',' ',' '\/, IDX\/'X',' ',' ',' '\/\r\n           CALL MATLAB(0)\r\n           N = 6\r\n           DO 10 J = 1, N\r\n           DO 10 I = 1, N\r\n              A(I,J) = IABS(I-J)\r\n        10 CONTINUE\r\n           CALL MATZ(A,LDA,N,N,IDA,1,IERR)\r\n           IF (IERR .NE. 0) GO TO ...\r\n           CALL MATLAB(1)\r\n           CALL MATZ(X,LDA,N,N,IDX,0,IERR)\r\n           IF (IERR .NE. 0) GO TO ...\r\n           ...\r\n           ...<\/pre><pre>  When this program is executed, the call to MATLAB(0) produces the\r\n  MATLAB greeting, then waits for input.  The command<\/pre><pre>           return<\/pre><pre>  sends control back to our  example  program.   The  matrix  A  is\r\n  generated  by the program and sent to the stack by the first call\r\n  to MATZ.  The call to MATLAB(1) produces the MATLAB prompt.  Then\r\n  the statements<\/pre><pre>           X = inv(A)\r\n           return<\/pre><pre>  will invert our matrix, put the result on the stack and  go  back\r\n  to our program.  The second call to MATZ will retrieve X .<\/pre><pre>       By the way, this matrix  X  is interesting. Take a  look  at\r\n  round(2*(n-1)*X).<\/pre><pre>  References<\/pre><pre>  [1]  J. J. Dongarra, J. R. Bunch, C. B. Moler and G. W.  Stewart,\r\n       LINPACK  Users'  Guide,  Society  for Industrial and Applied\r\n       Mathematics, Philadelphia, 1979.<\/pre><pre>  [2]  B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S.  Garbow,  Y.\r\n       Ikebe, V. C. Klema, C. B. Moler, Matrix Eigensystem Routines\r\n       -- EISPACK Guide, Lecture Notes in Computer Science,  volume\r\n       6, second edition, Springer-Verlag, 1976.<\/pre><pre>  [3]  B. S. Garbow, J. M. Boyle, J.  J.  Dongarra,  C.  B.  Moler,\r\n       Matrix  Eigensystem  Routines  --  EISPACK  Guide Extension,\r\n       Lecture Notes in  Computer  Science,  volume  51,  Springer-\r\n       Verlag, 1977.\r\n  [4]  S. Cohen and  S.  Piper,  SPEAKEASY  III  Reference  Manual,\r\n       Speakeasy Computing Corp., Chicago, Ill., 1979.<\/pre><pre>  [5]  J. H. Wilkinson  and  C.  Reinsch,  Handbook  for  Automatic\r\n       Computation,  volume  II,  Linear  Algebra, Springer-Verlag,\r\n       1971.<\/pre><pre>  [6]  Niklaus Wirth, Algorithms  +  Data  Structures  =  Programs,\r\n       Prentice-Hall, 1976.<\/pre><pre>  [7]  H. B. Keller and D. Sachs, \"Calculations of the Conductivity\r\n       of  a  Medium Containing Cylindrical Inclusions\", J. Applied\r\n       Physics 35, 537-538, 1964.<\/pre><pre>  [8]  C. B. Moler and C. F. Van Loan,  Nineteen  Dubious  Ways  to\r\n       Compute  the  Exponential  of a Matrix, SIAM Review 20, 801-\r\n       836, 1979.<\/pre><pre>  [9]  G. E. Forsythe, M. A. Malcolm  and  C.  B.  Moler,  Computer\r\n       Methods for Mathematical Computations, Prentice-Hall, 1977.<\/pre><pre>  [10] C. B. Moler and D. R. Morrison, \"Replacing square  roots  by\r\n       Pythagorean   sums\",  University  of  New  Mexico,  Computer\r\n       Science  Department,   technical   report,   submitted   for\r\n       publication, 1980.<\/pre><h4>Appendix.  The HELP document<a name=\"563524e7-7415-4226-b8d4-45d40a500685\"><\/a><\/h4><pre>  NEWS  MATLAB NEWS dated May, 1981.\r\n        This describes recent or local changes.\r\n        The new features added since the November,  1980,  printing\r\n        of the Users' Guide include DIARY, EDIT, KRON, MACRO, PLOT,\r\n        RAT, TRIL, TRIU and six element-by-element operations:\r\n              .*   .\/   .\\   .*.   .\/.   .\\.\r\n        Some additional  capabilities  have  been  added  to  EXIT,\r\n        RANDOM, RCOND, SIZE and SVD.<\/pre><pre>  INTRO Welcome to MATLAB.<\/pre><pre>        Here are a few sample statements:<\/pre><pre>        A = &lt;1 2; 3 4&gt;\r\n        b = &lt;5 6&gt;'\r\n        x = A\\b\r\n        &lt;V,D&gt; = eig(A),  norm(A-V*D\/V)\r\n        help \\ , help eig\r\n        exec('demo',7)<\/pre><pre>        For more information, see the MATLAB Users' Guide which  is\r\n        contained in file ...  or may be obtained from ... .<\/pre><pre>  HELP  HELP gives assistance.\r\n        HELP HELP obviously prints this message.\r\n        To see all the HELP messages, list the file ... .<\/pre><pre>  &lt;     &lt; &gt; Brackets used in forming vectors and matrices.\r\n        &lt;6.9  9.64  SQRT(-1)&gt;  is  a  vector  with  three  elements\r\n        separated  by  blanks.   &lt;6.9,  9.64, sqrt(-1)&gt; is the same\r\n        thing.  &lt;1+I 2-I 3&gt;  and  &lt;1 +I 2 -I 3&gt;  are not the  same.\r\n        The first has three elements, the second has five.\r\n        &lt;11 12 13; 21 22 23&gt;  is a 2 by 3 matrix .   The  semicolon\r\n        ends the first row.<\/pre><pre>        Vectors and matrices can be used inside &lt; &gt; brackets.\r\n        &lt;A B; C&gt;  is allowed if the number of rows  of   A   equals\r\n        the  number  of rows of  B  and the number of columns of  A\r\n        plus the number of columns of   B   equals  the  number  of\r\n        columns  of   C  .   This  rule  generalizes in a hopefully\r\n        obvious way to allow fairly complicated constructions.<\/pre><pre>        A = &lt; &gt;  stores an empty matrix in  A , thereby removing it\r\n        from the list of current variables.<\/pre><pre>        For the use of &lt; and &gt; on the left of  the  =  in  multiple\r\n        assignment statements, see LU, EIG, SVD and so on.<\/pre><pre>        In WHILE and IF clauses, &lt;&gt;  means  less  than  or  greater\r\n        than,  i.e.  not  equal, &lt; means less than, &gt; means greater\r\n        than, &lt;= means less than or equal, &gt;= means greater than or\r\n        equal.<\/pre><pre>        For the use of &gt; and &lt; to delineate macros, see MACRO.<\/pre><pre>  &gt;     See &lt; .  Also see MACRO.<\/pre><pre>  (     ( ) Used to indicate precedence in  arithmetic  expressions\r\n        in  the  usual way.  Used to enclose arguments of functions\r\n        in the usual way.  Used to enclose  subscripts  of  vectors\r\n        and  matrices  in  a  manner somewhat more general than the\r\n        usual way.  If  X   and   V  are  vectors,  then   X(V)  is\r\n        &lt;X(V(1)),  X(V(2)),  ...,  X(V(N))&gt; .  The components of  V\r\n        are rounded to nearest integers and used as subscripts.  An\r\n        error  occurs  if  any  such  subscript  is  less than 1 or\r\n        greater than the dimension of  X .  Some examples:\r\n        X(3)  is the third element of  X .\r\n        X(&lt;1 2 3&gt;)  is the first three elements of  X .  So is\r\n        X(&lt;SQRT(2), SQRT(3), 4*ATAN(1)&gt;)  .\r\n        If  X  has  N  components,  X(N:-1:1) reverses them.\r\n        The same indirect subscripting is used in matrices.  If   V\r\n        has   M  components and  W  has  N  components, then A(V,W)\r\n        is the  M by N  matrix formed from the elements of A  whose\r\n        subscripts are the elements of  V  and  W .  For example...\r\n        A(&lt;1,5&gt;,:) = A(&lt;5,1&gt;,:)  interchanges rows 1 and 5 of  A .<\/pre><pre>  )     See  ( .<\/pre><pre>  =     Used in assignment statements and to mean equality in WHILE\r\n        and IF clauses.<\/pre><pre>  .     Decimal point.  314\/100, 3.14  and   .314E1   are  all  the\r\n        same.<\/pre><pre>        Element-by-element multiplicative operations  are  obtained\r\n        using  .*  ,  .\/  , or .\\ .  For example, C = A .\/ B is the\r\n        matrix with elements  c(i,j) = a(i,j)\/b(i,j) .<\/pre><pre>        Kronecker tensor products and quotients are  obtained  with\r\n        .*. , .\/.  and .\\. .  See KRON.<\/pre><pre>        Two or  more  points  at  the  end  of  the  line  indicate\r\n        continuation.    The   total  line  length  limit  is  1024\r\n        characters.<\/pre><pre>  ,     Used to separate matrix subscripts and function  arguments.\r\n        Used  at  the  end  of  FOR, WHILE and IF clauses.  Used to\r\n        separate statements  in  multi-statement  lines.   In  this\r\n        situation,  it  may  be  replaced  by semicolon to suppress\r\n        printing.<\/pre><pre>  ;     Used inside brackets to end rows.\r\n        Used after an expression or statement to suppress printing.\r\n        See SEMI.\r\n  \\     Backslash or matrix left division.   A\\B   is  roughly  the\r\n        same  as   INV(A)*B  , except it is computed in a different\r\n        way.  If  A  is an N by N matrix and  B  is a column vector\r\n        with  N  components, or a matrix with several such columns,\r\n        then X = A\\B  is the solution to  the  equation   A*X  =  B\r\n        computed  by  Gaussian  elimination.   A warning message is\r\n        printed if  A is badly scaled or nearly singular.\r\n        A\\EYE produces the inverse of  A .<\/pre><pre>        If  A  is an  M by N  matrix with  M &lt; or &gt; N  and  B  is a\r\n        column vector with  M  components, or a matrix with several\r\n        such columns, then  X = A\\B  is the solution in  the  least\r\n        squares  sense  to  the under- or overdetermined system  of\r\n        equations A*X = B .  The  effective  rank,  K,  of   A   is\r\n        determined  from  the  QR  decomposition  with pivoting.  A\r\n        solution  X  is  computed  which  has  at  most  K  nonzero\r\n        components  per column.  If  K &lt; N this will usually not be\r\n        the same solution as PINV(A)*B .\r\n        A\\EYE produces a generalized inverse of  A .<\/pre><pre>        If A and B have the  same  dimensions,  then  A  .\\  B  has\r\n        elements a(i,j)\\b(i,j) .<\/pre><pre>        Also, see EDIT.<\/pre><pre>  \/     Slash or matrix right division.  B\/A  is roughly  the  same\r\n        as  B*INV(A) .  More precisely,  B\/A = (A'\\B')' .  See \\ .<\/pre><pre>        IF A and B have the  same  dimensions,  then  A  .\/  B  has\r\n        elements a(i,j)\/b(i,j) .<\/pre><pre>        Two or more slashes together on a line indicate  a  logical\r\n        end of line.  Any following text is ignored.<\/pre><pre>  '     Transpose.  X'  is the complex conjugate transpose of  X  .\r\n        Quote.   'ANY  TEXT'   is a vector whose components are the\r\n        MATLAB internal codes for the characters.  A  quote  within\r\n        the text is indicated by two quotes.  See DISP and FILE .<\/pre><pre>  +     Addition.  X + Y .  X and Y must have the same dimensions.<\/pre><pre>  -     Subtraction.  X  -  Y  .   X  and  Y  must  have  the  same\r\n        dimensions.<\/pre><pre>  *     Matrix multiplication, X*Y .  Any scalar (1  by  1  matrix)\r\n        may multiply anything.  Otherwise, the number of columns of\r\n        X must equal the number of rows of Y .<\/pre><pre>        Element-by-element multiplication is obtained with X .* Y .<\/pre><pre>        The Kronecker tensor product is denoted by X .*. Y .<\/pre><pre>        Powers.  X**p  is  X  to the   p   power.   p   must  be  a\r\n        scalar.  If  X  is a matrix, see  FUN .<\/pre><pre>  :     Colon.  Used in subscripts,  FOR  iterations  and  possibly\r\n        elsewhere.\r\n        J:K  is the same as  &lt;J, J+1, ..., K&gt;\r\n        J:K  is empty if  J &gt; K .\r\n        J:I:K  is the same as  &lt;J, J+I, J+2I, ..., K&gt;\r\n        J:I:K  is empty if  I &gt; 0 and J &gt; K or if I &lt; 0 and J &lt; K .\r\n        The colon notation can be used to pick out  selected  rows,\r\n        columns and elements of vectors and matrices.\r\n        A(:)  is all the  elements  of  A,  regarded  as  a  single\r\n        column.\r\n        A(:,J)  is the  J-th  column of A\r\n        A(J:K)  is  A(J),A(J+1),...,A(K)\r\n        A(:,J:K)  is  A(:,J),A(:,J+1),...,A(:,K) and so on.\r\n        For the use of the colon in the FOR statement, See FOR .<\/pre><pre>  ABS   ABS(X)  is the absolute value, or complex modulus,  of  the\r\n        elements of X .<\/pre><pre>  ANS   Variable created automatically  when  expressions  are  not\r\n        assigned to anything else.<\/pre><pre>  ATAN  ATAN(X)  is the arctangent of  X .  See FUN .<\/pre><pre>  BASE  BASE(X,B) is a vector containing the base B  representation\r\n        of   X  .   This is often used in conjunction with DISPLAY.\r\n        DISPLAY(X,B)  is  the  same  as  DISPLAY(BASE(X,B)).    For\r\n        example,    DISP(4*ATAN(1),16)   prints   the   hexadecimal\r\n        representation of pi.<\/pre><pre>  CHAR  CHAR(K)  requests  an  input  line  containing   a   single\r\n        character  to  replace  MATLAB  character  number  K in the\r\n        following table.  For example, CHAR(45) replaces backslash.\r\n        CHAR(-K) replaces the alternate character number K.<\/pre><pre>                  K  character alternate name\r\n                0 - 9   0 - 9    0 - 9   digits\r\n               10 - 35  A - Z    a - z   letters\r\n                 36                      blank\r\n                 37       (        (     lparen\r\n                 38       )        )     rparen\r\n                 39       ;        ;     semi\r\n                 40       :        |     colon\r\n                 41       +        +     plus\r\n                 42       -        -     minus\r\n                 43       *        *     star\r\n                 44       \/        \/     slash\r\n                 45       \\        $     backslash\r\n                 46       =        =     equal\r\n                 47       .        .     dot\r\n                 48       ,        ,     comma\r\n                 49       '        \"     quote\r\n                 50       &lt;        [     less\r\n                 51       &gt;        ]     great<\/pre><pre>  CHOL  Cholesky factorization.  CHOL(X)  uses  only  the  diagonal\r\n        and upper triangle of  X .  The lower triangular is assumed\r\n        to be the (complex conjugate) transpose of the  upper.   If\r\n        X   is  positive  definite,  then  R = CHOL(X)  produces an\r\n        upper triangular  R  so that  R'*R = X .   If   X   is  not\r\n        positive definite, an error message is printed.<\/pre><pre>  CHOP  Truncate arithmetic.  CHOP(P) causes P places to be chopped\r\n        off   after   each   arithmetic   operation  in  subsequent\r\n        computations.  This means  P  hexadecimal  digits  on  some\r\n        computers  and  P octal digits on others.  CHOP(0) restores\r\n        full precision.<\/pre><pre>  CLEAR Erases all variables, except EPS, FLOP, EYE and RAND.\r\n        X = &lt;&gt;  erases only variable  X .  So does CLEAR X .<\/pre><pre>  COND  Condition number in 2-norm.  COND(X) is the  ratio  of  the\r\n        largest singular value of  X  to the smallest.<\/pre><pre>  CONJG CONJG(X)  is the complex conjugate of  X .<\/pre><pre>  COS   COS(X)  is the cosine of  X .  See FUN .<\/pre><pre>  DET   DET(X)  is the determinant of the square matrix  X .<\/pre><pre>  DIAG  If  V  is  a  row  or  column  vector  with  N  components,\r\n        DIAG(V,K)   is a square matrix of order  N+ABS(K)  with the\r\n        elements of  V  on the K-th diagonal.  K = 0  is  the  main\r\n        diagonal,  K  &gt;  0  is above the main diagonal and K &lt; 0 is\r\n        below the main diagonal.  DIAG(V)  simply puts  V   on  the\r\n        main diagonal.\r\n        eg. DIAG(-M:M) + DIAG(ONES(2*M,1),1) + DIAG(ONES(2*M,1),-1)\r\n        produces a tridiagonal matrix of order 2*M+1 .\r\n        IF  X  is a matrix,  DIAG(X,K)  is a column  vector  formed\r\n        from the elements of the K-th diagonal of  X .\r\n        DIAG(X)  is the main diagonal of  X .\r\n        DIAG(DIAG(X))  is a diagonal matrix .<\/pre><pre>  DIARY DIARY('file') causes a  copy  of  all  subsequent  terminal\r\n        input and most of the resulting output to be written on the\r\n        file. DIARY(0) turns it off.  See FILE.<\/pre><pre>  DISP  DISPLAY(X) prints X  in  a  compact  format.   If  all  the\r\n        elements  of  X  are  integers  between 0 and 51, then X is\r\n        interpreted  as  MATLAB  text  and   printed   accordingly.\r\n        Otherwise,  +  ,  -   and  blank  are printed for positive,\r\n        negative and zero elements.  Imaginary parts are ignored.\r\n        DISP(X,B) is the same as DISP(BASE(X,B)).<\/pre><pre>  EDIT  There  are  no   editing   features   available   on   most\r\n        installations and EDIT is not a command.  However, on a few\r\n        systems a command line consisting of a single  backslash  \\\r\n        will  cause  the local file editor to be called with a copy\r\n        of the  previous  input  line.   When  the  editor  returns\r\n        control to MATLAB, it will execute the line again.<\/pre><pre>  EIG   Eigenvalues and eigenvectors.\r\n        EIG(X) is a vector containing the eigenvalues of  a  square\r\n        matrix  X .\r\n        &lt;V,D&gt;  =  EIG(X)   produces  a  diagonal  matrix    D    of\r\n        eigenvalues  and  a  full  matrix  V  whose columns are the\r\n        corresponding eigenvectors so that  X*V = V*D .<\/pre><pre>  ELSE  Used with IF .<\/pre><pre>  END   Terminates the scope  of  FOR,  WHILE  and  IF  statements.\r\n        Without  END's,  FOR  and WHILE repeat all statements up to\r\n        the end of the line.  Each END is paired with  the  closest\r\n        previous  unpaired FOR or WHILE and serves to terminate its\r\n        scope.  The line\r\n        FOR I=1:N, FOR J=1:N, A(I,J)=1\/(I+J-1); A\r\n        would cause A to be printed  N**2  times, once for each new\r\n        element.  On the other hand, the line\r\n        FOR I=1:N, FOR J=1:N, A(I,J)=1\/(I+J-1); END, END, A\r\n        will lead to only the final printing of  A .\r\n        Similar considerations apply to WHILE.\r\n        EXIT terminates execution of loops or of MATLAB itself.<\/pre><pre>  EPS   Floating point relative  accuracy.   A  permanent  variable\r\n        whose  value is initially the distance from 1.0 to the next\r\n        largest floating point number.  The  value  is  changed  by\r\n        CHOP,  and  other values may be assigned.  EPS is used as a\r\n        default tolerance by PINV and RANK.<\/pre><pre>  EXEC  EXEC('file',k) obtains  subsequent  MATLAB  input  from  an\r\n        external  file.  The printing of input is controlled by the\r\n        optional parameter k .\r\n        If k = 1 , the input is echoed.\r\n        If k = 2 , the MATLAB prompt &lt;&gt; is printed.\r\n        If k = 4 , MATLAB pauses before each prompt and waits for a\r\n        null line to continue.\r\n        If k = 0 , there is no echo, prompt or pause.  This is  the\r\n        default if the exec command is followed by a semicolon.\r\n        If k = 7 , there will be echos, prompts and pauses. This is\r\n        useful for demonstrations on video terminals.\r\n        If k = 3 , there will be echos and prompts, but no  pauses.\r\n        This is the the default if the exec command is not followed\r\n        by a semicolon.\r\n        EXEC(0) causes subsequent input to  be  obtained  from  the\r\n        terminal. An end-of-file has the same effect.\r\n        EXEC's may be nested, i.e. the text in the file may contain\r\n        EXEC of another file.  EXEC's may also be driven by FOR and\r\n        WHILE loops.\r\n  EXIT  Causes termination of a FOR or WHILE loop.\r\n        If not in a loop, terminates execution of MATLAB.<\/pre><pre>  EXP   EXP(X)  is the exponential of  X ,  e  to the X .  See  FUN\r\n        .<\/pre><pre>  EYE   Identity matrix.  EYE(N) is the N  by  N  identity  matrix.\r\n        EYE(M,N)   is an M by N matrix with 1's on the diagonal and\r\n        zeros elsewhere.  EYE(A)  is the same size  as   A  .   EYE\r\n        with  no  arguments is an identity matrix of whatever order\r\n        is appropriate in the context.   For  example,  A  +  3*EYE\r\n        adds  3  to each diagonal element of  A .<\/pre><pre>  FILE  The EXEC, SAVE, LOAD,  PRINT  and  DIARY  functions  access\r\n        files.   The  'file'  parameter  takes  different forms for\r\n        different operating systems.  On most systems,  'file'  may\r\n        be a string of up to 32 characters in quotes.  For example,\r\n        SAVE('A') or EXEC('matlab\/demo.exec') .  The string will be\r\n        used as the name of a file in the local operating system.\r\n        On all systems, 'file' may be a positive integer   k   less\r\n        than  10  which  will  be  used  as  a FORTRAN logical unit\r\n        number. Some systems then automatically access a file  with\r\n        a  name  like  FORT.k  or FORk.DAT. Other systems require a\r\n        file with a name like FT0kF001 to be assigned  to  unit   k\r\n        before  MATLAB  is  executed. Check your local installation\r\n        for details.<\/pre><pre>  FLOPS Count of floating point operations.\r\n        FLOPS  is  a  permanently  defined  row  vector  with   two\r\n        elements.    FLOPS(1)  is  the  number  of  floating  point\r\n        operations counted during the previous statement.  FLOPS(2)\r\n        is  a  cumulative total.  FLOPS can be used in the same way\r\n        as any other vector.  FLOPS(2) = 0  resets  the  cumulative\r\n        total.   In  addition,  FLOPS(1) will be printed whenever a\r\n        statement is terminated by an extra comma.  For example,\r\n        X = INV(A);,\r\n        or\r\n        COND(A),   (as the last statement on the line).\r\n        HELP FLPS gives more details.<\/pre><pre>  FLPS  More detail on FLOPS.\r\n        It is not feasible to count absolutely all  floating  point\r\n        operations,  but  most  of  the important ones are counted.\r\n        Each multiply and add in a real vector operation such as  a\r\n        dot  product  or  a 'saxpy' counts one flop.  Each multiply\r\n        and add in a complex vector  operation  counts  two  flops.\r\n        Other additions, subtractions and multiplications count one\r\n        flop each if the result is real and two flops if it is not.\r\n        Real  divisions  count one and complex divisions count two.\r\n        Elementary functions count one if real and two if  complex.\r\n        Some examples.  If A and B are real N by N matrices, then\r\n        A + B  counts N**2 flops,\r\n        A*B    counts N**3 flops,\r\n        A**100 counts 99*N**3 flops,\r\n        LU(A)  counts roughly (1\/3)*N**3 flops.<\/pre><pre>  FOR   Repeat statements a specific number of times.\r\n        FOR variable = expr, statement, ..., statement, END\r\n        The END at the end of a line may  be  omitted.   The  comma\r\n        before  the  END  may  also be omitted.  The columns of the\r\n        expression are stored one at a time  in  the  variable  and\r\n        then the following statements, up to the END, are executed.\r\n        The expression is often of the form X:Y, in which case  its\r\n        columns  are  simply  scalars.  Some examples (assume N has\r\n        already been assigned a value).\r\n        FOR I = 1:N, FOR J = 1:N, A(I,J) = 1\/(I+J-1);\r\n        FOR J = 2:N-1, A(J,J) = J; END; A\r\n        FOR S = 1.0: -0.1: 0.0, ...  steps S with increments of -0.1 .\r\n        FOR E = EYE(N), ...   sets  E  to the unit N-vectors.\r\n        FOR V = A, ...   has the same effect as\r\n        FOR J = 1:N, V = A(:,J); ...  except J is also set here.<\/pre><pre>  FUN   For matrix arguments  X , the  functions  SIN,  COS,  ATAN,\r\n        SQRT,  LOG,  EXP and X**p are computed using eigenvalues  D\r\n        and eigenvectors  V .  If  &lt;V,D&gt; =  EIG(X)   then   f(X)  =\r\n        V*f(D)\/V  .   This method may give inaccurate results if  V\r\n        is badly conditioned.  Some idea of  the  accuracy  can  be\r\n        obtained by comparing  X**1  with  X .\r\n        For vector arguments,  the  function  is  applied  to  each\r\n        component.<\/pre><pre>  HESS  Hessenberg form.  The Hessenberg form of a matrix  is  zero\r\n        below the first subdiagonal.  If the matrix is symmetric or\r\n        Hermitian,  the  form  is  tridiagonal.   &lt;P,H&gt;  =  HESS(A)\r\n        produces  a  unitary  matrix P and a Hessenberg matrix H so\r\n        that A = P*H*P'.  By itself, HESS(A) returns H.<\/pre><pre>  HILB  Inverse Hilbert matrix.  HILB(N)  is the inverse of  the  N\r\n        by  N   matrix  with elements  1\/(i+j-1), which is a famous\r\n        example of a badly conditioned matrix.  The result is exact\r\n        for  N  less than about 15, depending upon the computer.<\/pre><pre>  IF    Conditionally execute statements.  Simple form...\r\n        IF expression rop expression, statements\r\n        where rop is =, &lt;, &gt;, &lt;=, &gt;=, or  &lt;&gt;  (not  equal)  .   The\r\n        statements  are  executed  once if the indicated comparison\r\n        between the real parts of the first components of  the  two\r\n        expressions  is true, otherwise the statements are skipped.\r\n        Example.\r\n        IF ABS(I-J) = 1, A(I,J) = -1;\r\n        More complicated forms use END in the same way it  is  used\r\n        with FOR and WHILE and use ELSE as an abbreviation for END,\r\n        IF expression not rop expression .  Example\r\n        FOR I = 1:N, FOR J = 1:N, ...\r\n           IF I = J, A(I,J) = 2; ELSE IF ABS(I-J) = 1, A(I,J) = -1; ...\r\n           ELSE A(I,J) = 0;\r\n        An easier way to accomplish the same thing is\r\n        A = 2*EYE(N);\r\n        FOR I = 1:N-1, A(I,I+1) = -1; A(I+1,I) = -1;<\/pre><pre>  IMAG  IMAG(X)  is the imaginary part of  X .<\/pre><pre>  INV   INV(X)  is the inverse of the square matrix  X .  A warning\r\n        message  is  printed  if   X   is  badly  scaled  or nearly\r\n        singular.<\/pre><pre>  KRON  KRON(X,Y) is the Kronecker tensor product of X and Y  .  It\r\n        is  also  denoted by X .*. Y . The result is a large matrix\r\n        formed by taking all possible products between the elements\r\n        of  X  and  those  of Y . For example, if X is 2 by 3, then\r\n        X .*. Y is<\/pre><pre>              &lt; x(1,1)*Y  x(1,2)*Y  x(1,3)*Y\r\n                x(2,1)*Y  x(2,2)*Y  x(2,3)*Y &gt;<\/pre><pre>        The five-point discrete Laplacian for an n-by-n grid can be\r\n        generated by<\/pre><pre>              T = diag(ones(n-1,1),1);  T = T + T';  I = EYE(T);\r\n              A = T.*.I + I.*.T - 4*EYE;<\/pre><pre>        Just  in  case  they  might  be  useful,  MATLAB   includes\r\n        constructions called Kronecker tensor quotients, denoted by\r\n        X .\/. Y and X .\\. Y .  They are obtained by  replacing  the\r\n        elementwise multiplications in X .*. Y with divisions.<\/pre><pre>  LINES An internal count is kept of the number of lines of  output\r\n        since  the  last  input.   Whenever this count approaches a\r\n        limit, the  user  is  asked  whether  or  not  to  suppress\r\n        printing  until the next input.  Initially the limit is 25.\r\n        LINES(N) resets the limit to N .<\/pre><pre>  LOAD  LOAD('file') retrieves all the variables from  the  file  .\r\n        See  FILE  and  SAVE for more details.  To prepare your own\r\n        file for LOADing, change the READs to WRITEs  in  the  code\r\n        given under SAVE.<\/pre><pre>  LOG   LOG(X)  is the  natural  logarithm  of   X  .   See  FUN  .\r\n        Complex results are produced if  X  is not positive, or has\r\n        nonpositive eigenvalues.<\/pre><pre>  LONG  Determine output format.   All  computations  are  done  in\r\n        complex arithmetic and double precision if it is available.\r\n        SHORT and  LONG  merely  switch  between  different  output\r\n        formats.\r\n        SHORT    Scaled fixed point format with about 5 digits.\r\n        LONG     Scaled fixed point format with about 15 digits.\r\n        SHORT E  Floating point format with about 5 digits.\r\n        LONG E   Floating point format with about 15 digits.\r\n        LONG Z   System dependent format, often hexadecimal.<\/pre><pre>  LU    Factors from Gaussian elimination.  &lt;L,U&gt; = LU(X)  stores a\r\n        upper triangular matrix in  U  and a 'psychologically lower\r\n        triangular matrix', i.e. a product of lower triangular  and\r\n        permutation matrices, in L , so that  X = L*U .  By itself,\r\n        LU(X) returns the output from CGEFA .<\/pre><pre>  MACRO The macro facility involves text and inward pointing  angle\r\n        brackets.  If  STRING  is  the  source  text for any MATLAB\r\n        expression or statement, then\r\n              t = 'STRING';\r\n        encodes the text as a vector of integers  and  stores  that\r\n        vector in  t .  DISP(t) will print the text and\r\n              &gt;t&lt;\r\n        causes the text to be interpreted, either as a statement or\r\n        as a factor in an expression.  For example\r\n              t = '1\/(i+j-1)';\r\n              disp(t)\r\n              for i = 1:n, for j = 1:n, a(i,j) = &gt;t&lt;;\r\n        generates the Hilbert matrix of order n.\r\n        Another example showing indexed text,\r\n              S = &lt;'x = 3            '\r\n                   'y = 4            '\r\n                   'z = sqrt(x*x+y*y)'&gt;\r\n              for k = 1:3, &gt;S(k,:)&lt;\r\n        It is necessary that the strings making up  the  \"rows\"  of\r\n        the \"matrix\"  S  have the same lengths.<\/pre><pre>  MAGIC Magic square.  MAGIC(N) is an N  by  N  matrix  constructed\r\n        from  the integers 1 through N**2 with equal row and column\r\n        sums.<\/pre><pre>  NORM  For matrices..\r\n        NORM(X)  is the largest singular value of  X .\r\n        NORM(X,1)  is the 1-norm of  X .\r\n        NORM(X,2)  is the same as NORM(X) .\r\n        NORM(X,'INF')  is the infinity norm of  X .\r\n        NORM(X,'FRO')  is the F-norm, i.e.  SQRT(SUM(DIAG(X'*X))) .\r\n        For vectors..\r\n        NORM(V,P) = (SUM(V(I)**P))**(1\/P) .\r\n        NORM(V) = NORM(V,2) .\r\n        NORM(V,'INF') = MAX(ABS(V(I))) .<\/pre><pre>  ONES  All ones.  ONES(N)  is an N by N matrix of ones.  ONES(M,N)\r\n        is an M by N matrix of ones .  ONES(A)  is the same size as\r\n        A  and all ones .<\/pre><pre>  ORTH  Orthogonalization.   Q  =  ORTH(X)   is   a   matrix   with\r\n        orthonormal  columns,  i.e. Q'*Q = EYE, which span the same\r\n        space as the columns of  X .<\/pre><pre>  PINV  Pseudoinverse.  X = PINV(A) produces a matrix   X   of  the\r\n        same  dimensions as  A' so that  A*X*A = A , X*A*X = X  and\r\n        AX  and  XA  are Hermitian .  The computation is  based  on\r\n        SVD(A)  and  any  singular values less than a tolerance are\r\n        treated   as    zero.     The    default    tolerance    is\r\n        NORM(SIZE(A),'inf')*NORM(A)*EPS.   This  tolerance  may  be\r\n        overridden with X = PINV(A,tol).  See RANK.<\/pre><pre>  PLOT  PLOT(X,Y) produces a plot of  the  elements  of  Y  against\r\n        those  of X . PLOT(Y) is the same as PLOT(1:n,Y) where n is\r\n        the  number  of   elements   in   Y   .    PLOT(X,Y,P)   or\r\n        PLOT(X,Y,p1,...,pk)  passes the optional parameter vector P\r\n        or scalars p1 through pk to the plot routine.  The  default\r\n        plot  routine  is a crude printer-plot. It is hoped that an\r\n        interface to local graphics equipment can be provided.\r\n        An interesting example is\r\n              t = 0:50;\r\n              PLOT( t.*cos(t), t.*sin(t) )<\/pre><pre>  POLY  Characteristic polynomial.\r\n        If  A  is an N by N matrix, POLY(A) is a column vector with\r\n        N+1   elements   which   are   the   coefficients   of  the\r\n        characteristic polynomial,  DET(lambda*EYE - A) .\r\n        If V is a vector, POLY(V) is a vector  whose  elements  are\r\n        the  coefficients  of  the  polynomial  whose roots are the\r\n        elements of V .  For vectors, ROOTS and  POLY  are  inverse\r\n        functions  of  each  other,  up  to  ordering, scaling, and\r\n        roundoff error.\r\n        ROOTS(POLY(1:20)) generates Wilkinson's famous example.<\/pre><pre>  PRINT PRINT('file',X) prints X on  the  file  using  the  current\r\n        format determined by SHORT, LONG Z, etc.  See FILE.<\/pre><pre>  PROD  PROD(X)  is the product of all the elements of  X .<\/pre><pre>  QR    Orthogonal-triangular decomposition.\r\n        &lt;Q,R&gt; = QR(X)  produces an upper triangular  matrix   R  of\r\n        the  same dimension as  X  and a unitary matrix  Q  so that\r\n        X = Q*R .\r\n        &lt;Q,R,E&gt; = QR(X)  produces a  permutation  matrix   E  ,  an\r\n        upper  triangular  R  with decreasing diagonal elements and\r\n        a unitary  Q  so that  X*E = Q*R .\r\n        By itself, QR(X) returns the output of CQRDC .  TRIU(QR(X))\r\n        is R .<\/pre><pre>  RAND  Random numbers and matrices.  RAND(N)  is an N by N  matrix\r\n        with  random  entries.  RAND(M,N)  is an M by N matrix with\r\n        random entries.  RAND(A)  is the same size as   A  .   RAND\r\n        with no arguments is a scalar whose value changes each time\r\n        it is referenced.\r\n        Ordinarily,  random numbers are  uniformly  distributed  in\r\n        the  interval  (0.0,1.0)  .   RAND('NORMAL')  switches to a\r\n        normal distribution  with  mean  0.0  and  variance  1.0  .\r\n        RAND('UNIFORM')  switches back to the uniform distribution.\r\n        RAND('SEED') returns the current value of the seed for  the\r\n        generator.    RAND('SEED',n)   sets   the   seed   to  n  .\r\n        RAND('SEED',0) resets the seed to 0, its value when  MATLAB\r\n        is first entered.<\/pre><pre>  RANK  Rank.  K = RANK(X) is the number of singular values  of   X\r\n        that are larger than NORM(SIZE(X),'inf')*NORM(X)*EPS.\r\n        K = RANK(X,tol) is the number of singular values of  X that\r\n        are larger than tol .<\/pre><pre>  RCOND RCOND(X)   is  an  estimate  for  the  reciprocal  of   the\r\n        condition  of   X   in  the  1-norm obtained by the LINPACK\r\n        condition estimator.  If  X  is well conditioned,  RCOND(X)\r\n        is  near  1.0  .   If  X  is badly conditioned, RCOND(X) is\r\n        near 0.0 .\r\n        &lt;R, Z&gt; = RCOND(A) sets  R  to RCOND(A) and also produces  a\r\n        vector  Z so that\r\n                   NORM(A*Z,1) = R*NORM(A,1)*NORM(Z,1)\r\n        So, if RCOND(A) is small, then  Z  is an  approximate  null\r\n        vector.<\/pre><pre>  RAT   An experimental  function  which  attempts  to  remove  the\r\n        roundoff   error  from  results  that  should  be  \"simple\"\r\n        rational numbers.\r\n        RAT(X) approximates each  element  of   X  by  a  continued\r\n        fraction of the form<\/pre><pre>                  a\/b = d1 + 1\/(d2 + 1\/(d3 + ... + 1\/dk))<\/pre><pre>        with k &lt;= len, integer di and abs(di) &lt;= max .  The default\r\n        values of the parameters are len = 5 and max = 100.\r\n        RAT(len,max) changes the default values.  Increasing either\r\n        len or max increases the number of possible fractions.\r\n        &lt;A,B&gt; = RAT(X) produces integer matrices A and B so that<\/pre><pre>                  A .\/ B  =  RAT(X)<\/pre><pre>        Some examples:<\/pre><pre>              long\r\n              T = hilb(6), X = inv(T)\r\n              &lt;A,B&gt; = rat(X)\r\n              H = A .\/ B, S = inv(H)<\/pre><pre>              short e\r\n              d = 1:8,  e = ones(d),  A = abs(d'*e - e'*d)\r\n              X = inv(A)\r\n              rat(X)\r\n              display(ans)<\/pre><pre>  REAL  REAL(X)  is the real part of  X .<\/pre><pre>  RETURN  From the terminal, causes return to the operating  system\r\n        or  other  program  which  invoked  MATLAB.  From inside an\r\n        EXEC, causes  return  to  the  invoking  EXEC,  or  to  the\r\n        terminal.<\/pre><pre>  RREF  RREF(A) is the reduced row echelon form of the  rectangular\r\n        matrix.  RREF(A,B) is the same as RREF(&lt;A,B&gt;) .<\/pre><pre>  ROOTS Find polynomial roots.  ROOTS(C)  computes the roots of the\r\n        polynomial  whose  coefficients  are  the  elements  of the\r\n        vector  C .  If  C  has  N+1  components, the polynomial is\r\n        C(1)*X**N + ... + C(N)*X + C(N+1) .  See POLY.<\/pre><pre>  ROUND ROUND(X)  rounds  the  elements  of   X   to  the   nearest\r\n        integers.<\/pre><pre>  SAVE  SAVE('file') stores all the current variables in a file.\r\n        SAVE('file',X) saves only X .  See FILE .\r\n        The variables may be retrieved later by LOAD('file') or  by\r\n        your  own program using the following code for each matrix.\r\n        The lines involving XIMAG may be eliminated  if  everything\r\n        is known to be real.<\/pre><pre>              attach lunit to 'file'\r\n              REAL or DOUBLE PRECISION XREAL(MMAX,NMAX)\r\n              REAL or DOUBLE PRECISION XIMAG(MMAX,NMAX)\r\n              READ(lunit,101) ID,M,N,IMG\r\n              DO 10 J = 1, N\r\n                 READ(lunit,102) (XREAL(I,J), I=1,M)\r\n                 IF (IMG .NE. 0) READ(lunit,102) (XIMAG(I,J),I=1,M)\r\n           10 CONTINUE<\/pre><pre>        The formats used are system dependent.  The  following  are\r\n        typical.     See    SUBROUTINE   SAVLOD   in   your   local\r\n        implementation of MATLAB.<\/pre><pre>          101 FORMAT(4A1,3I4)\r\n          102 FORMAT(4Z18)\r\n          102 FORMAT(4O20)\r\n          102 FORMAT(4D25.18)<\/pre><pre>  SCHUR Schur decomposition.  &lt;U,T&gt; = SCHUR(X)  produces  an  upper\r\n        triangular  matrix   T , with the eigenvalues of  X  on the\r\n        diagonal, and a unitary matrix  U so that  X =  U*T*U'  and\r\n        U'*U = EYE .  By itself, SCHUR(X) returns  T .<\/pre><pre>  SHORT See LONG .<\/pre><pre>  SEMI  Semicolons at the end of  lines  will  cause,  rather  than\r\n        suppress,  printing.   A  second  SEMI restores the initial\r\n        interpretation.<\/pre><pre>  SIN   SIN(X)  is the sine of  X .  See FUN .\r\n  SIZE  If X is an M by N matrix, then SIZE(X) is &lt;M, N&gt; .\r\n        Can also be used with a multiple assignment,\r\n              &lt;M, N&gt; = SIZE(X) .<\/pre><pre>  SQRT  SQRT(X)  is the square root of  X .   See  FUN  .   Complex\r\n        results  are  produced  if   X   is  not  positive,  or has\r\n        nonpositive eigenvalues.<\/pre><pre>  STOP  Use EXIT instead.<\/pre><pre>  SUM   SUM(X)   is  the  sum  of  all  the  elements   of    X   .\r\n        SUM(DIAG(X))  is the trace of  X .<\/pre><pre>  SVD   Singular value decomposition.  &lt;U,S,V&gt; = SVD(X)  produces a\r\n        diagonal  matrix  S , of the same dimension as  X  and with\r\n        nonnegative diagonal  elements  in  decreasing  order,  and\r\n        unitary matrices  U  and  V  so that  X = U*S*V' .\r\n        By itself, SVD(X) returns a vector containing the  singular\r\n        values.\r\n        &lt;U,S,V&gt;   =   SVD(X,0)   produces   the   \"economy    size\"\r\n        decomposition.   If  X  is m by n with m &gt; n, then only the\r\n        first n columns of U are computed and S is n by n .<\/pre><pre>  TRIL  Lower triangle.  TRIL(X) is the lower triangular part of X.\r\n        TRIL(X,K) is the elements on and below the K-th diagonal of\r\n        X.  K = 0 is the main diagonal, K &gt; 0  is  above  the  main\r\n        diagonal and K &lt; 0 is below the main diagonal.<\/pre><pre>  TRIU  Upper triangle.  TRIU(X) is the upper triangular part of X.\r\n        TRIU(X,K) is the elements on and above the K-th diagonal of\r\n        X.  K = 0 is the main diagonal, K &gt; 0  is  above  the  main\r\n        diagonal and K &lt; 0 is below the main diagonal.<\/pre><pre>  USER  Allows personal  Fortran  subroutines  to  be  linked  into\r\n        MATLAB .  The subroutine should have the heading<\/pre><pre>                 SUBROUTINE USER(A,M,N,S,T)\r\n                 REAL or DOUBLE PRECISION A(M,N),S,T<\/pre><pre>        The MATLAB statement  Y = USER(X,s,t)  results in a call to\r\n        the  subroutine with a copy of the matrix  X  stored in the\r\n        argument  A , its column and row dimensions in  M  and  N ,\r\n        and  the scalar parameters  s  and  t  stored in  S  and  T\r\n        . If  s and t  are omitted, they are set to  0.0  .   After\r\n        the  return,   A  is stored in  Y .  The dimensions  M  and\r\n        N  may be reset within the subroutine.  The statement  Y  =\r\n        USER(K)  results in a call with M = 1, N = 1  and  A(1,1) =\r\n        FLOAT(K) .  After the subroutine has been written, it  must\r\n        be compiled and linked to the MATLAB object code within the\r\n        local operating system.<\/pre><pre>  WHAT  Lists commands and functions currently available.<\/pre><pre>  WHILE Repeat statements an indefinite number of times.\r\n        WHILE expr rop expr, statement, ..., statement, END\r\n        where rop is =, &lt;, &gt;, &lt;=, &gt;=, or &lt;&gt; (not equal) .  The  END\r\n        at  the end of a line may be omitted.  The comma before the\r\n        END may also be omitted.  The commas  may  be  replaced  by\r\n        semicolons   to   avoid   printing.    The  statements  are\r\n        repeatedly executed as long  as  the  indicated  comparison\r\n        between  the  real parts of the first components of the two\r\n        expressions is true.   Example  (assume  a  matrix   A   is\r\n        already defined).\r\n        E = 0*A; F = E + EYE; N = 1;\r\n        WHILE NORM(E+F-E,1) &gt; 0, E = E + F; F = A*F\/N; N = N + 1;\r\n        E<\/pre><pre>  WHO   Lists current variables.<\/pre><pre>  WHY   Provides succinct answers to any questions.<\/pre><pre>  \/\/<\/pre><script language=\"JavaScript\"> <!-- \r\n    function grabCode_eca491f76e4243cdbdeb2ef47ed6b124() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='eca491f76e4243cdbdeb2ef47ed6b124 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' eca491f76e4243cdbdeb2ef47ed6b124';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2018 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_eca491f76e4243cdbdeb2ef47ed6b124()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2018a<br><\/p><\/div><!--\r\neca491f76e4243cdbdeb2ef47ed6b124 ##### SOURCE BEGIN #####\r\n%% The First MATLAB Users' Guide\r\n% In the 1970s and early 1980s, while I was working on the\r\n% <https:\/\/blogs.mathworks.com\/cleve\/2018\/01\/23\/linpack-linear-equation-package\r\n% LINPACK> and \r\n% <https:\/\/blogs.mathworks.com\/cleve\/2018\/01\/02\/eispack-matrix-eigensystem-routines\r\n% EISPACK> projects that I discussed in two previous posts, I was a\r\n% Professor of Mathematics and then of Computer Science at the  \r\n% University of New Mexico in Albuquerque.\r\n% I was teaching courses in Linear Algebra and Numerical Analysis.\r\n% I wanted my students to have easy access to LINPACK and EISPACK\r\n% without writing  Fortran programs.  By \"easy access\" I meant not \r\n% going through the remote batch processing and the repeated\r\n% edit-compile-link-load-execute process that was ordinarily required\r\n% on the campus central mainframe computer.\r\n%\r\n% So, I studied Niklaus Wirth's book _Algorithms + Data Structures =\r\n% Programs_ and learned how to parse programming languages.  Wirth\r\n% calls his example language PL\/0.  (A _zinger_ aimed at PL\/I, the\r\n% monolithic, committee-designed language being promoted by IBM and\r\n% the U.S. Defense Department at the time.)  PL\/0 was a pedagogical \r\n% subset of Wirth's Pascal, which, in turn, was his response to Algol.\r\n% Quoting Wirth, \"In the realm of data types, however, PL\/0 adheres to \r\n% the demand of simplicity without compromise: integers are its only\r\n% data type.\"\r\n%\r\n% Following Wirth's approach, I wrote the first MATLAB REPLACE_WITH_DASH_DASH\r\n% an acronym for Matrix Laboratory REPLACE_WITH_DASH_DASH in Fortran, as a dialect of PL\/0\r\n% with matrix as the only data type.  The project was a kind of hobby,\r\n% a new aspect of programming for me to learn and something for my\r\n% students to use.  There was never any formal outside support and\r\n% certainly no business plan.  MathWorks was a few years in the future.\r\n%\r\n% This first MATLAB was not a programming language; it was just a simple\r\n% interactive matrix calculator.  There were no\r\n% m-files, no toolboxes, no graphics.  And no ODEs or FFTs.\r\n% This snapshot of the start-up screen shows all the reserved words\r\n% and functions. There are only 71 of them.  If you wanted to add another\r\n% function, you would get the source code from me, write a Fortran\r\n% subroutine, add your new name to the parse table, and recompile MATLAB.\r\n%\r\n% <<what.png>>\r\n%\r\n% Here is the first Users' Guide, in its entirety, from 1981.\r\n\r\n%% Users' Guide    \r\n%                           MATLAB Users' Guide\r\n%                                May, 1981\r\n%    \r\n%    \r\n%                               Cleve Moler\r\n%                     Department of Computer Science\r\n%                        University of New Mexico\r\n%    \r\n%    \r\n%         ABSTRACT.  MATLAB is an  interactive  computer  program\r\n%         that   serves   as   a   convenient   \"laboratory\"  for\r\n%         computations  involving  matrices.   It  provides  easy\r\n%         access  to matrix software developed by the LINPACK and\r\n%         EISPACK projects.  The program is  written  in  Fortran\r\n%         and  is  designed  to  be  readily  installed under any\r\n%         operating system which permits interactive execution of\r\n%         Fortran programs.\r\n%    \r\n%    \r\n%         MATLAB is an interactive computer program that serves  as  a\r\n%    convenient  \"laboratory\" for computations involving matrices.  It\r\n%    provides easy access to matrix software developed by the  LINPACK\r\n%    and EISPACK projects [1-3].  The capabilities range from standard\r\n%    tasks such as solving simultaneous linear equations and inverting\r\n%    matrices, through symmetric and nonsymmetric eigenvalue problems,\r\n%    to fairly sophisticated matrix tools such as the  singular  value\r\n%    decomposition.\r\n%    \r\n%         It is expected that one of MATLAB's primary uses will be  in\r\n%    the  classroom.   It  should be useful in introductory courses in\r\n%    applied linear algebra, as  well  as  more  advanced  courses  in\r\n%    numerical analysis, matrix theory, statistics and applications of\r\n%    matrices to other disciplines.  In nonacademic  settings,  MATLAB\r\n%    can  serve as a \"desk calculator\" for the quick solution of small\r\n%    problems involving matrices.\r\n%    \r\n%         The program is written in Fortran  and  is  designed  to  be\r\n%    readily  installed  under  any  operating  system  which  permits\r\n%    interactive  execution  of  Fortran  programs.    The   resources\r\n%    required  are  fairly  modest.  There are less than 7000 lines of\r\n%    Fortran  source  code,  including   the   LINPACK   and   EISPACK\r\n%    subroutines  used.   With  proper use of overlays, it is possible\r\n%    run the system on a minicomputer with only 32K bytes of memory.\r\n%    \r\n%         The size of the matrices  that  can  be  handled  in  MATLAB\r\n%    depends  upon  the  amount  of storage that is set aside when the\r\n%    system is compiled on a particular machine.  We have  found  that\r\n%    an  allocation of 5000 words for matrix elements is usually quite\r\n%    satisfactory.  This provides room for several 20 by 20  matrices,\r\n%    for  example.   One  implementation  on  a  virtual memory system\r\n%    provides 100,000 elements.  Since most  of  the  algorithms  used\r\n%    access  memory  in  a  sequential  fashion,  the  large amount of\r\n%    allocated storage causes no difficulties.\r\n%    \r\n%         In some ways, MATLAB  resembles  SPEAKEASY  [4]  and,  to  a\r\n%    lesser  extent, APL.  All are interactive terminal languages that\r\n%    ordinarily accept single-line  commands  or  statements,  process\r\n%    them  immediately,  and  print  the  results.  All have arrays or\r\n%    matrices as principal data types.  But for MATLAB, the matrix  is\r\n%    the  only  data  type  (although  scalars,  vectors  and text are\r\n%    special cases), the underlying system is  portable  and  requires\r\n%    fewer resources, and the supporting subroutines are more powerful\r\n%    and, in some cases, have better numerical properties.\r\n%    \r\n%         Together, LINPACK and EISPACK represent the state of the art\r\n%    in software for matrix computation.  EISPACK is a package of over\r\n%    70 Fortran subroutines for various matrix eigenvalue computations\r\n%    that are based for the most part on Algol procedures published by\r\n%    Wilkinson, Reinsch  and  their  colleagues  [5].   LINPACK  is  a\r\n%    package  of  40  Fortran subroutines (in each of four data types)\r\n%    for solving  and  analyzing  simultaneous  linear  equations  and\r\n%    related matrix problems.  Since MATLAB is not primarily concerned\r\n%    with either execution time  efficiency  or  storage  savings,  it\r\n%    ignores  most  of  the special matrix properties that LINPACK and\r\n%    EISPACK subroutines  use  to  advantage.   Consequently,  only  8\r\n%    subroutines   from  LINPACK  and  5  from  EISPACK  are  actually\r\n%    involved.\r\n%    \r\n%         In  more  advanced  applications,  MATLAB  can  be  used  in\r\n%    conjunction  with other programs in several ways.  It is possible\r\n%    to define new MATLAB functions and add them to the system.   With\r\n%    most  operating  systems,  it  is  possible to use the local file\r\n%    system to  pass  matrices  between  MATLAB  and  other  programs.\r\n%    MATLAB  command  and statement input can be obtained from a local\r\n%    file  instead  of  from  the  terminal.   The  most   power   and\r\n%    flexibility  is obtained by using MATLAB as a subroutine which is\r\n%    called by other programs.\r\n%    \r\n%         This document first gives an overview  of  MATLAB  from  the\r\n%    user's  point  of  view. Several extended examples involving data\r\n%    fitting, partial differential equations,  eigenvalue  sensitivity\r\n%    and other topics are included.  A formal definition of the MATLAB\r\n%    language and an brief description of the parser  and  interpreter\r\n%    are   given.   The  system  was  designed  and  programmed  using\r\n%    techniques described by Wirth [6], implemented  in  nonrecursive,\r\n%    portable  Fortran.   There  is  a brief discussion of some of the\r\n%    matrix algorithms and of their numerical properties.   The  final\r\n%    section  describes  how  MATLAB  can be used with other programs.\r\n%    The appendix includes the HELP documentation available on-line.\r\n   \r\n   \r\n%% 1.  Elementary operations\r\n%    \r\n%    \r\n%         MATLAB works with essentially only one  kind  of  object,  a\r\n%    rectangular matrix with complex elements.  If the imaginary parts\r\n%    of the elements are all zero, they  are  not  printed,  but  they\r\n%    still  occupy  storage.   In  some situations, special meaning is\r\n%    attached to 1 by 1 matrices, that is scalars, and to 1 by n and m\r\n%    by 1 matrices, that is row and column vectors.\r\n%    \r\n%         Matrices can be introduced into  MATLAB  in  four  different\r\n%    ways:\r\n%            REPLACE_WITH_DASH_DASH  Explicit list of elements,\r\n%            REPLACE_WITH_DASH_DASH  Use of FOR and WHILE statements,\r\n%            REPLACE_WITH_DASH_DASH  Read from an external file,\r\n%            REPLACE_WITH_DASH_DASH  Execute an external Fortran program.\r\n%    \r\n%         The explicit list is surrounded by angle brackets,  '<'  and\r\n%    '>', and uses the semicolon ';' to indicate the ends of the rows.\r\n%    For example, the input line\r\n%    \r\n%       A = <1 2 3; 4 5 6; 7 8 9>\r\n%    \r\n%    will result in the output\r\n%    \r\n%       A     =\r\n%    \r\n%           1.    2.   3.\r\n%           4.    5.   6.\r\n%           7.    8.   9.\r\n%    \r\n%    The matrix A  will  be  saved  for  later  use.   The  individual\r\n%    elements  are separated by commas or blanks and can be any MATLAB\r\n%    expressions, for example\r\n%    \r\n%       x = < -1.3, 4\/5, 4*atan(1) >\r\n%    \r\n%    results in\r\n%    \r\n%       X     =\r\n%    \r\n%         -1.3000   0.8000   3.1416\r\n%    \r\n%    The elementary functions available include sqrt, log,  exp,  sin,\r\n%    cos, atan, abs, round, real, imag, and conjg.\r\n%    \r\n%         Large matrices can be spread  across  several  input  lines,\r\n%    with  the  carriage  returns replacing the semicolons.  The above\r\n%    matrix could also have been produced by\r\n%    \r\n%       A = < 1 2 3\r\n%             4 5 6\r\n%             7 8 9 >\r\n%    \r\n%    \r\n%         Matrices can be input from the local  file  system.   Say  a\r\n%    file named 'xyz' contains five lines of text,\r\n%    \r\n%    \r\n%       A = <\r\n%       1 2 3\r\n%       4 5 6\r\n%       7 8 9\r\n%       >;\r\n%    \r\n%    then the  MATLAB  statement  EXEC('xyz')  reads  the  matrix  and\r\n%    assigns it to A .\r\n%    \r\n%         The FOR statement allows the generation  of  matrices  whose\r\n%    elements  are  given  by  simple formulas.  Our example matrix  A\r\n%    could also have been produced by\r\n%    \r\n%       for i = 1:3, for j = 1:3, a(i,j) = 3*(i-1)+j;\r\n%    \r\n%    The semicolon at the end of the  line  suppresses  the  printing,\r\n%    which  in  this  case  would  have  been  nine versions of A with\r\n%    changing elements.\r\n%    \r\n%         Several statements may be given  on  a  line,  separated  by\r\n%    semicolons or commas.\r\n%    \r\n%         Two  consecutive  periods  anywhere  on  a   line   indicate\r\n%    continuation.   The  periods  and  any  following  characters are\r\n%    deleted, then another line is input  and  concatenated  onto  the\r\n%    previous line.\r\n%    \r\n%         Two  consecutive  slashes  anywhere  on  a  line  cause  the\r\n%    remainder  of  the  line  to  be  ignored.   This  is  useful for\r\n%    inserting comments.\r\n%    \r\n%         Names of variables are formed by a letter, followed  by  any\r\n%    number of letters and digits, but only the first 4 characters are\r\n%    remembered.\r\n%    \r\n%         The special character  prime  (')  is  used  to  denote  the\r\n%    transpose of a matrix, so\r\n%    \r\n%       x = x'\r\n%    \r\n%    changes the row vector above into the column vector\r\n%    \r\n%       X     =\r\n%    \r\n%         -1.3000\r\n%          0.8000\r\n%          3.1416\r\n%    \r\n%    \r\n%         Individual matrix elements may be  referenced  by  enclosing\r\n%    their  subscripts  in  parentheses.  When any element is changed,\r\n%    the entire matrix is reprinted.  For  example,  using  the  above\r\n%    matrix,\r\n%       a(3,3) = a(1,3) + a(3,1)\r\n%    \r\n%    results in\r\n%    \r\n%       A     =\r\n%    \r\n%           1.    2.    3.\r\n%           4.    5.    6.\r\n%           7.    8.   10.\r\n%    \r\n%    \r\n%         Addition, subtraction and  multiplication  of  matrices  are\r\n%    denoted  by  +, -, and * .  The operations are performed whenever\r\n%    the matrices have the proper dimensions.  For example,  with  the\r\n%    above  A  and  x,  the  expressions  A  + x and x*A are incorrect\r\n%    because A is 3 by 3 and x is now 3 by 1.  However,\r\n%    \r\n%       b = A*x\r\n%    \r\n%    is correct and results in the output\r\n%    \r\n%       B     =\r\n%    \r\n%          9.7248\r\n%         17.6496\r\n%         28.7159\r\n%    \r\n%    Note that both upper and lower case letters are allowed for input\r\n%    (on  those  systems  which  have  both),  but  that lower case is\r\n%    converted to upper case.\r\n%    \r\n%         There are two \"matrix division\" symbols in MATLAB, \\ and \/ .\r\n%    (If  your  terminal  does not have a backslash, use $ instead, or\r\n%    see CHAR.) If A and B are matrices, then A\\B and  B\/A  correspond\r\n%    formally  to left and right multiplication of B by the inverse of\r\n%    A , that is inv(A)*B and B*inv(A), but  the  result  is  obtained\r\n%    directly  without  the computation of the inverse.  In the scalar\r\n%    case, 3\\1 and 1\/3 have the  same  value,  namely  one-third.   In\r\n%    general,  A\\B  denotes the solution X to the equation A*X = B and\r\n%    B\/A denotes the solution to X*A = B.\r\n%    \r\n%         Left division, A\\B, is defined whenever B has as  many  rows\r\n%    as   A  .   If  A  is  square,  it  is  factored  using  Gaussian\r\n%    elimination.   The  factors  are  used  to  solve  the  equations\r\n%    A*X(:,j) = B(:,j) where B(:,j) denotes the j-th column of B.  The\r\n%    result is a matrix X with the same dimensions  as  B.   If  A  is\r\n%    nearly  singular  (according  to the LINPACK condition estimator,\r\n%    RCOND), a warning message is printed.  If A is not square, it  is\r\n%    factored   using   Householder   orthogonalization   with  column\r\n%    pivoting.   The  factors  are  used  to  solve  the   under-   or\r\n%    overdetermined equations in a least squares sense.  The result is\r\n%    an m by n matrix X where m is the number of columns of A and n is\r\n%    the  number  of  columns  of  B .  Each column of X has at most k\r\n%    nonzero components, where k is the effective rank of A .\r\n%    \r\n%         Right division,  B\/A,  can  be  defined  in  terms  of  left\r\n%    division by  B\/A = (A'\\B')'.\r\n%    \r\n%         For example, since our vector  b   was computed as  A*x, the\r\n%    statement\r\n%    \r\n%       y = A\\b\r\n%    \r\n%    results in\r\n%    \r\n%       Y     =\r\n%    \r\n%         -1.3000\r\n%          0.8000\r\n%          3.1416\r\n%    \r\n%    Of course,  y  is  not  exactly  equal  to   x   because  of  the\r\n%    roundoff  errors involved in both  A*x  and  A\\b , but we are not\r\n%    printing enough digits to see the difference.  The result of  the\r\n%    statement\r\n%    \r\n%       e = x - y\r\n%    \r\n%    depends upon the particular computer being used.  In one case  it\r\n%    produces\r\n%    \r\n%       E     =\r\n%    \r\n%          1.0e-15 *\r\n%    \r\n%            .3053\r\n%           -.2498\r\n%            .0000\r\n%    \r\n%    The quantity 1.0e-15 is a scale factor which multiplies  all  the\r\n%    components  which  follow.  Thus our vectors  x  and  y  actually\r\n%    agree to about 15 decimal places on this computer.\r\n%    \r\n%         It   is   also   possible   to   obtain   element-by-element\r\n%    multiplicative  operations.  If A and B have the same dimensions,\r\n%    then A .* B denotes the matrix  whose  elements  are  simply  the\r\n%    products  of the individual elements of A and B . The expressions\r\n%    A .\/ B and A .\\ B give the quotients of the individual elements.\r\n%    \r\n%         There are several possible output formats.  The statement\r\n%    \r\n%       long, x\r\n%    \r\n%    results in\r\n%    \r\n%       X     =\r\n%          -1.300000000000000\r\n%            .800000000000000\r\n%           3.141592653589793\r\n%    \r\n%    The statement\r\n%    \r\n%       short\r\n%    \r\n%    restores the original format.\r\n%    \r\n%         The expression A**p means  A  to  the  p-th  power.   It  is\r\n%    defined  if  A  is a square matrix and p is a scalar.  If p is an\r\n%    integer greater than one,  the  power  is  computed  by  repeated\r\n%    multiplication.   For  other values of p the calculation involves\r\n%    the eigenvalues and eigenvectors of A.\r\n%    \r\n%         Previously defined matrices and matrix  expressions  can  be\r\n%    used inside brackets to generate larger matrices, for example\r\n%    \r\n%       C = <A, b; <4 2 0>*x, x'>\r\n%    \r\n%    results in\r\n%    \r\n%    \r\n%       C     =\r\n%    \r\n%          1.0000   2.0000   3.0000   9.7248\r\n%          4.0000   5.0000   6.0000  17.6496\r\n%          7.0000   8.0000  10.0000  28.7159\r\n%         -3.6000  -1.3000   0.8000   3.1416\r\n%    \r\n%    \r\n%         There are four predefined variables,  EPS,  FLOP,  RAND  and\r\n%    EYE.  The variable EPS is used as a tolerance is determining such\r\n%    things as near singularity and rank.  Its initial  value  is  the\r\n%    distance  from  1.0  to the next largest floating point number on\r\n%    the particular computer being used.  The user may reset  this  to\r\n%    any other value, including zero. EPS is changed by CHOP, which is\r\n%    described in section 12.\r\n%    \r\n%         The value of RAND is a random variable, with a choice  of  a\r\n%    uniform or a normal distribution.\r\n%    \r\n%         The name EYE is used  in  place  of  I  to  denote  identity\r\n%    matrices  because  I is often used as a subscript or as sqrt(-1).\r\n%    The dimensions of EYE are determined by context.  For example,\r\n%    \r\n%       B = A + 3*EYE\r\n%    \r\n%    adds 3 to the diagonal elements of A and\r\n%    \r\n%       X = EYE\/A\r\n%    \r\n%    is one of several ways in MATLAB to invert a matrix.\r\n%    \r\n%         FLOP provides a  count  of  the  number  of  floating  point\r\n%    operations, or \"flops\", required for each calculation.\r\n%    \r\n%         A statement may consist of an  expression  alone,  in  which\r\n%    case a variable named ANS is created and the result stored in ANS\r\n%    for possible future use.  Thus\r\n%    \r\n%       A\\A - EYE\r\n%    \r\n%    is the same as\r\n%    \r\n%       ANS = A\\A - EYE\r\n%    \r\n%    (Roundoff error usually causes this result  to  be  a  matrix  of\r\n%    \"small\" numbers, rather than all zeros.)\r\n%    \r\n%         All computations are done  using  either  single  or  double\r\n%    precision  real  arithmetic,  whichever  is  appropriate  for the\r\n%    particular computer.  There  is  no  mixed-precision  arithmetic.\r\n%    The  Fortran  COMPLEX  data type is not used because many systems\r\n%    create  unnecessary  underflows  and   overflows   with   complex\r\n%    operations and because some systems do not allow double precision\r\n%    complex arithmetic.\r\n    \r\n    \r\n%% 2.  MATLAB functions\r\n%    \r\n%         Much of MATLAB's computational power comes from the  various\r\n%    matrix functions available.  The current list includes:\r\n%    \r\n%       INV(A)          - Inverse.\r\n%       DET(A)          - Determinant.\r\n%       COND(A)         - Condition number.\r\n%       RCOND(A)        - A measure of nearness to singularity.\r\n%       EIG(A)          - Eigenvalues and eigenvectors.\r\n%       SCHUR(A)        - Schur triangular form.\r\n%       HESS(A)         - Hessenberg or tridiagonal form.\r\n%       POLY(A)         - Characteristic polynomial.\r\n%       SVD(A)          - Singular value decomposition.\r\n%       PINV(A,eps)     - Pseudoinverse with optional tolerance.\r\n%       RANK(A,eps)     - Matrix rank with optional tolerance.\r\n%       LU(A)           - Factors from Gaussian elimination.\r\n%       CHOL(A)         - Factor from Cholesky factorization.\r\n%       QR(A)           - Factors from Householder orthogonalization.\r\n%       RREF(A)         - Reduced row echelon form.\r\n%       ORTH(A)         - Orthogonal vectors spanning range of A.\r\n%       EXP(A)          - e to the A.\r\n%       LOG(A)          - Natural logarithm.\r\n%       SQRT(A)         - Square root.\r\n%       SIN(A)          - Trigonometric sine.\r\n%       COS(A)          - Cosine.\r\n%       ATAN(A)         - Arctangent.\r\n%       ROUND(A)        - Round the elements to nearest integers.\r\n%       ABS(A)          - Absolute value of the elements.\r\n%       REAL(A)         - Real parts of the elements.\r\n%       IMAG(A)         - Imaginary parts of the elements.\r\n%       CONJG(A)        - Complex conjugate.\r\n%       SUM(A)          - Sum of the elements.\r\n%       PROD(A)         - Product of the elements.\r\n%       DIAG(A)         - Extract or create diagonal matrices.\r\n%       TRIL(A)         - Lower triangular part of A.\r\n%       TRIU(A)         - Upper triangular part of A.\r\n%       NORM(A,p)       - Norm with p = 1, 2 or 'Infinity'.\r\n%       EYE(m,n)        - Portion of identity matrix.\r\n%       RAND(m,n)       - Matrix with random elements.\r\n%       ONES(m,n)       - Matrix of all ones.\r\n%       MAGIC(n)        - Interesting test matrices.\r\n%       HILBERT(n)      - Inverse Hilbert matrices.\r\n%       ROOTS(C)        - Roots of polynomial with coefficients C.\r\n%       DISPLAY(A,p)    - Print base p representation of A.\r\n%       KRON(A,B)       - Kronecker tensor product of A and B.\r\n%       PLOT(X,Y)       - Plot Y as a function of X .\r\n%       RAT(A)          - Find \"simple\" rational approximation to A.\r\n%       USER(A)         - Function defined by external program.\r\n%    \r\n%         Some of these functions have different interpretations  when\r\n%    the  argument  is  a  matrix  or  a  vector and some of them have\r\n%    additional optional arguments.  Details are  given  in  the  HELP\r\n%    document in the appendix.\r\n%    \r\n%         Several of these functions can  be  used  in  a  generalized\r\n%    assignment statement with two or three variables on the left hand\r\n%    side.  For example\r\n%    \r\n%       <X,D> = EIG(A)\r\n%    \r\n%    stores the eigenvectors of A in  the  matrix  X  and  a  diagonal\r\n%    matrix containing the eigenvalues in the matrix D.  The statement\r\n%    \r\n%       EIG(A)\r\n%    \r\n%    simply computes the eigenvalues and stores them in ANS.\r\n%    \r\n%         Future versions of MATLAB will probably  include  additional\r\n%    functions, since they can easily be added to the system.\r\n%    \r\n  \r\n    \r\n%% 3.  Rows, columns and submatrices\r\n%    \r\n%    \r\n%         Individual elements of a matrix can be  accessed  by  giving\r\n%    their subscripts in parentheses, eg. A(1,2), x(i), TAB(ind(k)+1).\r\n%    An expression used as a  subscript  is  rounded  to  the  nearest\r\n%    integer.\r\n%    \r\n%         Individual rows and columns can be accessed  using  a  colon\r\n%    ':' (or a '|') for the free subscript. For example, A(1,:) is the\r\n%    first row of A and A(:,j) is the j-th column.  Thus\r\n%    \r\n%       A(i,:) = A(i,:) + c*A(k,:)\r\n%    \r\n%    adds c times the k-th row of A to the i-th row.\r\n%    \r\n%         The colon is used in several other ways in MATLAB,  but  all\r\n%    of the uses are based on the following definition.\r\n%    \r\n%       j:k    is the same as  <j, j+1, ..., k>\r\n%       j:k    is empty if  j > k .\r\n%       j:i:k  is the same as  <j, j+i, j+2i, ..., k>\r\n%       j:i:k  is empty if  i > 0 and j > k or if i < 0 and j < k .\r\n%    \r\n%    The colon is usually used with integers, but it  is  possible  to\r\n%    use arbitrary real scalars as well.  Thus\r\n%    \r\n%       1:4  is the same as  <1, 2, 3, 4>\r\n%       0: 0.1: 0.5 is the same as <0.0, 0.1, 0.2, 0.3, 0.4, 0.5>\r\n%    \r\n%    \r\n%         In general, a subscript can be a vector.  If  X  and  V  are\r\n%    vectors, then X(V) is <X(V(1)), X(V(2)), ..., X(V(n))> . This can\r\n%    also be used with matrices.  If V has m components and  W  has  n\r\n%    components,  then  A(V,W)  is  the  m by n matrix formed from the\r\n%    elements of A whose subscripts are  the  elements  of  V  and  W.\r\n%    Combinations  of the colon notation and the indirect subscripting\r\n%    allow manipulation of various submatrices. For example,\r\n%    \r\n%       A(<1,5>,:) = A(<5,1>,:)  interchanges rows 1 and 5 of A.\r\n%       A(2:k,1:n)  is the submatrix formed from rows 2 through k\r\n%          and columns 1 through n of A .\r\n%       A(:,<3 1 2>)  is a permutation of the first three columns.\r\n%    \r\n%    \r\n%         The notation A(:) has a special meaning.  On the right  hand\r\n%    side  of  an assignment statement, it denotes all the elements of\r\n%    A, regarded as a single column.  When an expression  is  assigned\r\n%    to  A(:),  the  current  dimensions  of  A,  rather  than  of the\r\n%    expression, are used.\r\n    \r\n\r\n%% 4.  FOR, WHILE and IF\r\n%    \r\n%    \r\n%         The FOR clause allows statements to be repeated  a  specific\r\n%    number of times.  The general form is\r\n%    \r\n%       FOR variable = expr,  statement, ..., statement, END\r\n%\r\n%    The END and the comma before it may be omitted.  In general,  the\r\n%    expression  may be a matrix, in which case the columns are stored\r\n%    one at a time in the variable and the following statements, up to\r\n%    the  END or the end of the line, are executed.  The expression is\r\n%    often of the form j:k, and its \"columns\" are simply  the  scalars\r\n%    from j to k.  Some examples (assume n has already been assigned a\r\n%    value):\r\n%    \r\n%       for i = 1:n, for j = 1:n, A(i,j) = 1\/(i+j-1);\r\n%    \r\n%    generates the Hilbert matrix.\r\n%    \r\n%       for j = 2:n-1, for i = j:n-1, ...\r\n%          A(i,j) = 0; end; A(j,j) = j; end; A\r\n%    \r\n%    changes all but the \"outer edge\" of the lower triangle  and  then\r\n%    prints the final matrix.\r\n%    \r\n%       for h = 1.0: -0.1: -1.0, (<h, cos(pi*h)>)\r\n%    \r\n%    prints a table of cosines.\r\n%    \r\n%       <X,D> = EIG(A); for v = X, v, A*v\r\n%    \r\n%    displays eigenvectors, one at a time.\r\n%    \r\n%         The  WHILE  clause  allows  statements  to  be  repeated  an\r\n%    indefinite number of times.  The general form is\r\n%    \r\n%       WHILE expr relop expr,   statement,..., statement, END\r\n%    \r\n%    where relop is =, <,  >,  <=,  >=,  or  <>  (not  equal)  .   The\r\n%    statements  are  repeatedly  executed  as  long  as the indicated\r\n%    comparison between the real parts of the first components of  the\r\n%    two  expressions  is true.  Here are two examples.  (Exercise for\r\n%    the reader: What do these segments do?)\r\n%    \r\n%       eps = 1;\r\n%       while 1 + eps > 1, eps = eps\/2;\r\n%       eps = 2*eps\r\n%    \r\n%       E = 0*A;  F = E + EYE; n = 1;\r\n%       while NORM(E+F-E,1) > 0, E = E + F; F = A*F\/n; n = n + 1;\r\n%       E\r\n%    \r\n%    \r\n%         The IF clause allows conditional  execution  of  statements.\r\n%    The general form is\r\n%    \r\n%       IF expr relop expr,   statement, ..., statement,\r\n%          ELSE statement, ..., statement\r\n%    \r\n%    The first group of statements are executed  if  the  relation  is\r\n%    true  and the second group are executed if the relation is false.\r\n%    The ELSE and the statements following it  may  be  omitted.   For\r\n%    example,\r\n%    \r\n%       if abs(i-j) = 2, A(i,j) = 0;\r\n   \r\n    \r\n%% 5.  Commands, text, files and macros.\r\n%    \r\n%    \r\n%         MATLAB has several commands which control the output  format\r\n%    and the overall execution of the system.\r\n%    \r\n%         The HELP command allows on-line access to short portions  of\r\n%    text   describing   various  operations,  functions  and  special\r\n%    characters.   The  entire  HELP  document  is  reproduced  in  an\r\n%    appendix.\r\n%    \r\n%         Results are usually printed in a scaled fixed  point  format\r\n%    that shows 4 or 5 significant figures.  The commands SHORT, LONG,\r\n%    SHORT E, LONG E and LONG Z alter the output format,  but  do  not\r\n%    alter the precision of the computations or the internal storage.\r\n%    \r\n%         The WHO, WHAT and WHY commands provide information about the\r\n%    functions and variables that are currently defined.\r\n%    \r\n%         The CLEAR command erases all variables,  except  EPS,  FLOP,\r\n%    RAND  and  EYE.  The  statement  A = <> indicates that a \"0 by 0\"\r\n%    matrix is to be stored in A.  This causes A to be erased so  that\r\n%    its storage can be used for other variables.\r\n%    \r\n%         The RETURN and EXIT commands cause return to the  underlying\r\n%    operating system through the Fortran RETURN statement.\r\n%    \r\n%         MATLAB has a limited facility for handling text.  Any string\r\n%    of characters delineated by quotes (with two quotes used to allow\r\n%    one quote within the string) is saved  as  a  vector  of  integer\r\n%    values  with '1' = 1, 'A' = 10, ' ' = 36, etc. (The complete list\r\n%    is in the appendix under CHAR.) For example\r\n%    \r\n%       '2*A + 3'  is the same as  <2 43 10 36 41 36 3>\r\n%    \r\n%    It is possible,  though  seldom  very  meaningful,  to  use  such\r\n%    strings  in matrix operations.  More frequently, the text is used\r\n%    as a special argument to various functions.\r\n%    \r\n%       NORM(A,'inf')    computes the infinity norm of A .\r\n%       DISPLAY(T)       prints the text stored in T .\r\n%       EXEC('file')     obtains MATLAB input from an external file.\r\n%       SAVE('file')     stores all the current variables in a file.\r\n%       LOAD('file')     retrieves all the variables from a file.\r\n%       PRINT('file',X)  prints X on a file.\r\n%       DIARY('file')    makes a copy of the complete MATLAB session.\r\n%    \r\n%         The text can also be used in a limited  string  substitution\r\n%    macro  facility.   If a variable, say T, contains the source text\r\n%    for a MATLAB statement or expression, then the construction\r\n%    \r\n%       > T <\r\n%    \r\n%    causes T to be executed or evaluated.  For example\r\n%    \r\n%       T = '2*A + 3';\r\n%       S = 'B = >T< + 5'\r\n%       A = 4;\r\n%       > S <\r\n%    \r\n%    produces\r\n%    \r\n%       B     =\r\n%    \r\n%          16.\r\n%    \r\n%    Some other examples are given under MACRO in the appendix.   This\r\n%    facility  is  useful for fairly short statements and expressions.\r\n%    More complicated MATLAB \"programs\" should use the EXEC facility.\r\n%    \r\n%         The operations which access external files cannot be handled\r\n%    in  a  completely  machine-independent manner by portable Fortran\r\n%    code.  It  is  necessary  for  each  particular  installation  to\r\n%    provide  a  subroutine  which associates external text files with\r\n%    Fortran logical unit numbers.\r\n    \r\n    \r\n%% 6.  Census example\r\n%    \r\n%    \r\n%         Our  first  extended   example   involves   predicting   the\r\n%    population  of  the  United States in 1980 using extrapolation of\r\n%    various fits to the census data from 1900  through  1970.   There\r\n%    are eight observations, so we begin with the MATLAB statement\r\n%    \r\n%       n = 8\r\n%    \r\n%    The values of the dependent variable, the population in millions,\r\n%    can be entered with\r\n%    \r\n%       y = < 75.995   91.972  105.711  123.203   ...\r\n%            131.669  150.697  179.323  203.212>'\r\n%    \r\n%    In order to produce a reasonably scaled matrix,  the  independent\r\n%    variable,  time,  is transformed from the interval [1900,1970] to\r\n%    [-1.00,0.75].  This can be accomplished directly with\r\n%    \r\n%       t = -1.0:0.25:0.75\r\n%    \r\n%    or in a fancier, but perhaps clearer, way with\r\n%    \r\n%       t = 1900:10:1970;   t = (t - 1940*ones(t))\/40\r\n%    \r\n%    Either of these is equivalent to\r\n%    \r\n%       t = <-1 -.75 -.50 -.25 0 .25 .50 .75>\r\n%    \r\n%         The interpolating polynomial of  degree   n-1   involves  an\r\n%    Vandermonde  matrix  of  order   n   with  elements that might be\r\n%    generated by\r\n%    \r\n%       for i = 1:n, for j = 1:n, a(i,j) = t(i)**(j-1);\r\n%    \r\n%    However, this results in an error caused by 0**0  when  i = 5 and\r\n%    j = 1 .  The preferable approach is\r\n%    \r\n%       A = ones(n,n);\r\n%       for i = 1:n, for j = 2:n, a(i,j) = t(i)*a(i,j-1);\r\n%    \r\n%    Now the statement\r\n%    \r\n%       cond(A)\r\n%    \r\n%    produces the output\r\n%    \r\n%       ANS   =\r\n%    \r\n%          1.1819E+03\r\n%    \r\n%    which indicates that transformation  of  the  time  variable  has\r\n%    resulted in a reasonably well conditioned matrix.\r\n%    \r\n%         The statement\r\n%    \r\n%       c = A\\y\r\n%    \r\n%    results in\r\n%    \r\n%       C     =\r\n%    \r\n%         131.6690\r\n%          41.0406\r\n%         103.5396\r\n%         262.4535\r\n%        -326.0658\r\n%        -662.0814\r\n%         341.9022\r\n%         533.6373\r\n%    \r\n%    These are the coefficients in the interpolating polynomial\r\n%    \r\n%                              n-1\r\n%          c  + c t + ... + c t\r\n%           1    2           n\r\n%    \r\n%    Our transformation of the time variable has resulted in   t  =  1\r\n%    corresponding  to  the year 1980.  Consequently, the extrapolated\r\n%    population is simply the sum of the coefficients.   This  can  be\r\n%    computed by\r\n%    \r\n%       p = sum(c)\r\n%    \r\n%    The result is\r\n%    \r\n%       P     =\r\n%    \r\n%         426.0950\r\n%    \r\n%    which indicates a 1980 population of over 426 million.   Clearly,\r\n%    using  the seventh degree interpolating polynomial to extrapolate\r\n%    even a fairly short distance beyond the end of the data  interval\r\n%    is not a good idea.\r\n%    \r\n%         The coefficients in least squares  fits  by  polynomials  of\r\n%    lower  degree can be computed using fewer than  n  columns of the\r\n%    matrix.\r\n%    \r\n%       for k = 1:n, c = A(:,1:k)\\y,  p = sum(c)\r\n%    \r\n%    would produce the coefficients of these  fits,  as  well  as  the\r\n%    resulting  extrapolated  population.   If we do not want to print\r\n%    all the coefficients, we can simply generate  a  small  table  of\r\n%    populations  predicted  by  polynomials  of  degrees zero through\r\n%    seven.  We also compute the maximum deviation between the  fitted\r\n%    and observed values.\r\n%    \r\n%       for k = 1:n, X = A(:,1:k);  c = X\\y;  ...\r\n%          d(k) = k-1;  p(k) = sum(c);  e(k) = norm(X*c-y,'inf');\r\n%       <d, p, e>\r\n%    \r\n%    The resulting output is\r\n%    \r\n%          0   132.7227  70.4892\r\n%          1   211.5101   9.8079\r\n%          2   227.7744   5.0354\r\n%          3   241.9574   3.8941\r\n%          4   234.2814   4.0643\r\n%          5   189.7310   2.5066\r\n%          6   118.3025   1.6741\r\n%          7   426.0950   0.0000\r\n%    \r\n%    The zeroth degree fit, 132.7 million, is the result of fitting  a\r\n%    constant  to  the  data  and  is simply the average.  The results\r\n%    obtained with polynomials of degree one through four  all  appear\r\n%    reasonable.   The  maximum  deviation  of  the degree four fit is\r\n%    slightly greater than the degree three, even though  the  sum  of\r\n%    the  squares  of the deviations is less.  The coefficients of the\r\n%    highest powers in the fits of degree five and six turn out to  be\r\n%    negative  and  the predicted populations of less than 200 million\r\n%    are probably unrealistic.  The hopefully absurd prediction of the\r\n%    interpolating polynomial concludes the table.\r\n%    \r\n%         We  wish  to  emphasize  that  roundoff   errors   are   not\r\n%    significant  here.  Nearly identical results would be obtained on\r\n%    other computers, or with other algorithms.   The  results  simply\r\n%    indicate   the  difficulties  associated  with  extrapolation  of\r\n%    polynomial fits of even modest degree.\r\n%    \r\n%         A stabilized fit by  a  seventh  degree  polynomial  can  be\r\n%    obtained  using  the  pseudoinverse,  but  it  requires  a fairly\r\n%    delicate choice of a tolerance. The statement\r\n%    \r\n%       s = svd(A)\r\n%    \r\n%    produces the singular values\r\n%    \r\n%       S     =\r\n%    \r\n%          3.4594\r\n%          2.2121\r\n%          1.0915\r\n%          0.4879\r\n%          0.1759\r\n%          0.0617\r\n%          0.0134\r\n%          0.0029\r\n%    \r\n%    We see that the last three singular values are less  than  0.1  ,\r\n%    consequently,   A   can be approximately by a matrix of rank five\r\n%    with an error less than 0.1 .  The Moore-Penrose pseudoinverse of\r\n%    this  rank  five  matrix  is  obtained  from  the  singular value\r\n%    decomposition with the following statements\r\n%    \r\n%       c = pinv(A,0.1)*y, p = sum(c), e = norm(a*c-y,'inf')\r\n%    \r\n%    The output is\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%       C     =\r\n%    \r\n%        134.7972\r\n%         67.5055\r\n%         23.5523\r\n%          9.2834\r\n%          3.0174\r\n%          2.6503\r\n%         -2.8808\r\n%          3.2467\r\n%    \r\n%       P     =\r\n%    \r\n%        241.1720\r\n%    \r\n%       E     =\r\n%    \r\n%          3.9469\r\n%    \r\n%    The resulting seventh degree polynomial  has  coefficients  which\r\n%    are much smaller than those of the interpolating polynomial given\r\n%    earlier.  The predicted population and the maximum deviation  are\r\n%    reasonable.   Any  choice  of the tolerance between the fifth and\r\n%    sixth singular values would produce the same results, but choices\r\n%    outside this range result in pseudoinverses of different rank and\r\n%    do not work as well.\r\n%    \r\n%         The one term exponential approximation\r\n%    \r\n%         y(t) = k exp(pt)\r\n%    \r\n%    can  be  transformed  into  a  linear  approximation  by   taking\r\n%    logarithms.\r\n%    \r\n%         log(y(t)) = log k + pt\r\n%    \r\n%                   = c  + c t\r\n%                      1    2\r\n%    \r\n%    The following segment makes use of the fact that a function of  a\r\n%    vector is the function applied to the individual components.\r\n%    \r\n%       X = A(:,1:2);\r\n%       c = X\\log(y)\r\n%       p = exp(sum(c))\r\n%       e = norm(exp(X*c)-y,'inf')\r\n%    \r\n%    The resulting output is\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%       C     =\r\n%    \r\n%          4.9083\r\n%          0.5407\r\n%    \r\n%       P     =\r\n%    \r\n%        232.5134\r\n%    \r\n%       E     =\r\n%    \r\n%          4.9141\r\n%    \r\n%    The   predicted   population   and   maximum   deviation   appear\r\n%    satisfactory  and  indicate  that  the  exponential  model  is  a\r\n%    reasonable one to consider.\r\n%    \r\n%         As a curiousity, we return to  the  degree  six  polynomial.\r\n%    Since  the coefficient of the high order term is negative and the\r\n%    value of the polynomial at t = 1 is positive, it must have a root\r\n%    at some value of  t  greater than one.  The statements\r\n%    \r\n%       X = A(:,1:7);\r\n%       c = X\\y;\r\n%       c = c(7:-1:1);  \/\/reverse the order of the coefficients\r\n%       z = roots(c)\r\n%    \r\n%    produce\r\n%    \r\n%       Z     =\r\n%    \r\n%          1.1023-  0.0000*i\r\n%          0.3021+  0.7293*i\r\n%         -0.8790+  0.6536*i\r\n%         -1.2939-  0.0000*i\r\n%         -0.8790-  0.6536*i\r\n%          0.3021-  0.7293*i\r\n%    \r\n%    There is only one real, positive root.  The corresponding time on\r\n%    the original scale is\r\n%    \r\n%       1940 + 40*real(z(1))\r\n%    \r\n%         =  1984.091\r\n%    \r\n%    We conclude that the United States population should become  zero\r\n%    early in February of 1984.\r\n%    \r\n%    \r\n%    \r\n%    \r\n  \r\n   \r\n%% 7.  Partial differential equation example\r\n%    \r\n%    \r\n%         Our second extended example is a boundary value problem  for\r\n%    Laplace's equation.  The underlying physical problem involves the\r\n%    conductivity of a  medium  with  cylindrical  inclusions  and  is\r\n%    considered by Keller and Sachs [7].\r\n%    \r\n%         Find a function  u(x,y)  satisfying Laplace's equation\r\n%    \r\n%                   u   + u   = 0\r\n%                    xx    yy\r\n%    \r\n%    The domain is a unit square with a quarter circle of  radius  rho\r\n%    removed from one corner.  There are Neumann conditions on the top\r\n%    and bottom edges and Dirichlet conditions on the remainder of the\r\n%    boundary.\r\n%    \r\n%    \r\n%                             u  = 0\r\n%                              n\r\n%    \r\n%                         REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-\r\n%                        |             .\r\n%                        |             .\r\n%                        |              .\r\n%                        |               .  u = 1\r\n%                        |                 .\r\n%                        |                    .\r\n%                        |                       .\r\n%                 u = 0  |                        |\r\n%                        |                        |\r\n%                        |                        |\r\n%                        |                        |  u = 1\r\n%                        |                        |\r\n%                        |                        |\r\n%                        |                        |\r\n%                         REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%    \r\n%                                  u  = 0\r\n%                                   n\r\n%    \r\n%    \r\n%    The effective conductivity of an medium  is  then  given  by  the\r\n%    integral along the left edge,\r\n%    \r\n%                                1\r\n%                     sigma = integral  u (0,y) dy\r\n%                               0        n\r\n%    \r\n%    It is of interest to study the relation between  the  radius  rho\r\n%    and  the  conductivity  sigma.   In particular, as rho approaches\r\n%    one, sigma becomes infinite.\r\n%         Keller and Sachs use a finite difference approximation.  The\r\n%    following  technique  makes  use of the fact that the equation is\r\n%    actually Laplace's equation and leads to a  much  smaller  matrix\r\n%    problem to solve.\r\n%    \r\n%         Consider an approximate solution of the form\r\n%    \r\n%                     n      2j-1\r\n%               u =  sum  c r    cos(2j-1)t\r\n%                    j=1   j\r\n%    \r\n%    where  r,t  are polar coordinates (t is theta).  The coefficients\r\n%    are to be determined.  For any set of coefficients, this function\r\n%    already satisfies the differential  equation  because  the  basis\r\n%    functions  are  harmonic;  it  satisfies  the  normal  derivative\r\n%    boundary condition on the bottom edge of the  domain  because  we\r\n%    used   cos  t   in  preference  to   sin t ; and it satisfies the\r\n%    boundary condition on the left edge of the domain because we  use\r\n%    only odd multiples of  t .\r\n%    \r\n%         The computational task is to find coefficients  so that  the\r\n%    boundary  conditions on the remaining edges are satisfied as well\r\n%    as possible.  To accomplish this, pick  m  points  (r,t)  on  the\r\n%    remaining edges.  It is desirable to have  m > n  and in practice\r\n%    we usually choose m  to be two or three times as large  as   n  .\r\n%    Typical  values  of  n  are 10 or 20 and of  m  are 20 to 60.  An\r\n%    m  by  n  matrix  A  is generated.  The  i,j  element is the j-th\r\n%    basis  function,  or its normal derivative, evaluated at the i-th\r\n%    boundary point.  A right hand side with  m   components  is  also\r\n%    generated.   In this example, the elements of the right hand side\r\n%    are either zero or one.   The  coefficients  are  then  found  by\r\n%    solving the overdetermined set of equations\r\n%    \r\n%                Ac = b\r\n%    \r\n%    in a least squares sense.\r\n%    \r\n%         Once the coefficients have been determined, the  approximate\r\n%    solution  is  defined  everywhere  on  the  domain.   It  is then\r\n%    possible to compute the effective conductivity sigma .  In  fact,\r\n%    a very simple formula results,\r\n%    \r\n%                         n       j-1\r\n%               sigma =  sum  (-1)   c\r\n%                        j=1          j\r\n%    \r\n%         To use MATLAB for this problem, the following  \"program\"  is\r\n%    first  stored  in  the  local computer file system, say under the\r\n%    name \"PDE\".\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \/\/Conductivity example.\r\n%    \/\/Parameters REPLACE_WITH_DASH_DASH-\r\n%       rho       \/\/radius of cylindrical inclusion\r\n%       n         \/\/number of terms in solution\r\n%       m         \/\/number of boundary points\r\n%    \/\/initialize operation counter\r\n%       flop = <0 0>;\r\n%    \/\/initialize variables\r\n%       m1 = round(m\/3);   \/\/number of points on each straight edge\r\n%       m2 = m - m1;       \/\/number of points with Dirichlet conditions\r\n%       pi = 4*atan(1);\r\n%    \/\/generate points in Cartesian coordinates\r\n%       \/\/right hand edge\r\n%       for i = 1:m1, x(i) = 1; y(i) = (1-rho)*(i-1)\/(m1-1);\r\n%       \/\/top edge\r\n%       for i = m2+1:m, x(i) = (1-rho)*(m-i)\/(m-m2-1); y(i) = 1;\r\n%       \/\/circular edge\r\n%       for i = m1+1:m2, t = pi\/2*(i-m1)\/(m2-m1+1); ...\r\n%          x(i) = 1-rho*sin(t);  y(i) = 1-rho*cos(t);\r\n%    \/\/convert to polar coordinates\r\n%       for i = 1:m-1, th(i) = atan(y(i)\/x(i));  ...\r\n%          r(i) = sqrt(x(i)**2+y(i)**2);\r\n%       th(m) = pi\/2;  r(m) = 1;\r\n%    \/\/generate matrix\r\n%       \/\/Dirichlet conditions\r\n%       for i = 1:m2, for j = 1:n, k = 2*j-1; ...\r\n%          a(i,j) = r(i)**k*cos(k*th(i));\r\n%       \/\/Neumann conditions\r\n%       for i = m2+1:m, for j = 1:n, k = 2*j-1; ...\r\n%          a(i,j) = k*r(i)**(k-1)*sin((k-1)*th(i));\r\n%    \/\/generate right hand side\r\n%       for i = 1:m2, b(i) = 1;\r\n%       for i = m2+1:m, b(i) = 0;\r\n%    \/\/solve for coefficients\r\n%       c = A\\b\r\n%    \/\/compute effective conductivity\r\n%       c(2:2:n) = -c(2:2:n);\r\n%       sigma = sum(c)\r\n%    \/\/output total operation count\r\n%       ops = flop(2)\r\n%    \r\n%    \r\n%    \r\n%    \r\n%         The program can be used within MATLAB by setting  the  three\r\n%    parameters and then accessing the file.  For example,\r\n%    \r\n%       rho = .9;\r\n%       n = 15;\r\n%       m = 30;\r\n%       exec('PDE')\r\n%    \r\n%    The resulting output is\r\n%       RHO   =\r\n%    \r\n%          .9000\r\n%    \r\n%       N     =\r\n%    \r\n%        15.\r\n%    \r\n%       M     =\r\n%    \r\n%        30.\r\n%    \r\n%       C     =\r\n%    \r\n%          2.2275\r\n%         -2.2724\r\n%          1.1448\r\n%          0.1455\r\n%         -0.1678\r\n%         -0.0005\r\n%         -0.3785\r\n%          0.2299\r\n%          0.3228\r\n%         -0.2242\r\n%         -0.1311\r\n%          0.0924\r\n%          0.0310\r\n%         -0.0154\r\n%         -0.0038\r\n%    \r\n%       SIGM  =\r\n%    \r\n%          5.0895\r\n%    \r\n%       OPS   =\r\n%    \r\n%          16204.\r\n%    \r\n%    \r\n%         A total of 16204 floating point operations were necessary to\r\n%    set  up  the  matrix,  solve for the coefficients and compute the\r\n%    conductivity.  The operation count  is  roughly  proportional  to\r\n%    m*n**2.   The  results obtained for sigma as a function of rho by\r\n%    this approach are essentially the same as those obtained  by  the\r\n%    finite   difference  technique  of  Keller  and  Sachs,  but  the\r\n%    computational effort involved is much less.\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n \r\n    \r\n%% 8.  Eigenvalue sensitivity example\r\n%    \r\n%    \r\n%         In this example, we construct a matrix whose eigenvalues are\r\n%    moderately  sensitive  to  perturbations  and  then  analyze that\r\n%    sensitivity. We begin with the statement\r\n%    \r\n%       B = <3 0 7; 0 2 0; 0 0 1>\r\n%    \r\n%    which produces\r\n%    \r\n%       B     =\r\n%    \r\n%           3.    0.    7.\r\n%           0.    2.    0.\r\n%           0.    0.    1.\r\n%    \r\n%    \r\n%         Obviously, the eigenvalues of B are 1, 2 and 3 .   Moreover,\r\n%    since   B  is  not  symmetric,  these  eigenvalues  are  slightly\r\n%    sensitive to perturbation.  (The value b(1,3) = 7 was  chosen  so\r\n%    that the elements of the matrix A below are less than 1000.)\r\n%    \r\n%         We now generate a similarity transformation to disguise  the\r\n%    eigenvalues and make them more sensitive.\r\n%    \r\n%       L = <1 0 0; 2 1 0; -3 4 1>, M = L\\L'\r\n%    \r\n%       L     =\r\n%    \r\n%           1.    0.    0.\r\n%           2.    1.    0.\r\n%          -3.    4.    1.\r\n%    \r\n%       M     =\r\n%    \r\n%           1.0000    2.0000   -3.0000\r\n%          -2.0000   -3.0000   10.0000\r\n%          11.0000   18.0000  -48.0000\r\n%    \r\n%    The matrix M has determinant equal to 1 and is  moderately  badly\r\n%    conditioned.  The similarity transformation is\r\n%    \r\n%       A = M*B\/M\r\n%    \r\n%       A     =\r\n%    \r\n%         -64.0000   82.0000   21.0000\r\n%         144.0000 -178.0000  -46.0000\r\n%        -771.0000  962.0000  248.0000\r\n%    \r\n%    Because  det(M) = 1 , the elements of  A  would be exact integers\r\n%    if there were no roundoff.  So,\r\n%       A = round(A)\r\n%    \r\n%       A     =\r\n%    \r\n%         -64.   82.   21.\r\n%         144. -178.  -46.\r\n%        -771.  962.  248.\r\n%    \r\n%    \r\n%         This, then, is our test matrix.  We can now  forget  how  it\r\n%    was generated and analyze its eigenvalues.\r\n%    \r\n%       <X,D> = eig(A)\r\n%    \r\n%       D     =\r\n%    \r\n%           3.0000    0.0000    0.0000\r\n%           0.0000    1.0000    0.0000\r\n%           0.0000    0.0000    2.0000\r\n%    \r\n%       X     =\r\n%    \r\n%           -.0891    3.4903   41.8091\r\n%            .1782   -9.1284  -62.7136\r\n%           -.9800   46.4473  376.2818\r\n%    \r\n%    Since A is similar to B, its eigenvalues are also  1,  2  and  3.\r\n%    They  happen  to  be  computed  in  another  order by the EISPACK\r\n%    subroutines.  The fact that the  columns  of  X,  which  are  the\r\n%    eigenvectors,  are  so  far  from  being orthonormal is our first\r\n%    indication that  the  eigenvalues  are  sensitive.  To  see  this\r\n%    sensitivity, we display more figures of the computed eigenvalues.\r\n%    \r\n%       long, diag(D)\r\n%    \r\n%       ANS   =\r\n%    \r\n%          2.999999999973599\r\n%          1.000000000015625\r\n%          2.000000000011505\r\n%    \r\n%    We see that, on this computer, the last five significant  figures\r\n%    are  contaminated  by  roundoff  error.  A  somewhat  superficial\r\n%    explanation of this is provided by\r\n%    \r\n%       short,  cond(X)\r\n%    \r\n%       ANS   =\r\n%    \r\n%          3.2216e+05\r\n%    \r\n%    The condition number of X gives an upper bound for  the  relative\r\n%    error  in  the  computed  eigenvalues.   However,  this condition\r\n%    number is affected by scaling.\r\n%    \r\n%       X = X\/diag(X(3,:)),  cond(X)\r\n%    \r\n%       X     =\r\n%    \r\n%            .0909     .0751     .1111\r\n%           -.1818    -.1965    -.1667\r\n%           1.0000    1.0000    1.0000\r\n%    \r\n%       ANS   =\r\n%    \r\n%          1.7692e+03\r\n%    \r\n%    \r\n%         Rescaling the eigenvectors so that their last components are\r\n%    all  equal  to  one  has  two consequences. The condition of X is\r\n%    decreased by over two orders of magnitude.  (This  is  about  the\r\n%    minimum condition that can be obtained by such diagonal scaling.)\r\n%    Moreover, it is now apparent  that  the  three  eigenvectors  are\r\n%    nearly parallel.\r\n%    \r\n%         More  detailed  information  on  the  sensitivity   of   the\r\n%    individual eigenvalues involves the left eigenvectors.\r\n%    \r\n%       Y = inv(X'),  Y'*A*X\r\n%    \r\n%       Y     =\r\n%    \r\n%        -511.5000  259.5000  252.0000\r\n%         616.0000 -346.0000 -270.0000\r\n%         159.5000  -86.5000  -72.0000\r\n%    \r\n%       ANS   =\r\n%    \r\n%           3.0000     .0000     .0000\r\n%            .0000    1.0000     .0000\r\n%            .0000     .0000    2.0000\r\n%    \r\n%    We are now in a position to  compute  the  sensitivities  of  the\r\n%    individual eigenvalues.\r\n%    \r\n%       for j = 1:3, c(j) = norm(Y(:,j))*norm(X(:,j)); end,  C\r\n%    \r\n%       C     =\r\n%    \r\n%         833.1092\r\n%         450.7228\r\n%         383.7564\r\n%    \r\n%    These three numbers are the reciprocals of  the  cosines  of  the\r\n%    angles  between the left and right eigenvectors.  It can be shown\r\n%    that  perturbation  of  the  elements  of  A  can  result  in   a\r\n%    perturbation of the j-th eigenvalue which is c(j) times as large.\r\n%    In  this  example,  the  first   eigenvalue   has   the   largest\r\n%    sensitivity.\r\n%    \r\n%         We now proceed to show that A is close to a  matrix  with  a\r\n%    double eigenvalue.  The direction of the required perturbation is\r\n%    given by\r\n%    \r\n%       E = -1.e-6*Y(:,1)*X(:,1)'\r\n%    \r\n%       E     =\r\n%    \r\n%          1.0e-03 *\r\n%    \r\n%            .0465    -.0930     .5115\r\n%           -.0560     .1120    -.6160\r\n%           -.0145     .0290    -.1595\r\n%    \r\n%    With some trial and error which we do not show,  we  bracket  the\r\n%    point  where  two  eigenvalues of a perturbed A coalesce and then\r\n%    become complex.\r\n%    \r\n%       eig(A + .4*E),  eig(A + .5*E)\r\n%    \r\n%       ANS   =\r\n%    \r\n%           1.1500\r\n%           2.5996\r\n%           2.2504\r\n%    \r\n%       ANS   =\r\n%    \r\n%          2.4067 +  .1753*i\r\n%          2.4067 -  .1753*i\r\n%          1.1866 + 0.0000*i\r\n%    \r\n%    Now, a bisecting search, driven by the imaginary part of  one  of\r\n%    the eigenvalues, finds the point where two eigenvalues are nearly\r\n%    equal.\r\n%    \r\n%       r = .4;  s = .5;\r\n%    \r\n%       while s-r > 1.e-14, t = (r+s)\/2; d = eig(A+t*E); ...\r\n%         if imag(d(1))=0, r = t; else, s = t;\r\n%    \r\n%       long,  T\r\n%    \r\n%       T     =\r\n%    \r\n%            .450380734134507\r\n%    \r\n%    \r\n%         Finally, we display the perturbed matrix, which is obviously\r\n%    close  to the original, and its pair of nearly equal eigenvalues.\r\n%    (We have dropped a few digits from the long output.)\r\n%    \r\n%       A+t*E,  eig(A+t*E)\r\n%    \r\n%       A\r\n%    \r\n%        -63.999979057   81.999958114   21.000230369\r\n%        143.999974778 -177.999949557  -46.000277434\r\n%       -771.000006530  962.000013061  247.999928164\r\n%    \r\n%       ANS   =\r\n%    \r\n%          2.415741150\r\n%          2.415740621\r\n%          1.168517777\r\n%    \r\n%    \r\n%         The  first  two  eigenvectors  of  A  +   t*E   are   almost\r\n%    indistinguishable  indicating that the perturbed matrix is almost\r\n%    defective.\r\n%    \r\n%       <X,D> = eig(A+t*E);  X = X\/diag(X(3,:))\r\n%    \r\n%       X     =\r\n%    \r\n%           .096019578     .096019586    .071608466\r\n%          -.178329614    -.178329608   -.199190520\r\n%          1.000000000    1.000000000   1.000000000\r\n%    \r\n%       short,  cond(X)\r\n%    \r\n%       ANS   =\r\n%    \r\n%          3.3997e+09\r\n  \r\n    \r\n%% 9.  Syntax diagrams\r\n%    \r\n%    \r\n%         A formal description of the language acceptable  to  MATLAB,\r\n%    as well as a flow chart of the MATLAB program, is provided by the\r\n%    syntax diagrams or syntax graphs of Wirth [6].  There are  eleven\r\n%    non-terminal symbols in the language:\r\n%    \r\n%       line, statement, clause, expression, term,\r\n%       factor, number, integer, name, command, text .\r\n%    \r\n%    The diagrams define each of the non-terminal  symbols  using  the\r\n%    others and the terminal symbols:\r\n%    \r\n%       letter REPLACE_WITH_DASH_DASH A through Z,\r\n%       digit  REPLACE_WITH_DASH_DASH 0 through 9,\r\n%       char   REPLACE_WITH_DASH_DASH ( ) ; : + - * \/ \\ = . , < >\r\n%       quote  REPLACE_WITH_DASH_DASH '\r\n%    \r\n%    \r\n%    line\r\n%    \r\n%           |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> statement >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|\r\n%           |                      |\r\n%           |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> clause >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|\r\n%           |                      |\r\n%    REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> expr >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH>\r\n%         | |                      | |\r\n%         | |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> command >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH| |\r\n%         | |                      | |\r\n%         | |-> > >-> expr >-> < >-| |\r\n%         | |                      | |\r\n%         | |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH| |\r\n%         |                          |\r\n%         |        |-< ; <-|         |\r\n%         |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|       |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|\r\n%                  |-< , <-|\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    statement\r\n%    \r\n%         |-> name >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|\r\n%         |          |                              |\r\n%         |          |         |REPLACE_WITH_DASH_DASH> : >REPLACE_WITH_DASH_DASH-|         |\r\n%         |          |         |          |         |\r\n%         |          |-> ( >REPLACE_WITH_DASH_DASH-|-> expr >-|REPLACE_WITH_DASH_DASH-> ) >-|\r\n%         |                  |              |       |\r\n%    REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|                  |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-< , <REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|       |REPLACE_WITH_DASH_DASH> = >REPLACE_WITH_DASH_DASH> expr >REPLACE_WITH_DASH_DASH->\r\n%         |                                         |\r\n%         |       |REPLACE_WITH_DASH_DASH< , <REPLACE_WITH_DASH_DASH-|                      |\r\n%         |       |          |                      |\r\n%         |-> < >REPLACE_WITH_DASH_DASH-> name >REPLACE_WITH_DASH_DASH-> > >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    clause\r\n%    \r\n%         |REPLACE_WITH_DASH_DASH-> FOR   >REPLACE_WITH_DASH_DASH-> name >REPLACE_WITH_DASH_DASH-> = >REPLACE_WITH_DASH_DASH-> expr >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|\r\n%         |                                                        |\r\n%         | |-> WHILE >-|                                          |\r\n%         |-|           |-> expr >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH           |\r\n%         | |-> IF    >-|          |   |   |   |   |   |           |\r\n%    REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|                        <   <=  =   <>  >=  >           |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH>\r\n%         |                        |   |   |   |   |   |           |\r\n%         |                        REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH> expr >REPLACE_WITH_DASH_DASH|\r\n%         |                                                        |\r\n%         |REPLACE_WITH_DASH_DASH-> ELSE  >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|\r\n%         |                                                        |\r\n%         |REPLACE_WITH_DASH_DASH-> END   >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    expr\r\n%    \r\n%           |-> + >-|\r\n%           |       |\r\n%    REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> term >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH>\r\n%           |       |    |             |\r\n%           |-> - >-|    |  |-< + <-|  |\r\n%                        |  |       |  |\r\n%                        |REPLACE_WITH_DASH_DASH|-< - <-|REPLACE_WITH_DASH_DASH|\r\n%                           |       |\r\n%                           |-< : <-|\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    term\r\n%    \r\n%    REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> factor >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH>\r\n%            |                                   |\r\n%            |             |-< * <-|             |\r\n%            |  |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|  |       |  |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|  |\r\n%            |REPLACE_WITH_DASH_DASH|       |REPLACE_WITH_DASH_DASH|-< \/ <-|REPLACE_WITH_DASH_DASH|       |REPLACE_WITH_DASH_DASH|\r\n%               |-< . <-|  |       |  |-< . <-|\r\n%                          |-< \\ <-|\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    factor\r\n%    \r\n%         |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH> number >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|\r\n%         |                                         |\r\n%         |-> name >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|\r\n%         |          |                              |\r\n%         |          |         |REPLACE_WITH_DASH_DASH> : >REPLACE_WITH_DASH_DASH-|         |\r\n%         |          |         |          |         |\r\n%         |          |-> ( >REPLACE_WITH_DASH_DASH-|-> expr >-|REPLACE_WITH_DASH_DASH-> ) >-|\r\n%         |                  |              |       |\r\n%         |                  |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-< , <REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|       |\r\n%         |                                         |\r\n%    REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH> ( >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> expr >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> ) >-|-|REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH->\r\n%         |                                         | |       | |\r\n%         |                  |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|       | |-> ' >-| |\r\n%         |                  |              |       |           |\r\n%         |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH> < >-|REPLACE_WITH_DASH_DASH-> expr >REPLACE_WITH_DASH_DASH-|-> > >-|           |\r\n%         |                    |          |         |           |\r\n%         |                    |REPLACE_WITH_DASH_DASH<   <REPLACE_WITH_DASH_DASH-|         |           |\r\n%         |                    |          |         |           |\r\n%         |                    |REPLACE_WITH_DASH_DASH< ; <REPLACE_WITH_DASH_DASH-|         |           |\r\n%         |                    |          |         |           |\r\n%         |                    |REPLACE_WITH_DASH_DASH< , <REPLACE_WITH_DASH_DASH-|         |           |\r\n%         |                                         |           |\r\n%         |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH> > >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> expr >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> < >-|           |\r\n%         |                                         |           |\r\n%         |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> factor >REPLACE_WITH_DASH_DASH-> ** >REPLACE_WITH_DASH_DASH-> factor >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|           |\r\n%         |                                                     |\r\n%         |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH> ' >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> text >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> ' >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    number\r\n%    \r\n%        |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|                          |-> + >-|\r\n%        |          |                          |       |\r\n%    REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> int >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> . >REPLACE_WITH_DASH_DASH-> int >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> E >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-> int >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH>\r\n%                 |                   | |      |       |        |\r\n%                 |                   | |      |-> - >-|        |\r\n%                 |                   | |                       |\r\n%                 |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    int\r\n%    \r\n%    REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH> digit >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH->\r\n%              |           |\r\n%              |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    name\r\n%    \r\n%                      |REPLACE_WITH_DASH_DASH< letter <REPLACE_WITH_DASH_DASH|\r\n%                      |              |\r\n%    REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH> letter >REPLACE_WITH_DASH_DASH|REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH->\r\n%                      |              |\r\n%                      |REPLACE_WITH_DASH_DASH< digit  <REPLACE_WITH_DASH_DASH|\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    command\r\n%    \r\n%                            |REPLACE_WITH_DASH_DASH> name >REPLACE_WITH_DASH_DASH|\r\n%                            |            |\r\n%    REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH> name >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH>\r\n%                            |            |\r\n%                            |REPLACE_WITH_DASH_DASH> char >REPLACE_WITH_DASH_DASH|\r\n%                            |            |\r\n%                            |REPLACE_WITH_DASH_DASH-> ' >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|\r\n%    \r\n%    text\r\n%    \r\n%                    |-> letter >REPLACE_WITH_DASH_DASH|\r\n%                    |             |\r\n%                    |-> digit >REPLACE_WITH_DASH_DASH-|\r\n%    REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|             |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH>\r\n%                |   |-> char >REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH|   |\r\n%                |   |             |   |\r\n%                |   |-> ' >-> ' >-|   |\r\n%                |                     |\r\n%                |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|\r\n \r\n    \r\n%% 10.  The parser-interpreter\r\n%    \r\n%    \r\n%         The structure of the parser-interpreter is similar  to  that\r\n%    of  Wirth's  compiler  [6] for his simple language, PL\/0 , except\r\n%    that MATLAB  is  programmed  in  Fortran,  which  does  not  have\r\n%    explicit recursion.  The interrelation of the primary subroutines\r\n%    is shown in the following diagram.\r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%    \r\n%          MAIN\r\n%            |\r\n%          MATLAB    |REPLACE_WITH_DASH_DASHCLAUSE\r\n%            |       |    |\r\n%          PARSEREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|REPLACE_WITH_DASH_DASHEXPRREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHTERMREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHFACTOR\r\n%                    |    |       |       |\r\n%                    |    |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-|\r\n%                    |    |       |       |\r\n%                    |  STACK1  STACK2  STACKG\r\n%                    |\r\n%                    |REPLACE_WITH_DASH_DASHSTACKPREPLACE_WITH_DASH_DASHPRINT\r\n%                    |\r\n%                    |REPLACE_WITH_DASH_DASHCOMAND\r\n%                    |\r\n%                    |\r\n%                    |          |REPLACE_WITH_DASH_DASHCGECO\r\n%                    |          |\r\n%                    |          |REPLACE_WITH_DASH_DASHCGEFA\r\n%                    |          |\r\n%                    |REPLACE_WITH_DASH_DASHMATFN1REPLACE_WITH_DASH_DASH|REPLACE_WITH_DASH_DASHCGESL\r\n%                    |          |\r\n%                    |          |REPLACE_WITH_DASH_DASHCGEDI\r\n%                    |          |\r\n%                    |          |REPLACE_WITH_DASH_DASHCPOFA\r\n%                    |\r\n%                    |\r\n%                    |          |REPLACE_WITH_DASH_DASHIMTQL2\r\n%                    |          |\r\n%                    |          |REPLACE_WITH_DASH_DASHHTRIDI\r\n%                    |          |\r\n%                    |REPLACE_WITH_DASH_DASHMATFN2REPLACE_WITH_DASH_DASH|REPLACE_WITH_DASH_DASHHTRIBK\r\n%                    |          |\r\n%                    |          |REPLACE_WITH_DASH_DASHCORTH\r\n%                    |          |\r\n%                    |          |REPLACE_WITH_DASH_DASHCOMQR3\r\n%                    |\r\n%                    |\r\n%                    |REPLACE_WITH_DASH_DASHMATFN3REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-CSVDC\r\n%                    |\r\n%                    |\r\n%                    |          |REPLACE_WITH_DASH_DASHCQRDC\r\n%                    |REPLACE_WITH_DASH_DASHMATFN4REPLACE_WITH_DASH_DASH|\r\n%                    |          |REPLACE_WITH_DASH_DASHCQRSL\r\n%                    |\r\n%                    |\r\n%                    |          |REPLACE_WITH_DASH_DASHFILES\r\n%                    |REPLACE_WITH_DASH_DASHMATFN5REPLACE_WITH_DASH_DASH|\r\n%                               |REPLACE_WITH_DASH_DASHSAVLOD\r\n%    \r\n%         Subroutine  PARSE  controls  the  interpretation   of   each\r\n%    statement.    It  calls  subroutines  that  process  the  various\r\n%    syntactic  quantities  such  as  command,  expression,  term  and\r\n%    factor.   A  fairly  simple  program stack mechanism allows these\r\n%    subroutines to recursively \"call\"  each  other  along  the  lines\r\n%    allowed  by  the  syntax  diagrams.   The  four STACK subroutines\r\n%    manage the variable memory  and  perform  elementary  operations,\r\n%    such as matrix addition and transposition.\r\n%    \r\n%         The  four  subroutines  MATFN1  though  MATFN4  are   called\r\n%    whenever  \"serious\"  matrix  computations are required.  They are\r\n%    interface routines which call the  various  LINPACK  and  EISPACK\r\n%    subroutines.  MATFN5 primarily handles the file access tasks.\r\n%    \r\n%         Two large real arrays, STKR and STKI, are used to store  all\r\n%    the  matrices.   Four integer arrays are used to store the names,\r\n%    the row and column dimensions, and the  pointers  into  the  real\r\n%    stacks.  The following diagram illustrates this storage scheme.\r\n%    \r\n%    TOP         IDSTK     MSTK NSTK LSTK               STKR       STKI\r\n%     REPLACE_WITH_DASH_DASH      REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH              REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%    |  |REPLACE_WITH_DASH_DASH->|  |  |  |  | |  | |  | |  |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH->|        | |        |\r\n%     REPLACE_WITH_DASH_DASH      REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH              REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%            |  |  |  |  | |  | |  | |  |            |        | |        |\r\n%             REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH              REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%                  .         .    .    .                  .          .\r\n%                  .         .    .    .                  .          .\r\n%                  .         .    .    .                  .          .\r\n%             REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH              REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%    BOT     |  |  |  |  | |  | |  | |  |            |        | |        |\r\n%     REPLACE_WITH_DASH_DASH      REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH              REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%    |  |REPLACE_WITH_DASH_DASH->| X|  |  |  | | 2| | 1| |  |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH->|  3.14  | |  0.00  |\r\n%     REPLACE_WITH_DASH_DASH      REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH              REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%            | A|  |  |  | | 2| | 2| |  |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-   |  0.00  | |  1.00  |\r\n%             REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH          \\   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%            | E| P| S|  | | 1| | 1| |  |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH-   ->| 11.00  | |  0.00  |\r\n%             REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH        \\     REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%            | F| L| O| P| | 1| | 2| |  |REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH  \\   | 21.00  | |  0.00  |\r\n%             REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH       \\  \\   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%            | E| Y| E|  | |-1| |-1| |  |REPLACE_WITH_DASH_DASH-    \\ |  | 12.00  | |  0.00  |\r\n%             REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH    \\   | |   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%            | R| A| N| D| | 1| | 1| |  |-   \\  | |  | 22.00  | |  0.00  |\r\n%             REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASH  \\  |  \\ \\   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%                                         |  \\   \\ ->| 1.E-15 | |  0.00  |\r\n%                                         \\   \\   \\   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%                                          \\   \\   ->|  0.00  | |  0.00  |\r\n%                                           \\   \\     REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%                                            \\   \\   |  0.00  | |  0.00  |\r\n%                                             \\   \\   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%                                              \\   ->|  1.00  | |  0.00  |\r\n%                                               \\     REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%                                                REPLACE_WITH_DASH_DASH->| URAND  | |  0.00  |\r\n%                                                     REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH   REPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASHREPLACE_WITH_DASH_DASH\r\n%    \r\n%         The top portion of the stack is used for temporary variables\r\n%    and the bottom portion for saved variables.  The figure shows the\r\n%    situation after the line\r\n%       A = <11,12; 21,22>,  x = <3.14, sqrt(-1)>'\r\n%    \r\n%    has been processed.  The four permanent names,  EPS,  FLOP,  RAND\r\n%    and  EYE,  occupy the last four positions of the variable stacks.\r\n%    RAND has dimensions 1 by 1, but whenever its value is  requested,\r\n%    a random number generator is used instead.  EYE has dimensions -1\r\n%    by -1 to indicate that the actual dimensions must  be  determined\r\n%    later by context.  The two saved variables have dimensions 2 by 2\r\n%    and 2 by 1 and so take up a total of 6 locations.\r\n%    \r\n%         Subsequent statements involving  A  and  x  will  result  in\r\n%    temporary  copies  being  made in the top of the stack for use in\r\n%    the actual calculations.  Whenever the top of the  stack  reaches\r\n%    the  bottom,  a  message  indicating  memory has been exceeded is\r\n%    printed, but the current variables are not affected.\r\n%    \r\n%         This modular structure makes it possible to implement MATLAB\r\n%    on a system with a limited amount of memory.  The object code for\r\n%    the MATFN's and the LINPACK-EISPACK subroutines is rarely needed.\r\n%    Although  it  is  not  standard,  many  Fortran operating systems\r\n%    provide some overlay mechanism so that this code is brought  into\r\n%    the  main memory only when required.  The variables, which occupy\r\n%    a relatively small portion of the memory, remain in place,  while\r\n%    the subroutines which process them are loaded a few at a time.\r\n    \r\n   \r\n%% 11.  The numerical algorithms\r\n%    \r\n%    \r\n%         The algorithms underlying the  basic  MATLAB  functions  are\r\n%    described  in the LINPACK and EISPACK guides [1-3]. The following\r\n%    list gives the subroutines used by these functions.\r\n%    \r\n%       INV(A)          - CGECO,CGEDI\r\n%       DET(A)          - CGECO,CGEDI\r\n%       LU(A)           - CGEFA\r\n%       RCOND(A)        - CGECO\r\n%       CHOL(A)         - CPOFA\r\n%       SVD(A)          - CSVDC\r\n%       COND(A)         - CSVDC\r\n%       NORM(A,2)       - CSVDC\r\n%       PINV(A,eps)     - CSVDC\r\n%       RANK(A,eps)     - CSVDC\r\n%       QR(A)           - CQRDC,CQRSL\r\n%       ORTH(A)         - CQRDC,CSQSL\r\n%       A\\B and B\/A     - CGECO,CGESL if A is square.\r\n%                       - CQRDC,CQRSL if A is not square.\r\n%       EIG(A)          - HTRIDI,IMTQL2,HTRIBK if A is Hermitian.\r\n%                       - CORTH,COMQR2         if A is not Hermitian.\r\n%       SCHUR(A)        - same as EIG.\r\n%       HESS(A)         - same as EIG.\r\n%    \r\n%    \r\n%         Minor modifications were made to all these subroutines.  The\r\n%    LINPACK  routines  were  changed  to  replace the Fortran complex\r\n%    arithmetic with explicit references to real and imaginary  parts.\r\n%    Since  most of the floating point arithmetic is concentrated in a\r\n%    few low-level subroutines which perform  vector  operations  (the\r\n%    Basic  Linear  Algebra  Subprograms),  this  was not an extensive\r\n%    change.  It also facilitated implementation of the FLOP and  CHOP\r\n%    features  which count and optionally truncate each floating point\r\n%    operation.\r\n%    \r\n%         The EISPACK subroutine COMQR2 was modified to  allow  access\r\n%    to  the  Schur  triangular  form, ordinarily just an intermediate\r\n%    result.   IMTQL2  was  modified  to  make  computation   of   the\r\n%    eigenvectors   optional.    Both  subroutines  were  modified  to\r\n%    eliminate the machine-dependent accuracy parameter  and  all  the\r\n%    EISPACK subroutines were changed to include FLOP and CHOP.\r\n%    \r\n%         The algorithms employed for the  POLY  and  ROOTS  functions\r\n%    illustrate  an  interesting  aspect  of  the  modern  approach to\r\n%    eigenvalue computation.   POLY(A)  generates  the  characteristic\r\n%    polynomial  of  A  and  ROOTS(POLY(A))  finds  the  roots of that\r\n%    polynomial, which are, of course, the eigenvalues of A . But both\r\n%    POLY  and  ROOTS  use  EISPACK eigenvalues subroutines, which are\r\n%    based on similarity transformations.  So the  classical  approach\r\n%    which  characterizes  eigenvalues  as roots of the characteristic\r\n%    polynomial is actually reversed.\r\n%    \r\n%         If A is an n by n matrix, POLY(A) produces the  coefficients\r\n%    C(1) through C(n+1), with C(1) = 1, in\r\n%    \r\n%          DET(z*EYE-A) = C(1)*z**n + ... + C(n)*z + C(n+1) .\r\n%    \r\n%    The algorithm can be expressed compactly using MATLAB:\r\n%    \r\n%          Z = EIG(A);\r\n%          C = 0*ONES(n+1,1);  C(1) = 1;\r\n%          for j = 1:n, C(2:j+1) = C(2:j+1) - Z(j)*C(1:j);\r\n%          C\r\n%    \r\n%    This recursion is easily derived by expanding the product\r\n%    \r\n%          (z - z(1))*(z - z(2))* ... * (z-z(n)) .\r\n%    \r\n%    It is possible to prove that POLY(A) produces the coefficients in\r\n%    the  characteristic  polynomial of a matrix within roundoff error\r\n%    of  A .  This is true even if the  eigenvalues  of  A  are  badly\r\n%    conditioned.    The  traditional  algorithms  for  obtaining  the\r\n%    characteristic polynomial which do not use the eigenvalues do not\r\n%    have such satisfactory numerical properties.\r\n%    \r\n%         If C is a vector with n+1  components,  ROOTS(C)  finds  the\r\n%    roots of the polynomial of degree n ,\r\n%    \r\n%           p(z) = C(1)*z**n + ... + C(n)*z + C(n+1) .\r\n%    \r\n%    The algorithm simply involves computing the  eigenvalues  of  the\r\n%    companion matrix:\r\n%    \r\n%          A = 0*ONES(n,n)\r\n%          for j = 1:n, A(1,j) = -C(j+1)\/C(1);\r\n%          for i = 2:n, A(i,i-1) = 1;\r\n%          EIG(A)\r\n%    \r\n%    It is possible to prove that the results produced are  the  exact\r\n%    eigenvalues  of  a  matrix within roundoff error of the companion\r\n%    matrix A, but this does not mean that they are the exact roots of\r\n%    a  polynomial with coefficients within roundoff error of those in\r\n%    C .  There are more accurate, more efficient methods for  finding\r\n%    polynomial  roots,  but  this  approach has the crucial advantage\r\n%    that it does not require very much additional code.\r\n%    \r\n%         The elementary functions EXP, LOG, SQRT, SIN, COS  and  ATAN\r\n%    are  applied  to  square  matrices  by  diagonalizing the matrix,\r\n%    applying the functions to the  individual  eigenvalues  and  then\r\n%    transforming back.  For example, EXP(A) is computed by\r\n%    \r\n%          <X,D> = EIG(A);\r\n%          for j = 1:n, D(j,j) = EXP(D(j,j));\r\n%          X*D\/X\r\n%    \r\n%    This is essentially method number 14  out  of  the  19  'dubious'\r\n%    possibilities described in [8].  It is dubious because it doesn't\r\n%    always work.  The matrix of eigenvectors  X  can  be  arbitrarily\r\n%    badly  conditioned  and  all  accuracy lost in the computation of\r\n%    X*D\/X.  A warning message is printed if RCOND(X) is  very  small,\r\n%    but  this  only  catches the extreme cases.  An example of a case\r\n%    not detected is when A has a double eigenvalue, but theoretically\r\n%    only  one  linearly  independent  eigenvector associated with it.\r\n%    The computed eigenvalues will be separated by  something  on  the\r\n%    order  of the square root of the roundoff level.  This separation\r\n%    will be reflected in RCOND(X) which will probably  not  be  small\r\n%    enough to trigger the error message.  The computed EXP(A) will be\r\n%    accurate to only half precision.  Better methods  are  known  for\r\n%    computing EXP(A), but they do not easily extend to the other five\r\n%    functions and would require a considerable amount  of  additional\r\n%    code.\r\n%    \r\n%         The expression A**p is evaluated by repeated  multiplication\r\n%    if p is an integer greater than 1.  Otherwise it is evaluated by\r\n%    \r\n%          <X,D> = EIG(A);\r\n%          for j = 1:n, D(j,j) = EXP(p*LOG(D(j,j)))\r\n%          X*D\/X\r\n%    \r\n%    This suffers from the same potential loss of  accuracy  if  X  is\r\n%    badly conditioned.  It was partly for this reason that the case p\r\n%    = 1 is included in the general case.  Comparison of A**1  with  A\r\n%    gives some idea of the loss of accuracy for other values of p and\r\n%    for the elementary functions.\r\n%    \r\n%         RREF, the reduced row echelon form, is of some  interest  in\r\n%    theoretical  linear algebra, although it has little computational\r\n%    value.  It is included in MATLAB for  pedagogical  reasons.   The\r\n%    algorithm  is essentially Gauss-Jordan elimination with detection\r\n%    of negligible columns applied to rectangular matrices.\r\n%    \r\n%         There are three separate places in MATLAB where the rank  of\r\n%    a  matrix  is  implicitly  computed:  in RREF(A), in A\\B for non-\r\n%    square A, and in  the  pseudoinverse  PINV(A).   Three  different\r\n%    algorithms  with  three  different criteria for negligibility are\r\n%    used and so it is possible that three different values  could  be\r\n%    produced for the same matrix.  With RREF(A), the rank of A is the\r\n%    number of nonzero rows.  The elimination algorithm used for  RREF\r\n%    is  the  fastest of the three rank-determining algorithms, but it\r\n%    is the least sophisticated numerically and  the  least  reliable.\r\n%    With  A\\B,  the  algorithm  is  essentially  that used by example\r\n%    subroutine SQRST  in  chapter  9  of  the  LINPACK  guide.   With\r\n%    PINV(A),   the   algorithm   is   based  on  the  singular  value\r\n%    decomposition and is described  in  chapter  11  of  the  LINPACK\r\n%    guide.   The  SVD  algorithm  is the most time-consuming, but the\r\n%    most reliable and is therefore also used for RANK(A).\r\n%    \r\n%         The  uniformly  distributed  random  numbers  in  RAND   are\r\n%    obtained  from  the  machine-independent  random number generator\r\n%    URAND described in [9].  It is possible  to  switch  to  normally\r\n%    distributed   random   numbers,   which   are  obtained  using  a\r\n%    transformation also described in [9].\r\n%    \r\n%         The computation of\r\n%    \r\n%                    2    2\r\n%              sqrt(a  + b )\r\n%    \r\n%    is  required  in  many  matrix  algorithms,  particularly   those\r\n%    involving  complex  arithmetic.   A  new approach to carrying out\r\n%    this operation is described by Moler and Morrison [10].  It is  a\r\n%    cubically  convergent  algorithm  which  starts with  a  and  b ,\r\n%    rather than with their squares, and  thereby  avoids  destructive\r\n%    arithmetic underflows and overflows.  In MATLAB, the algorithm is\r\n%    used for complex modulus, Euclidean vector norm, plane rotations,\r\n%    and  the  shift  calculation in the eigenvalue and singular value\r\n%    iterations.\r\n   \r\n    \r\n%% 12.  FLOP and CHOP\r\n%    \r\n%         Detailed information about the amount of  work  involved  in\r\n%    matrix  calculations  and  the  resulting accuracy is provided by\r\n%    FLOP and CHOP.  The basic unit of work is the \"flop\", or floating\r\n%    point operation.  Roughly, one flop is one execution of a Fortran\r\n%    statement like\r\n%    \r\n%          S = S + X(I)*Y(I)\r\n%    \r\n%    or\r\n%    \r\n%          Y(I) = Y(I) + T*X(I)\r\n%    \r\n%    In other words, it consists of one floating point multiplication,\r\n%    together  with  one  floating  point  addition and the associated\r\n%    indexing and storage reference operations.\r\n%    \r\n%         MATLAB will  print  the  number  of  flops  required  for  a\r\n%    particular statement when the statement is terminated by an extra\r\n%    comma.  For example, the line\r\n%    \r\n%          n = 20;  RAND(n)*RAND(n);,\r\n%    \r\n%    ends with an extra comma.  Two  20  by  20  random  matrices  are\r\n%    generated  and  multiplied  together.   The result is assigned to\r\n%    ANS, but the semicolon suppresses its printing.  The only  output\r\n%    is\r\n%    \r\n%            8800 flops\r\n%    \r\n%    This is  n**3 + 2*n**2  flops,  n**2  for each random matrix  and\r\n%    n**3 for the product.\r\n%    \r\n%         FLOP is a predefined vector with two components.  FLOP(1) is\r\n%    the number of flops used by the most recently executed statement,\r\n%    except that statements with zero flops are ignored.  For example,\r\n%    after executing the previous statement,\r\n%    \r\n%          flop(1)\/n**3\r\n%    \r\n%    results in\r\n%    \r\n%          ANS   =\r\n%    \r\n%              1.1000\r\n%    \r\n%    \r\n%         FLOP(2) is the cumulative total of all the flops used  since\r\n%    the beginning of the MATLAB session.  The statement\r\n%    \r\n%          FLOP = <0 0>\r\n%    \r\n%    resets the total.\r\n%    \r\n%         There are several difficulties  associated  with  keeping  a\r\n%    precise  count  of  floating  point  operations.  An  addition or\r\n%    subtraction that is not paired with a multiplication  is  usually\r\n%    counted as a flop. The same is true of an isolated multiplication\r\n%    that is  not  paired  with  an  addition.   Each  floating  point\r\n%    division counts as a flop.  But the number of operations required\r\n%    by system dependent library functions such as square root  cannot\r\n%    be  counted, so most elementary functions are arbitrarily counted\r\n%    as using only one flop.\r\n%    \r\n%         The  biggest  difficulty  occurs  with  complex  arithmetic.\r\n%    Almost  all operations on the real parts of matrices are counted.\r\n%    However, the operations on the  complex  parts  of  matrices  are\r\n%    counted only when they involve nonzero elements.  This means that\r\n%    simple operations on nonreal matrices require only about twice as\r\n%    many  flops as the same operations on real matrices.  This factor\r\n%    of two is not necessarily an accurate  measure  of  the  relative\r\n%    costs of real and complex arithmetic.\r\n%    \r\n%         The result of each floating  point  operation  may  also  be\r\n%    \"chopped\" to simulate a computer with a shorter word length.  The\r\n%    details of this chopping operation depend upon the format of  the\r\n%    floating point word.  Usually, the fraction in the floating point\r\n%    word  can  be  regarded  as  consisting  of  several   octal   or\r\n%    hexadecimal digits.  The least significant of these digits can be\r\n%    set to zero by a logical masking operation.  Thus the statement\r\n%    \r\n%          CHOP(p)\r\n%    \r\n%    causes the  p  least significant octal or hexadecimal  digits  in\r\n%    the  result  of  each floating point operation to be set to zero.\r\n%    For example, if the computer being  used  has  an  IBM  360  long\r\n%    floating  point  word with 14 hexadecimal digits in the fraction,\r\n%    then CHOP(8) results in simulation of  a  computer  with  only  6\r\n%    hexadecimal  digits  in the fraction, i.e. a short floating point\r\n%    word. On a computer such as the CDC 6600 with  16  octal  digits,\r\n%    CHOP(8)  results in about the same accuracy because the remaining\r\n%    8 octal digits represent the same number of bits as 6 hexadecimal\r\n%    digits.\r\n%    \r\n%         Some idea of the effect of CHOP on any particular system can\r\n%    be obtained by executing the following statements.\r\n%    \r\n%          long,   t = 1\/10\r\n%          long z, t = 1\/10\r\n%          chop(8)\r\n%          long,   t = 1\/10\r\n%          long z, t = 1\/10\r\n%    \r\n%    \r\n%         The following Fortran subprograms illustrate more details of\r\n%    FLOP  and CHOP. The first subprogram is a simplified example of a\r\n%    system-dependent function used within MATLAB itself.  The  common\r\n%    variable  FLP  is essentially the first component of the variable\r\n%    FLOP.  The common variable CHP is initially zero, but it  is  set\r\n%    to  p  by the statement  CHOP(p).  To shorten the DATA statement,\r\n%    we assume there are only 6 hexadecimal digits.  We also assume an\r\n%    extension  of  Fortran  that  allows .AND. to be used as a binary\r\n%    operation between two real variables.\r\n%    \r\n%          REAL FUNCTION FLOP(X)\r\n%          REAL X\r\n%          INTEGER FLP,CHP\r\n%          COMMON FLP,CHP\r\n%          REAL MASK(5)\r\n%          DATA MASK\/ZFFFFFFF0,ZFFFFFF00,ZFFFFF000,ZFFFF0000,ZFFF00000\/\r\n%          FLP = FLP + 1\r\n%          IF (CHP .EQ. 0) FLOP = X\r\n%          IF (CHP .GE. 1 .AND. CHP .LE. 5) FLOP = X .AND. MASK(CHP)\r\n%          IF (CHP .GE. 6) FLOP = 0.0\r\n%          RETURN\r\n%          END\r\n%    \r\n%    \r\n%         The following subroutine illustrates a typical  use  of  the\r\n%    previous  function  within MATLAB.  It is a simplified version of\r\n%    the Basic Linear Algebra Subprogram that adds a  scalar  multiple\r\n%    of  one  vector  to another.  We assume here that the vectors are\r\n%    stored with a memory increment of one.\r\n%    \r\n%          SUBROUTINE SAXPY(N,TR,TI,XR,XI,YR,YI)\r\n%          REAL TR,TI,XR(N),XI(N),YR(N),YI(N),FLOP\r\n%          IF (N .LE. 0) RETURN\r\n%          IF (TR .EQ. 0.0 .AND. TI .EQ. 0.0) RETURN\r\n%          DO 10 I = 1, N\r\n%             YR(I) = FLOP(YR(I) + TR*XR(I) - TI*XI(I))\r\n%             YI(I) = YI(I) + TR*XI(I) + TI*XR(I)\r\n%             IF (YI(I) .NE. 0.0D0) YI(I) = FLOP(YI(I))\r\n%       10 CONTINUE\r\n%          RETURN\r\n%          END\r\n%    \r\n%    \r\n%         The  saxpy  operation  is  perhaps  the   most   fundamental\r\n%    operation  within  LINPACK.  It is used in the computation of the\r\n%    LU, the QR and the  SVD  factorizations,  and  in  several  other\r\n%    places.   We  see  that  adding  a  multiple of one vector with n\r\n%    components to another uses n flops if the vectors  are  real  and\r\n%    between  n  and  2*n  flops if the vectors have nonzero imaginary\r\n%    components.\r\n%    \r\n%         The permanent MATLAB variable EPS is reset by the  statement\r\n%    CHOP(p).   Its new value is usually the smallest inverse power of\r\n%    two that satisfies the Fortran logical test\r\n%    \r\n%                FLOP(1.0+EPS) .GT. 1.0\r\n%    \r\n%    However, if EPS had been directly reset to a  larger  value,  the\r\n%    old value is retained.\r\n\r\n    \r\n%% 13.  Communicating with other programs\r\n%    \r\n%         There  are  four  different  ways  MATLAB  can  be  used  in\r\n%    conjunction with other programs:\r\n%          REPLACE_WITH_DASH_DASH USER,\r\n%          REPLACE_WITH_DASH_DASH EXEC,\r\n%          REPLACE_WITH_DASH_DASH SAVE and LOAD,\r\n%          REPLACE_WITH_DASH_DASH MATZ, CALL and RETURN .\r\n%    \r\n%         Let us illustrate each of  these  by  the  following  simple\r\n%    example.\r\n%    \r\n%          n = 6\r\n%          for i = 1:n, for j = 1:n, a(i,j) = abs(i-j);\r\n%          A\r\n%          X = inv(A)\r\n%    \r\n%    \r\n%         The example  A  could be introduced into MATLAB  by  writing\r\n%    the following Fortran subroutine.\r\n%    \r\n%             SUBROUTINE USER(A,M,N,S,T)\r\n%             DOUBLE PRECISION A(1),S,T\r\n%             N = IDINT(A(1))\r\n%             M = N\r\n%             DO 10 J = 1, N\r\n%             DO 10 I = 1, N\r\n%                K = I + (J-1)*M\r\n%                A(K) = IABS(I-J)\r\n%          10 CONTINUE\r\n%             RETURN\r\n%             END\r\n%    \r\n%    This subroutine should be compiled  and  linked  into  MATLAB  in\r\n%    place   of  the  original  version  of  USER.   Then  the  MATLAB\r\n%    statements\r\n%    \r\n%          n = 6\r\n%          A = user(n)\r\n%          X = inv(A)\r\n%    \r\n%    do the job.\r\n%    \r\n%         The example A could be generated by  storing  the  following\r\n%    text in a file named, say, EXAMPLE .\r\n%    \r\n%          for i = 1:n, for j = 1:n, a(i,j) = abs(i-j);\r\n%    \r\n%    Then the MATLAB statements\r\n%    \r\n%          n = 6\r\n%          exec('EXAMPLE',0)\r\n%          X = inv(A)\r\n%    \r\n%    have the desired effect.  The 0 as the optional second  parameter\r\n%    of exec indicates that the text in the file should not be printed\r\n%    on the terminal.\r\n%    \r\n%         The matrices A and X could also be  stored  in  files.   Two\r\n%    separate main programs would be involved.  The first is:\r\n%    \r\n%             PROGRAM MAINA\r\n%             DOUBLE PRECISION A(10,10)\r\n%             N = 6\r\n%             DO 10 J = 1, N\r\n%             DO 10 I = 1, N\r\n%                A(I,J) = IABS(I-J)\r\n%          10 CONTINUE\r\n%             OPEN(UNIT=1,FILE='A')\r\n%             WRITE(1,101) N,N\r\n%         101 FORMAT('A   ',2I4)\r\n%             DO 20 J = 1, N\r\n%                WRITE(1,102) (A(I,J),I=1,N)\r\n%          20 CONTINUE\r\n%         102 FORMAT(4Z18)\r\n%             END\r\n%    \r\n%    The OPEN statement may take different forms on different systems.\r\n%    It  attaches  Fortran  logical unit number 1 to the file named A.\r\n%    The FORMAT  number  102  may  also  be  system  dependent.   This\r\n%    particular one is appropriate for hexadecimal computers with an 8\r\n%    byte double precision floating point  word.   Check,  or  modify,\r\n%    MATLAB subroutine SAVLOD.\r\n%    \r\n%         After this program is executed, enter MATLAB  and  give  the\r\n%    following statements:\r\n%    \r\n%          load('A')\r\n%          X = inv(A)\r\n%          save('X',X)\r\n%    \r\n%    If all goes according to plan, this will read the matrix  A  from\r\n%    the  file A, invert it, store the inverse in X and then write the\r\n%    matrix X on the file X .  The following program can then access X\r\n%    .\r\n%    \r\n%             PROGRAM MAINX\r\n%             DOUBLE PRECISION X(10,10)\r\n%             OPEN(UNIT=1,FILE='X')\r\n%             REWIND 1\r\n%             READ (1,101) ID,M,N\r\n%         101 FORMAT(A4,2I4)\r\n%             DO 10 J = 1, N\r\n%                READ(1,102) (X(I,J),I=1,M)\r\n%          10 CONTINUE\r\n%         102 FORMAT(4Z18)\r\n%             ...\r\n%             ...\r\n%    \r\n%    \r\n%         The most elaborate mechanism  involves  using  MATLAB  as  a\r\n%    subroutine within another program.  Communication with the MATLAB\r\n%    stack is accomplished using subroutine MATZ which is  distributed\r\n%    with  MATLAB,  but  which  is  not  used  by  MATLAB itself.  The\r\n%    preample of MATZ is:\r\n%    \r\n%          SUBROUTINE MATZ(A,LDA,M,N,IDA,JOB,IERR)\r\n%          INTEGER LDA,M,N,IDA(1),JOB,IERR\r\n%          DOUBLE PRECISION A(LDA,N)\r\n%    C\r\n%    C     ACCESS MATLAB VARIABLE STACK\r\n%    C     A IS AN M BY N MATRIX, STORED IN AN ARRAY WITH\r\n%    C         LEADING DIMENSION LDA.\r\n%    C     IDA IS THE NAME OF A.\r\n%    C         IF IDA IS AN INTEGER K LESS THAN 10, THEN THE NAME IS 'A'K\r\n%    C         OTHERWISE, IDA(1:4) IS FOUR CHARACTERS, FORMAT 4A1.\r\n%    C     JOB =  0  GET REAL A FROM MATLAB,\r\n%    C         =  1  PUT REAL A INTO MATLAB,\r\n%    C         = 10  GET IMAG PART OF A FROM MATLAB,\r\n%    C         = 11  PUT IMAG PART OF A INTO MATLAB.\r\n%    C     RETURN WITH NONZERO IERR AFTER MATLAB ERROR MESSAGE.\r\n%    C\r\n%    C     USES MATLAB ROUTINES STACKG, STACKP AND ERROR\r\n%    \r\n%    \r\n%         The preample of subroutine MATLAB is:\r\n%    \r\n%    \r\n%          SUBROUTINE MATLAB(INIT)\r\n%    C     INIT = 0 FOR FIRST ENTRY, NONZERO FOR SUBSEQUENT ENTRIES\r\n%    \r\n%    \r\n%         To do our example, write the following program:\r\n%    \r\n%             DOUBLE PRECISION A(10,10),X(10,10)\r\n%             INTEGER IDA(4),IDX(4)\r\n%             DATA LDA\/10\/\r\n%             DATA IDA\/'A',' ',' ',' '\/, IDX\/'X',' ',' ',' '\/\r\n%             CALL MATLAB(0)\r\n%             N = 6\r\n%             DO 10 J = 1, N\r\n%             DO 10 I = 1, N\r\n%                A(I,J) = IABS(I-J)\r\n%          10 CONTINUE\r\n%             CALL MATZ(A,LDA,N,N,IDA,1,IERR)\r\n%             IF (IERR .NE. 0) GO TO ...\r\n%             CALL MATLAB(1)\r\n%             CALL MATZ(X,LDA,N,N,IDX,0,IERR)\r\n%             IF (IERR .NE. 0) GO TO ...\r\n%             ...\r\n%             ...\r\n%    \r\n%    When this program is executed, the call to MATLAB(0) produces the\r\n%    MATLAB greeting, then waits for input.  The command\r\n%    \r\n%             return\r\n%    \r\n%    sends control back to our  example  program.   The  matrix  A  is\r\n%    generated  by the program and sent to the stack by the first call\r\n%    to MATZ.  The call to MATLAB(1) produces the MATLAB prompt.  Then\r\n%    the statements\r\n%    \r\n%             X = inv(A)\r\n%             return\r\n%    \r\n%    will invert our matrix, put the result on the stack and  go  back\r\n%    to our program.  The second call to MATZ will retrieve X .\r\n%    \r\n%         By the way, this matrix  X  is interesting. Take a  look  at\r\n%    round(2*(n-1)*X).\r\n%    \r\n%    \r\n%    \r\n%    References\r\n%    \r\n%    [1]  J. J. Dongarra, J. R. Bunch, C. B. Moler and G. W.  Stewart,\r\n%         LINPACK  Users'  Guide,  Society  for Industrial and Applied\r\n%         Mathematics, Philadelphia, 1979.\r\n%    \r\n%    [2]  B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S.  Garbow,  Y.\r\n%         Ikebe, V. C. Klema, C. B. Moler, Matrix Eigensystem Routines\r\n%         REPLACE_WITH_DASH_DASH EISPACK Guide, Lecture Notes in Computer Science,  volume\r\n%         6, second edition, Springer-Verlag, 1976.\r\n%    \r\n%    [3]  B. S. Garbow, J. M. Boyle, J.  J.  Dongarra,  C.  B.  Moler,\r\n%         Matrix  Eigensystem  Routines  REPLACE_WITH_DASH_DASH  EISPACK  Guide Extension,\r\n%         Lecture Notes in  Computer  Science,  volume  51,  Springer-\r\n%         Verlag, 1977.\r\n%    [4]  S. Cohen and  S.  Piper,  SPEAKEASY  III  Reference  Manual,\r\n%         Speakeasy Computing Corp., Chicago, Ill., 1979.\r\n%    \r\n%    [5]  J. H. Wilkinson  and  C.  Reinsch,  Handbook  for  Automatic\r\n%         Computation,  volume  II,  Linear  Algebra, Springer-Verlag,\r\n%         1971.\r\n%    \r\n%    [6]  Niklaus Wirth, Algorithms  +  Data  Structures  =  Programs,\r\n%         Prentice-Hall, 1976.\r\n%    \r\n%    [7]  H. B. Keller and D. Sachs, \"Calculations of the Conductivity\r\n%         of  a  Medium Containing Cylindrical Inclusions\", J. Applied\r\n%         Physics 35, 537-538, 1964.\r\n%    \r\n%    [8]  C. B. Moler and C. F. Van Loan,  Nineteen  Dubious  Ways  to\r\n%         Compute  the  Exponential  of a Matrix, SIAM Review 20, 801-\r\n%         836, 1979.\r\n%    \r\n%    [9]  G. E. Forsythe, M. A. Malcolm  and  C.  B.  Moler,  Computer\r\n%         Methods for Mathematical Computations, Prentice-Hall, 1977.\r\n%    \r\n%    [10] C. B. Moler and D. R. Morrison, \"Replacing square  roots  by\r\n%         Pythagorean   sums\",  University  of  New  Mexico,  Computer\r\n%         Science  Department,   technical   report,   submitted   for\r\n%         publication, 1980.\r\n    \r\n   \r\n%% Appendix.  The HELP document\r\n%    \r\n%    NEWS  MATLAB NEWS dated May, 1981.\r\n%          This describes recent or local changes.\r\n%          The new features added since the November,  1980,  printing\r\n%          of the Users' Guide include DIARY, EDIT, KRON, MACRO, PLOT,\r\n%          RAT, TRIL, TRIU and six element-by-element operations:\r\n%                .*   .\/   .\\   .*.   .\/.   .\\.\r\n%          Some additional  capabilities  have  been  added  to  EXIT,\r\n%          RANDOM, RCOND, SIZE and SVD.\r\n%    \r\n%    INTRO Welcome to MATLAB.\r\n%    \r\n%          Here are a few sample statements:\r\n%    \r\n%          A = <1 2; 3 4>\r\n%          b = <5 6>'\r\n%          x = A\\b\r\n%          <V,D> = eig(A),  norm(A-V*D\/V)\r\n%          help \\ , help eig\r\n%          exec('demo',7)\r\n%    \r\n%          For more information, see the MATLAB Users' Guide which  is\r\n%          contained in file ...  or may be obtained from ... .\r\n%    \r\n%    HELP  HELP gives assistance.\r\n%          HELP HELP obviously prints this message.\r\n%          To see all the HELP messages, list the file ... .\r\n%    \r\n%    <     < > Brackets used in forming vectors and matrices.\r\n%          <6.9  9.64  SQRT(-1)>  is  a  vector  with  three  elements\r\n%          separated  by  blanks.   <6.9,  9.64, sqrt(-1)> is the same\r\n%          thing.  <1+I 2-I 3>  and  <1 +I 2 -I 3>  are not the  same.\r\n%          The first has three elements, the second has five.\r\n%          <11 12 13; 21 22 23>  is a 2 by 3 matrix .   The  semicolon\r\n%          ends the first row.\r\n%    \r\n%          Vectors and matrices can be used inside < > brackets.\r\n%          <A B; C>  is allowed if the number of rows  of   A   equals\r\n%          the  number  of rows of  B  and the number of columns of  A\r\n%          plus the number of columns of   B   equals  the  number  of\r\n%          columns  of   C  .   This  rule  generalizes in a hopefully\r\n%          obvious way to allow fairly complicated constructions.\r\n%    \r\n%          A = < >  stores an empty matrix in  A , thereby removing it\r\n%          from the list of current variables.\r\n%    \r\n%          For the use of < and > on the left of  the  =  in  multiple\r\n%          assignment statements, see LU, EIG, SVD and so on.\r\n%    \r\n%          In WHILE and IF clauses, <>  means  less  than  or  greater\r\n%          than,  i.e.  not  equal, < means less than, > means greater\r\n%          than, <= means less than or equal, >= means greater than or\r\n%          equal.\r\n%    \r\n%          For the use of > and < to delineate macros, see MACRO.\r\n%    \r\n%    >     See < .  Also see MACRO.\r\n%    \r\n%    (     ( ) Used to indicate precedence in  arithmetic  expressions\r\n%          in  the  usual way.  Used to enclose arguments of functions\r\n%          in the usual way.  Used to enclose  subscripts  of  vectors\r\n%          and  matrices  in  a  manner somewhat more general than the\r\n%          usual way.  If  X   and   V  are  vectors,  then   X(V)  is\r\n%          <X(V(1)),  X(V(2)),  ...,  X(V(N))> .  The components of  V\r\n%          are rounded to nearest integers and used as subscripts.  An\r\n%          error  occurs  if  any  such  subscript  is  less than 1 or\r\n%          greater than the dimension of  X .  Some examples:\r\n%          X(3)  is the third element of  X .\r\n%          X(<1 2 3>)  is the first three elements of  X .  So is\r\n%          X(<SQRT(2), SQRT(3), 4*ATAN(1)>)  .\r\n%          If  X  has  N  components,  X(N:-1:1) reverses them.\r\n%          The same indirect subscripting is used in matrices.  If   V\r\n%          has   M  components and  W  has  N  components, then A(V,W)\r\n%          is the  M by N  matrix formed from the elements of A  whose\r\n%          subscripts are the elements of  V  and  W .  For example...\r\n%          A(<1,5>,:) = A(<5,1>,:)  interchanges rows 1 and 5 of  A .\r\n%    \r\n%    )     See  ( .\r\n%    \r\n%    =     Used in assignment statements and to mean equality in WHILE\r\n%          and IF clauses.\r\n%    \r\n%    .     Decimal point.  314\/100, 3.14  and   .314E1   are  all  the\r\n%          same.\r\n%    \r\n%          Element-by-element multiplicative operations  are  obtained\r\n%          using  .*  ,  .\/  , or .\\ .  For example, C = A .\/ B is the\r\n%          matrix with elements  c(i,j) = a(i,j)\/b(i,j) .\r\n%    \r\n%          Kronecker tensor products and quotients are  obtained  with\r\n%          .*. , .\/.  and .\\. .  See KRON.\r\n%    \r\n%          Two or  more  points  at  the  end  of  the  line  indicate\r\n%          continuation.    The   total  line  length  limit  is  1024\r\n%          characters.\r\n%    \r\n%    ,     Used to separate matrix subscripts and function  arguments.\r\n%          Used  at  the  end  of  FOR, WHILE and IF clauses.  Used to\r\n%          separate statements  in  multi-statement  lines.   In  this\r\n%          situation,  it  may  be  replaced  by semicolon to suppress\r\n%          printing.\r\n%    \r\n%    ;     Used inside brackets to end rows.\r\n%          Used after an expression or statement to suppress printing.\r\n%          See SEMI.\r\n%    \\     Backslash or matrix left division.   A\\B   is  roughly  the\r\n%          same  as   INV(A)*B  , except it is computed in a different\r\n%          way.  If  A  is an N by N matrix and  B  is a column vector\r\n%          with  N  components, or a matrix with several such columns,\r\n%          then X = A\\B  is the solution to  the  equation   A*X  =  B\r\n%          computed  by  Gaussian  elimination.   A warning message is\r\n%          printed if  A is badly scaled or nearly singular.\r\n%          A\\EYE produces the inverse of  A .\r\n%    \r\n%          If  A  is an  M by N  matrix with  M < or > N  and  B  is a\r\n%          column vector with  M  components, or a matrix with several\r\n%          such columns, then  X = A\\B  is the solution in  the  least\r\n%          squares  sense  to  the under- or overdetermined system  of\r\n%          equations A*X = B .  The  effective  rank,  K,  of   A   is\r\n%          determined  from  the  QR  decomposition  with pivoting.  A\r\n%          solution  X  is  computed  which  has  at  most  K  nonzero\r\n%          components  per column.  If  K < N this will usually not be\r\n%          the same solution as PINV(A)*B .\r\n%          A\\EYE produces a generalized inverse of  A .\r\n%    \r\n%          If A and B have the  same  dimensions,  then  A  .\\  B  has\r\n%          elements a(i,j)\\b(i,j) .\r\n%    \r\n%          Also, see EDIT.\r\n%    \r\n%    \/     Slash or matrix right division.  B\/A  is roughly  the  same\r\n%          as  B*INV(A) .  More precisely,  B\/A = (A'\\B')' .  See \\ .\r\n%    \r\n%          IF A and B have the  same  dimensions,  then  A  .\/  B  has\r\n%          elements a(i,j)\/b(i,j) .\r\n%    \r\n%          Two or more slashes together on a line indicate  a  logical\r\n%          end of line.  Any following text is ignored.\r\n%    \r\n%    '     Transpose.  X'  is the complex conjugate transpose of  X  .\r\n%          Quote.   'ANY  TEXT'   is a vector whose components are the\r\n%          MATLAB internal codes for the characters.  A  quote  within\r\n%          the text is indicated by two quotes.  See DISP and FILE .\r\n%    \r\n%    +     Addition.  X + Y .  X and Y must have the same dimensions.\r\n%    \r\n%    -     Subtraction.  X  -  Y  .   X  and  Y  must  have  the  same\r\n%          dimensions.\r\n%    \r\n%    *     Matrix multiplication, X*Y .  Any scalar (1  by  1  matrix)\r\n%          may multiply anything.  Otherwise, the number of columns of\r\n%          X must equal the number of rows of Y .\r\n%    \r\n%          Element-by-element multiplication is obtained with X .* Y .\r\n%    \r\n%          The Kronecker tensor product is denoted by X .*. Y .\r\n%    \r\n%          Powers.  X**p  is  X  to the   p   power.   p   must  be  a\r\n%          scalar.  If  X  is a matrix, see  FUN .\r\n%    \r\n%    :     Colon.  Used in subscripts,  FOR  iterations  and  possibly\r\n%          elsewhere.\r\n%          J:K  is the same as  <J, J+1, ..., K>\r\n%          J:K  is empty if  J > K .\r\n%          J:I:K  is the same as  <J, J+I, J+2I, ..., K>\r\n%          J:I:K  is empty if  I > 0 and J > K or if I < 0 and J < K .\r\n%          The colon notation can be used to pick out  selected  rows,\r\n%          columns and elements of vectors and matrices.\r\n%          A(:)  is all the  elements  of  A,  regarded  as  a  single\r\n%          column.\r\n%          A(:,J)  is the  J-th  column of A\r\n%          A(J:K)  is  A(J),A(J+1),...,A(K)\r\n%          A(:,J:K)  is  A(:,J),A(:,J+1),...,A(:,K) and so on.\r\n%          For the use of the colon in the FOR statement, See FOR .\r\n%    \r\n%    ABS   ABS(X)  is the absolute value, or complex modulus,  of  the\r\n%          elements of X .\r\n%    \r\n%    ANS   Variable created automatically  when  expressions  are  not\r\n%          assigned to anything else.\r\n%    \r\n%    ATAN  ATAN(X)  is the arctangent of  X .  See FUN .\r\n%    \r\n%    BASE  BASE(X,B) is a vector containing the base B  representation\r\n%          of   X  .   This is often used in conjunction with DISPLAY.\r\n%          DISPLAY(X,B)  is  the  same  as  DISPLAY(BASE(X,B)).    For\r\n%          example,    DISP(4*ATAN(1),16)   prints   the   hexadecimal\r\n%          representation of pi.\r\n%    \r\n%    CHAR  CHAR(K)  requests  an  input  line  containing   a   single\r\n%          character  to  replace  MATLAB  character  number  K in the\r\n%          following table.  For example, CHAR(45) replaces backslash.\r\n%          CHAR(-K) replaces the alternate character number K.\r\n%    \r\n%                    K  character alternate name\r\n%                  0 - 9   0 - 9    0 - 9   digits\r\n%                 10 - 35  A - Z    a - z   letters\r\n%                   36                      blank\r\n%                   37       (        (     lparen\r\n%                   38       )        )     rparen\r\n%                   39       ;        ;     semi\r\n%                   40       :        |     colon\r\n%                   41       +        +     plus\r\n%                   42       -        -     minus\r\n%                   43       *        *     star\r\n%                   44       \/        \/     slash\r\n%                   45       \\        $     backslash\r\n%                   46       =        =     equal\r\n%                   47       .        .     dot\r\n%                   48       ,        ,     comma\r\n%                   49       '        \"     quote\r\n%                   50       <        [     less\r\n%                   51       >        ]     great\r\n%    \r\n%    CHOL  Cholesky factorization.  CHOL(X)  uses  only  the  diagonal\r\n%          and upper triangle of  X .  The lower triangular is assumed\r\n%          to be the (complex conjugate) transpose of the  upper.   If\r\n%          X   is  positive  definite,  then  R = CHOL(X)  produces an\r\n%          upper triangular  R  so that  R'*R = X .   If   X   is  not\r\n%          positive definite, an error message is printed.\r\n%    \r\n%    CHOP  Truncate arithmetic.  CHOP(P) causes P places to be chopped\r\n%          off   after   each   arithmetic   operation  in  subsequent\r\n%          computations.  This means  P  hexadecimal  digits  on  some\r\n%          computers  and  P octal digits on others.  CHOP(0) restores\r\n%          full precision.\r\n%    \r\n%    CLEAR Erases all variables, except EPS, FLOP, EYE and RAND.\r\n%          X = <>  erases only variable  X .  So does CLEAR X .\r\n%    \r\n%    COND  Condition number in 2-norm.  COND(X) is the  ratio  of  the\r\n%          largest singular value of  X  to the smallest.\r\n%    \r\n%    CONJG CONJG(X)  is the complex conjugate of  X .\r\n%    \r\n%    COS   COS(X)  is the cosine of  X .  See FUN .\r\n%    \r\n%    DET   DET(X)  is the determinant of the square matrix  X .\r\n%    \r\n%    DIAG  If  V  is  a  row  or  column  vector  with  N  components,\r\n%          DIAG(V,K)   is a square matrix of order  N+ABS(K)  with the\r\n%          elements of  V  on the K-th diagonal.  K = 0  is  the  main\r\n%          diagonal,  K  >  0  is above the main diagonal and K < 0 is\r\n%          below the main diagonal.  DIAG(V)  simply puts  V   on  the\r\n%          main diagonal.\r\n%          eg. DIAG(-M:M) + DIAG(ONES(2*M,1),1) + DIAG(ONES(2*M,1),-1)\r\n%          produces a tridiagonal matrix of order 2*M+1 .\r\n%          IF  X  is a matrix,  DIAG(X,K)  is a column  vector  formed\r\n%          from the elements of the K-th diagonal of  X .\r\n%          DIAG(X)  is the main diagonal of  X .\r\n%          DIAG(DIAG(X))  is a diagonal matrix .\r\n%    \r\n%    DIARY DIARY('file') causes a  copy  of  all  subsequent  terminal\r\n%          input and most of the resulting output to be written on the\r\n%          file. DIARY(0) turns it off.  See FILE.\r\n%    \r\n%    DISP  DISPLAY(X) prints X  in  a  compact  format.   If  all  the\r\n%          elements  of  X  are  integers  between 0 and 51, then X is\r\n%          interpreted  as  MATLAB  text  and   printed   accordingly.\r\n%          Otherwise,  +  ,  -   and  blank  are printed for positive,\r\n%          negative and zero elements.  Imaginary parts are ignored.\r\n%          DISP(X,B) is the same as DISP(BASE(X,B)).\r\n%    \r\n%    EDIT  There  are  no   editing   features   available   on   most\r\n%          installations and EDIT is not a command.  However, on a few\r\n%          systems a command line consisting of a single  backslash  \\\r\n%          will  cause  the local file editor to be called with a copy\r\n%          of the  previous  input  line.   When  the  editor  returns\r\n%          control to MATLAB, it will execute the line again.\r\n%    \r\n%    EIG   Eigenvalues and eigenvectors.\r\n%          EIG(X) is a vector containing the eigenvalues of  a  square\r\n%          matrix  X .\r\n%          <V,D>  =  EIG(X)   produces  a  diagonal  matrix    D    of\r\n%          eigenvalues  and  a  full  matrix  V  whose columns are the\r\n%          corresponding eigenvectors so that  X*V = V*D .\r\n%    \r\n%    ELSE  Used with IF .\r\n%    \r\n%    END   Terminates the scope  of  FOR,  WHILE  and  IF  statements.\r\n%          Without  END's,  FOR  and WHILE repeat all statements up to\r\n%          the end of the line.  Each END is paired with  the  closest\r\n%          previous  unpaired FOR or WHILE and serves to terminate its\r\n%          scope.  The line\r\n%          FOR I=1:N, FOR J=1:N, A(I,J)=1\/(I+J-1); A\r\n%          would cause A to be printed  N**2  times, once for each new\r\n%          element.  On the other hand, the line\r\n%          FOR I=1:N, FOR J=1:N, A(I,J)=1\/(I+J-1); END, END, A\r\n%          will lead to only the final printing of  A .\r\n%          Similar considerations apply to WHILE.\r\n%          EXIT terminates execution of loops or of MATLAB itself.\r\n%    \r\n%    EPS   Floating point relative  accuracy.   A  permanent  variable\r\n%          whose  value is initially the distance from 1.0 to the next\r\n%          largest floating point number.  The  value  is  changed  by\r\n%          CHOP,  and  other values may be assigned.  EPS is used as a\r\n%          default tolerance by PINV and RANK.\r\n%    \r\n%    EXEC  EXEC('file',k) obtains  subsequent  MATLAB  input  from  an\r\n%          external  file.  The printing of input is controlled by the\r\n%          optional parameter k .\r\n%          If k = 1 , the input is echoed.\r\n%          If k = 2 , the MATLAB prompt <> is printed.\r\n%          If k = 4 , MATLAB pauses before each prompt and waits for a\r\n%          null line to continue.\r\n%          If k = 0 , there is no echo, prompt or pause.  This is  the\r\n%          default if the exec command is followed by a semicolon.\r\n%          If k = 7 , there will be echos, prompts and pauses. This is\r\n%          useful for demonstrations on video terminals.\r\n%          If k = 3 , there will be echos and prompts, but no  pauses.\r\n%          This is the the default if the exec command is not followed\r\n%          by a semicolon.\r\n%          EXEC(0) causes subsequent input to  be  obtained  from  the\r\n%          terminal. An end-of-file has the same effect.\r\n%          EXEC's may be nested, i.e. the text in the file may contain\r\n%          EXEC of another file.  EXEC's may also be driven by FOR and\r\n%          WHILE loops.\r\n%    EXIT  Causes termination of a FOR or WHILE loop.\r\n%          If not in a loop, terminates execution of MATLAB.\r\n%    \r\n%    EXP   EXP(X)  is the exponential of  X ,  e  to the X .  See  FUN\r\n%          .\r\n%    \r\n%    EYE   Identity matrix.  EYE(N) is the N  by  N  identity  matrix.\r\n%          EYE(M,N)   is an M by N matrix with 1's on the diagonal and\r\n%          zeros elsewhere.  EYE(A)  is the same size  as   A  .   EYE\r\n%          with  no  arguments is an identity matrix of whatever order\r\n%          is appropriate in the context.   For  example,  A  +  3*EYE\r\n%          adds  3  to each diagonal element of  A .\r\n%    \r\n%    FILE  The EXEC, SAVE, LOAD,  PRINT  and  DIARY  functions  access\r\n%          files.   The  'file'  parameter  takes  different forms for\r\n%          different operating systems.  On most systems,  'file'  may\r\n%          be a string of up to 32 characters in quotes.  For example,\r\n%          SAVE('A') or EXEC('matlab\/demo.exec') .  The string will be\r\n%          used as the name of a file in the local operating system.\r\n%          On all systems, 'file' may be a positive integer   k   less\r\n%          than  10  which  will  be  used  as  a FORTRAN logical unit\r\n%          number. Some systems then automatically access a file  with\r\n%          a  name  like  FORT.k  or FORk.DAT. Other systems require a\r\n%          file with a name like FT0kF001 to be assigned  to  unit   k\r\n%          before  MATLAB  is  executed. Check your local installation\r\n%          for details.\r\n%    \r\n%    FLOPS Count of floating point operations.\r\n%          FLOPS  is  a  permanently  defined  row  vector  with   two\r\n%          elements.    FLOPS(1)  is  the  number  of  floating  point\r\n%          operations counted during the previous statement.  FLOPS(2)\r\n%          is  a  cumulative total.  FLOPS can be used in the same way\r\n%          as any other vector.  FLOPS(2) = 0  resets  the  cumulative\r\n%          total.   In  addition,  FLOPS(1) will be printed whenever a\r\n%          statement is terminated by an extra comma.  For example,\r\n%          X = INV(A);,\r\n%          or\r\n%          COND(A),   (as the last statement on the line).\r\n%          HELP FLPS gives more details.\r\n%    \r\n%    FLPS  More detail on FLOPS.\r\n%          It is not feasible to count absolutely all  floating  point\r\n%          operations,  but  most  of  the important ones are counted.\r\n%          Each multiply and add in a real vector operation such as  a\r\n%          dot  product  or  a 'saxpy' counts one flop.  Each multiply\r\n%          and add in a complex vector  operation  counts  two  flops.\r\n%          Other additions, subtractions and multiplications count one\r\n%          flop each if the result is real and two flops if it is not.\r\n%          Real  divisions  count one and complex divisions count two.\r\n%          Elementary functions count one if real and two if  complex.\r\n%          Some examples.  If A and B are real N by N matrices, then\r\n%          A + B  counts N**2 flops,\r\n%          A*B    counts N**3 flops,\r\n%          A**100 counts 99*N**3 flops,\r\n%          LU(A)  counts roughly (1\/3)*N**3 flops.\r\n%    \r\n%    FOR   Repeat statements a specific number of times.\r\n%          FOR variable = expr, statement, ..., statement, END\r\n%          The END at the end of a line may  be  omitted.   The  comma\r\n%          before  the  END  may  also be omitted.  The columns of the\r\n%          expression are stored one at a time  in  the  variable  and\r\n%          then the following statements, up to the END, are executed.\r\n%          The expression is often of the form X:Y, in which case  its\r\n%          columns  are  simply  scalars.  Some examples (assume N has\r\n%          already been assigned a value).\r\n%          FOR I = 1:N, FOR J = 1:N, A(I,J) = 1\/(I+J-1);\r\n%          FOR J = 2:N-1, A(J,J) = J; END; A\r\n%          FOR S = 1.0: -0.1: 0.0, ...  steps S with increments of -0.1 .\r\n%          FOR E = EYE(N), ...   sets  E  to the unit N-vectors.\r\n%          FOR V = A, ...   has the same effect as\r\n%          FOR J = 1:N, V = A(:,J); ...  except J is also set here.\r\n%    \r\n%    FUN   For matrix arguments  X , the  functions  SIN,  COS,  ATAN,\r\n%          SQRT,  LOG,  EXP and X**p are computed using eigenvalues  D\r\n%          and eigenvectors  V .  If  <V,D> =  EIG(X)   then   f(X)  =\r\n%          V*f(D)\/V  .   This method may give inaccurate results if  V\r\n%          is badly conditioned.  Some idea of  the  accuracy  can  be\r\n%          obtained by comparing  X**1  with  X .\r\n%          For vector arguments,  the  function  is  applied  to  each\r\n%          component.\r\n%    \r\n%    HESS  Hessenberg form.  The Hessenberg form of a matrix  is  zero\r\n%          below the first subdiagonal.  If the matrix is symmetric or\r\n%          Hermitian,  the  form  is  tridiagonal.   <P,H>  =  HESS(A)\r\n%          produces  a  unitary  matrix P and a Hessenberg matrix H so\r\n%          that A = P*H*P'.  By itself, HESS(A) returns H.\r\n%    \r\n%    HILB  Inverse Hilbert matrix.  HILB(N)  is the inverse of  the  N\r\n%          by  N   matrix  with elements  1\/(i+j-1), which is a famous\r\n%          example of a badly conditioned matrix.  The result is exact\r\n%          for  N  less than about 15, depending upon the computer.\r\n%    \r\n%    IF    Conditionally execute statements.  Simple form...\r\n%          IF expression rop expression, statements\r\n%          where rop is =, <, >, <=, >=, or  <>  (not  equal)  .   The\r\n%          statements  are  executed  once if the indicated comparison\r\n%          between the real parts of the first components of  the  two\r\n%          expressions  is true, otherwise the statements are skipped.\r\n%          Example.\r\n%          IF ABS(I-J) = 1, A(I,J) = -1;\r\n%          More complicated forms use END in the same way it  is  used\r\n%          with FOR and WHILE and use ELSE as an abbreviation for END,\r\n%          IF expression not rop expression .  Example\r\n%          FOR I = 1:N, FOR J = 1:N, ...\r\n%             IF I = J, A(I,J) = 2; ELSE IF ABS(I-J) = 1, A(I,J) = -1; ...\r\n%             ELSE A(I,J) = 0;\r\n%          An easier way to accomplish the same thing is\r\n%          A = 2*EYE(N);\r\n%          FOR I = 1:N-1, A(I,I+1) = -1; A(I+1,I) = -1;\r\n%    \r\n%    IMAG  IMAG(X)  is the imaginary part of  X .\r\n%    \r\n%    INV   INV(X)  is the inverse of the square matrix  X .  A warning\r\n%          message  is  printed  if   X   is  badly  scaled  or nearly\r\n%          singular.\r\n%    \r\n%    KRON  KRON(X,Y) is the Kronecker tensor product of X and Y  .  It\r\n%          is  also  denoted by X .*. Y . The result is a large matrix\r\n%          formed by taking all possible products between the elements\r\n%          of  X  and  those  of Y . For example, if X is 2 by 3, then\r\n%          X .*. Y is\r\n%    \r\n%                < x(1,1)*Y  x(1,2)*Y  x(1,3)*Y\r\n%                  x(2,1)*Y  x(2,2)*Y  x(2,3)*Y >\r\n%    \r\n%          The five-point discrete Laplacian for an n-by-n grid can be\r\n%          generated by\r\n%    \r\n%                T = diag(ones(n-1,1),1);  T = T + T';  I = EYE(T);\r\n%                A = T.*.I + I.*.T - 4*EYE;\r\n%    \r\n%          Just  in  case  they  might  be  useful,  MATLAB   includes\r\n%          constructions called Kronecker tensor quotients, denoted by\r\n%          X .\/. Y and X .\\. Y .  They are obtained by  replacing  the\r\n%          elementwise multiplications in X .*. Y with divisions.\r\n%    \r\n%    LINES An internal count is kept of the number of lines of  output\r\n%          since  the  last  input.   Whenever this count approaches a\r\n%          limit, the  user  is  asked  whether  or  not  to  suppress\r\n%          printing  until the next input.  Initially the limit is 25.\r\n%          LINES(N) resets the limit to N .\r\n%    \r\n%    LOAD  LOAD('file') retrieves all the variables from  the  file  .\r\n%          See  FILE  and  SAVE for more details.  To prepare your own\r\n%          file for LOADing, change the READs to WRITEs  in  the  code\r\n%          given under SAVE.\r\n%    \r\n%    LOG   LOG(X)  is the  natural  logarithm  of   X  .   See  FUN  .\r\n%          Complex results are produced if  X  is not positive, or has\r\n%          nonpositive eigenvalues.\r\n%    \r\n%    LONG  Determine output format.   All  computations  are  done  in\r\n%          complex arithmetic and double precision if it is available.\r\n%          SHORT and  LONG  merely  switch  between  different  output\r\n%          formats.\r\n%          SHORT    Scaled fixed point format with about 5 digits.\r\n%          LONG     Scaled fixed point format with about 15 digits.\r\n%          SHORT E  Floating point format with about 5 digits.\r\n%          LONG E   Floating point format with about 15 digits.\r\n%          LONG Z   System dependent format, often hexadecimal.\r\n%    \r\n%    LU    Factors from Gaussian elimination.  <L,U> = LU(X)  stores a\r\n%          upper triangular matrix in  U  and a 'psychologically lower\r\n%          triangular matrix', i.e. a product of lower triangular  and\r\n%          permutation matrices, in L , so that  X = L*U .  By itself,\r\n%          LU(X) returns the output from CGEFA .\r\n%    \r\n%    MACRO The macro facility involves text and inward pointing  angle\r\n%          brackets.  If  STRING  is  the  source  text for any MATLAB\r\n%          expression or statement, then\r\n%                t = 'STRING';\r\n%          encodes the text as a vector of integers  and  stores  that\r\n%          vector in  t .  DISP(t) will print the text and\r\n%                >t<\r\n%          causes the text to be interpreted, either as a statement or\r\n%          as a factor in an expression.  For example\r\n%                t = '1\/(i+j-1)';\r\n%                disp(t)\r\n%                for i = 1:n, for j = 1:n, a(i,j) = >t<;\r\n%          generates the Hilbert matrix of order n.\r\n%          Another example showing indexed text,\r\n%                S = <'x = 3            '\r\n%                     'y = 4            '\r\n%                     'z = sqrt(x*x+y*y)'>\r\n%                for k = 1:3, >S(k,:)<\r\n%          It is necessary that the strings making up  the  \"rows\"  of\r\n%          the \"matrix\"  S  have the same lengths.\r\n%    \r\n%    MAGIC Magic square.  MAGIC(N) is an N  by  N  matrix  constructed\r\n%          from  the integers 1 through N**2 with equal row and column\r\n%          sums.\r\n%    \r\n%    NORM  For matrices..\r\n%          NORM(X)  is the largest singular value of  X .\r\n%          NORM(X,1)  is the 1-norm of  X .\r\n%          NORM(X,2)  is the same as NORM(X) .\r\n%          NORM(X,'INF')  is the infinity norm of  X .\r\n%          NORM(X,'FRO')  is the F-norm, i.e.  SQRT(SUM(DIAG(X'*X))) .\r\n%          For vectors..\r\n%          NORM(V,P) = (SUM(V(I)**P))**(1\/P) .\r\n%          NORM(V) = NORM(V,2) .\r\n%          NORM(V,'INF') = MAX(ABS(V(I))) .\r\n%    \r\n%    ONES  All ones.  ONES(N)  is an N by N matrix of ones.  ONES(M,N)\r\n%          is an M by N matrix of ones .  ONES(A)  is the same size as\r\n%          A  and all ones .\r\n%    \r\n%    ORTH  Orthogonalization.   Q  =  ORTH(X)   is   a   matrix   with\r\n%          orthonormal  columns,  i.e. Q'*Q = EYE, which span the same\r\n%          space as the columns of  X .\r\n%    \r\n%    PINV  Pseudoinverse.  X = PINV(A) produces a matrix   X   of  the\r\n%          same  dimensions as  A' so that  A*X*A = A , X*A*X = X  and\r\n%          AX  and  XA  are Hermitian .  The computation is  based  on\r\n%          SVD(A)  and  any  singular values less than a tolerance are\r\n%          treated   as    zero.     The    default    tolerance    is\r\n%          NORM(SIZE(A),'inf')*NORM(A)*EPS.   This  tolerance  may  be\r\n%          overridden with X = PINV(A,tol).  See RANK.\r\n%    \r\n%    PLOT  PLOT(X,Y) produces a plot of  the  elements  of  Y  against\r\n%          those  of X . PLOT(Y) is the same as PLOT(1:n,Y) where n is\r\n%          the  number  of   elements   in   Y   .    PLOT(X,Y,P)   or\r\n%          PLOT(X,Y,p1,...,pk)  passes the optional parameter vector P\r\n%          or scalars p1 through pk to the plot routine.  The  default\r\n%          plot  routine  is a crude printer-plot. It is hoped that an\r\n%          interface to local graphics equipment can be provided.\r\n%          An interesting example is\r\n%                t = 0:50;\r\n%                PLOT( t.*cos(t), t.*sin(t) )\r\n%    \r\n%    POLY  Characteristic polynomial.\r\n%          If  A  is an N by N matrix, POLY(A) is a column vector with\r\n%          N+1   elements   which   are   the   coefficients   of  the\r\n%          characteristic polynomial,  DET(lambda*EYE - A) .\r\n%          If V is a vector, POLY(V) is a vector  whose  elements  are\r\n%          the  coefficients  of  the  polynomial  whose roots are the\r\n%          elements of V .  For vectors, ROOTS and  POLY  are  inverse\r\n%          functions  of  each  other,  up  to  ordering, scaling, and\r\n%          roundoff error.\r\n%          ROOTS(POLY(1:20)) generates Wilkinson's famous example.\r\n%    \r\n%    PRINT PRINT('file',X) prints X on  the  file  using  the  current\r\n%          format determined by SHORT, LONG Z, etc.  See FILE.\r\n%    \r\n%    PROD  PROD(X)  is the product of all the elements of  X .\r\n%    \r\n%    QR    Orthogonal-triangular decomposition.\r\n%          <Q,R> = QR(X)  produces an upper triangular  matrix   R  of\r\n%          the  same dimension as  X  and a unitary matrix  Q  so that\r\n%          X = Q*R .\r\n%          <Q,R,E> = QR(X)  produces a  permutation  matrix   E  ,  an\r\n%          upper  triangular  R  with decreasing diagonal elements and\r\n%          a unitary  Q  so that  X*E = Q*R .\r\n%          By itself, QR(X) returns the output of CQRDC .  TRIU(QR(X))\r\n%          is R .\r\n%    \r\n%    RAND  Random numbers and matrices.  RAND(N)  is an N by N  matrix\r\n%          with  random  entries.  RAND(M,N)  is an M by N matrix with\r\n%          random entries.  RAND(A)  is the same size as   A  .   RAND\r\n%          with no arguments is a scalar whose value changes each time\r\n%          it is referenced.\r\n%          Ordinarily,  random numbers are  uniformly  distributed  in\r\n%          the  interval  (0.0,1.0)  .   RAND('NORMAL')  switches to a\r\n%          normal distribution  with  mean  0.0  and  variance  1.0  .\r\n%          RAND('UNIFORM')  switches back to the uniform distribution.\r\n%          RAND('SEED') returns the current value of the seed for  the\r\n%          generator.    RAND('SEED',n)   sets   the   seed   to  n  .\r\n%          RAND('SEED',0) resets the seed to 0, its value when  MATLAB\r\n%          is first entered.\r\n%    \r\n%    RANK  Rank.  K = RANK(X) is the number of singular values  of   X\r\n%          that are larger than NORM(SIZE(X),'inf')*NORM(X)*EPS.\r\n%          K = RANK(X,tol) is the number of singular values of  X that\r\n%          are larger than tol .\r\n%    \r\n%    RCOND RCOND(X)   is  an  estimate  for  the  reciprocal  of   the\r\n%          condition  of   X   in  the  1-norm obtained by the LINPACK\r\n%          condition estimator.  If  X  is well conditioned,  RCOND(X)\r\n%          is  near  1.0  .   If  X  is badly conditioned, RCOND(X) is\r\n%          near 0.0 .\r\n%          <R, Z> = RCOND(A) sets  R  to RCOND(A) and also produces  a\r\n%          vector  Z so that\r\n%                     NORM(A*Z,1) = R*NORM(A,1)*NORM(Z,1)\r\n%          So, if RCOND(A) is small, then  Z  is an  approximate  null\r\n%          vector.\r\n%    \r\n%    RAT   An experimental  function  which  attempts  to  remove  the\r\n%          roundoff   error  from  results  that  should  be  \"simple\"\r\n%          rational numbers.\r\n%          RAT(X) approximates each  element  of   X  by  a  continued\r\n%          fraction of the form\r\n%    \r\n%                    a\/b = d1 + 1\/(d2 + 1\/(d3 + ... + 1\/dk))\r\n%    \r\n%          with k <= len, integer di and abs(di) <= max .  The default\r\n%          values of the parameters are len = 5 and max = 100.\r\n%          RAT(len,max) changes the default values.  Increasing either\r\n%          len or max increases the number of possible fractions.\r\n%          <A,B> = RAT(X) produces integer matrices A and B so that\r\n%    \r\n%                    A .\/ B  =  RAT(X)\r\n%    \r\n%          Some examples:\r\n%    \r\n%                long\r\n%                T = hilb(6), X = inv(T)\r\n%                <A,B> = rat(X)\r\n%                H = A .\/ B, S = inv(H)\r\n%    \r\n%                short e\r\n%                d = 1:8,  e = ones(d),  A = abs(d'*e - e'*d)\r\n%                X = inv(A)\r\n%                rat(X)\r\n%                display(ans)\r\n%    \r\n%    \r\n%    REAL  REAL(X)  is the real part of  X .\r\n%    \r\n%    RETURN  From the terminal, causes return to the operating  system\r\n%          or  other  program  which  invoked  MATLAB.  From inside an\r\n%          EXEC, causes  return  to  the  invoking  EXEC,  or  to  the\r\n%          terminal.\r\n%    \r\n%    RREF  RREF(A) is the reduced row echelon form of the  rectangular\r\n%          matrix.  RREF(A,B) is the same as RREF(<A,B>) .\r\n%    \r\n%    ROOTS Find polynomial roots.  ROOTS(C)  computes the roots of the\r\n%          polynomial  whose  coefficients  are  the  elements  of the\r\n%          vector  C .  If  C  has  N+1  components, the polynomial is\r\n%          C(1)*X**N + ... + C(N)*X + C(N+1) .  See POLY.\r\n%    \r\n%    ROUND ROUND(X)  rounds  the  elements  of   X   to  the   nearest\r\n%          integers.\r\n%    \r\n%    SAVE  SAVE('file') stores all the current variables in a file.\r\n%          SAVE('file',X) saves only X .  See FILE .\r\n%          The variables may be retrieved later by LOAD('file') or  by\r\n%          your  own program using the following code for each matrix.\r\n%          The lines involving XIMAG may be eliminated  if  everything\r\n%          is known to be real.\r\n%    \r\n%                attach lunit to 'file'\r\n%                REAL or DOUBLE PRECISION XREAL(MMAX,NMAX)\r\n%                REAL or DOUBLE PRECISION XIMAG(MMAX,NMAX)\r\n%                READ(lunit,101) ID,M,N,IMG\r\n%                DO 10 J = 1, N\r\n%                   READ(lunit,102) (XREAL(I,J), I=1,M)\r\n%                   IF (IMG .NE. 0) READ(lunit,102) (XIMAG(I,J),I=1,M)\r\n%             10 CONTINUE\r\n%    \r\n%          The formats used are system dependent.  The  following  are\r\n%          typical.     See    SUBROUTINE   SAVLOD   in   your   local\r\n%          implementation of MATLAB.\r\n%    \r\n%            101 FORMAT(4A1,3I4)\r\n%            102 FORMAT(4Z18)\r\n%            102 FORMAT(4O20)\r\n%            102 FORMAT(4D25.18)\r\n%    \r\n%    SCHUR Schur decomposition.  <U,T> = SCHUR(X)  produces  an  upper\r\n%          triangular  matrix   T , with the eigenvalues of  X  on the\r\n%          diagonal, and a unitary matrix  U so that  X =  U*T*U'  and\r\n%          U'*U = EYE .  By itself, SCHUR(X) returns  T .\r\n%    \r\n%    SHORT See LONG .\r\n%    \r\n%    SEMI  Semicolons at the end of  lines  will  cause,  rather  than\r\n%          suppress,  printing.   A  second  SEMI restores the initial\r\n%          interpretation.\r\n%    \r\n%    SIN   SIN(X)  is the sine of  X .  See FUN .\r\n%    SIZE  If X is an M by N matrix, then SIZE(X) is <M, N> .\r\n%          Can also be used with a multiple assignment,\r\n%                <M, N> = SIZE(X) .\r\n%    \r\n%    SQRT  SQRT(X)  is the square root of  X .   See  FUN  .   Complex\r\n%          results  are  produced  if   X   is  not  positive,  or has\r\n%          nonpositive eigenvalues.\r\n%    \r\n%    STOP  Use EXIT instead.\r\n%    \r\n%    SUM   SUM(X)   is  the  sum  of  all  the  elements   of    X   .\r\n%          SUM(DIAG(X))  is the trace of  X .\r\n%    \r\n%    SVD   Singular value decomposition.  <U,S,V> = SVD(X)  produces a\r\n%          diagonal  matrix  S , of the same dimension as  X  and with\r\n%          nonnegative diagonal  elements  in  decreasing  order,  and\r\n%          unitary matrices  U  and  V  so that  X = U*S*V' .\r\n%          By itself, SVD(X) returns a vector containing the  singular\r\n%          values.\r\n%          <U,S,V>   =   SVD(X,0)   produces   the   \"economy    size\"\r\n%          decomposition.   If  X  is m by n with m > n, then only the\r\n%          first n columns of U are computed and S is n by n .\r\n%    \r\n%    TRIL  Lower triangle.  TRIL(X) is the lower triangular part of X.\r\n%          TRIL(X,K) is the elements on and below the K-th diagonal of\r\n%          X.  K = 0 is the main diagonal, K > 0  is  above  the  main\r\n%          diagonal and K < 0 is below the main diagonal.\r\n%    \r\n%    TRIU  Upper triangle.  TRIU(X) is the upper triangular part of X.\r\n%          TRIU(X,K) is the elements on and above the K-th diagonal of\r\n%          X.  K = 0 is the main diagonal, K > 0  is  above  the  main\r\n%          diagonal and K < 0 is below the main diagonal.\r\n%    \r\n%    USER  Allows personal  Fortran  subroutines  to  be  linked  into\r\n%          MATLAB .  The subroutine should have the heading\r\n%    \r\n%                   SUBROUTINE USER(A,M,N,S,T)\r\n%                   REAL or DOUBLE PRECISION A(M,N),S,T\r\n%    \r\n%          The MATLAB statement  Y = USER(X,s,t)  results in a call to\r\n%          the  subroutine with a copy of the matrix  X  stored in the\r\n%          argument  A , its column and row dimensions in  M  and  N ,\r\n%          and  the scalar parameters  s  and  t  stored in  S  and  T\r\n%          . If  s and t  are omitted, they are set to  0.0  .   After\r\n%          the  return,   A  is stored in  Y .  The dimensions  M  and\r\n%          N  may be reset within the subroutine.  The statement  Y  =\r\n%          USER(K)  results in a call with M = 1, N = 1  and  A(1,1) =\r\n%          FLOAT(K) .  After the subroutine has been written, it  must\r\n%          be compiled and linked to the MATLAB object code within the\r\n%          local operating system.\r\n%    \r\n%    WHAT  Lists commands and functions currently available.\r\n%    \r\n%    WHILE Repeat statements an indefinite number of times.\r\n%          WHILE expr rop expr, statement, ..., statement, END\r\n%          where rop is =, <, >, <=, >=, or <> (not equal) .  The  END\r\n%          at  the end of a line may be omitted.  The comma before the\r\n%          END may also be omitted.  The commas  may  be  replaced  by\r\n%          semicolons   to   avoid   printing.    The  statements  are\r\n%          repeatedly executed as long  as  the  indicated  comparison\r\n%          between  the  real parts of the first components of the two\r\n%          expressions is true.   Example  (assume  a  matrix   A   is\r\n%          already defined).\r\n%          E = 0*A; F = E + EYE; N = 1;\r\n%          WHILE NORM(E+F-E,1) > 0, E = E + F; F = A*F\/N; N = N + 1;\r\n%          E\r\n%    \r\n%    WHO   Lists current variables.\r\n%    \r\n%    WHY   Provides succinct answers to any questions.\r\n%    \r\n%    \/\/\r\n\r\n##### SOURCE END ##### eca491f76e4243cdbdeb2ef47ed6b124\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/cleve\/files\/what.png\" onError=\"this.style.display ='none';\" \/><\/div><!--introduction--><p>In the 1970s and early 1980s, while I was working on the <a href=\"https:\/\/blogs.mathworks.com\/cleve\/2018\/01\/23\/linpack-linear-equation-package\">LINPACK<\/a> and <a href=\"https:\/\/blogs.mathworks.com\/cleve\/2018\/01\/02\/eispack-matrix-eigensystem-routines\">EISPACK<\/a> projects that I discussed in two previous posts, I was a Professor of Mathematics and then of Computer Science at the University of New Mexico in Albuquerque. I was teaching courses in Linear Algebra and Numerical Analysis. I wanted my students to have easy access to LINPACK and EISPACK without writing  Fortran programs.  By \"easy access\" I meant not going through the remote batch processing and the repeated edit-compile-link-load-execute process that was ordinarily required on the campus central mainframe computer.... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/cleve\/2018\/02\/05\/the-historic-matlab-users-guide\/\">read more >><\/a><\/p>","protected":false},"author":78,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,6,16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/2970"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/users\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/comments?post=2970"}],"version-history":[{"count":6,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/2970\/revisions"}],"predecessor-version":[{"id":2992,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/2970\/revisions\/2992"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media?parent=2970"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/categories?post=2970"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/tags?post=2970"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}