octave: Miscellaneous Functions

 
 28.6 Miscellaneous Functions
 ============================
 
  -- : poly (A)
  -- : poly (X)
      If A is a square N-by-N matrix, ‘poly (A)’ is the row vector of the
      coefficients of ‘det (z * eye (N) - A)’, the characteristic
      polynomial of A.
 
      For example, the following code finds the eigenvalues of A which
      are the roots of ‘poly (A)’.
 
           roots (poly (eye (3)))
               ⇒ 1.00001 + 0.00001i
                  1.00001 - 0.00001i
                  0.99999 + 0.00000i
 
      In fact, all three eigenvalues are exactly 1 which emphasizes that
      for numerical performance the ‘eig’ function should be used to
      compute eigenvalues.
 
      If X is a vector, ‘poly (X)’ is a vector of the coefficients of the
      polynomial whose roots are the elements of X.  That is, if C is a
      polynomial, then the elements of ‘D = roots (poly (C))’ are
      contained in C.  The vectors C and D are not identical, however,
      due to sorting and numerical errors.
 
      See also: Seeroots XREFroots, Seeeig XREFeig.
 
  -- : polyout (C)
  -- : polyout (C, X)
  -- : STR = polyout (...)
      Display a formatted version of the polynomial C.
 
      The formatted polynomial
 
           c(x) = c(1) * x^n + ... + c(n) x + c(n+1)
 
      is returned as a string or written to the screen if ‘nargout’ is
      zero.
 
      The second argument X specifies the variable name to use for each
      term and defaults to the string "s".
 
      See also: Seepolyreduce XREFpolyreduce.
 
  -- : polyreduce (C)
      Reduce a polynomial coefficient vector to a minimum number of terms
      by stripping off any leading zeros.
 
      See also: Seepolyout XREFpolyout.