Contents Previous Next Subchapters

Finding Roots of a Descending Polynomial
Syntax roots(p)
See Also polval , pol2asc

Description
Returns a complex column vector that contains the roots of the descending polynomial corresponding to the real, double-precision or complex vector p; i.e.,
                 n-1              1
     p[x] =  p  x   + ... +  p   x   +  p
              1               n-1        n
If z is the return value, it has one fewer elements than p and p[x] evaluated at x = z(i) is zero for each i.

Example
The roots of the polynomial
      2
     x  -  1
are -1 and +1. If you enter
     p = [1., 0, -1.]
     roots(p)
O-Matrix will reply
     {
     (-1, 0)
     (1, 0)
     }
or it will reply
     {
     (1, 0)
     (-1, 0)
     }
because the order of the roots is not determined.

Exceptions
If the method fails, the return value has type equal to "novalue". This should be a very rare case.