Define a polynomial by its roots.

Poly(x)

Arguments

x

vector or square matrix, real or complex

Details

Computes the characteristic polynomial of an (n x n)-Matrix.

If x is a vector, Poly(x) is the vector of coefficients of the polynomial whose roots are the elements of x.

Value

Vector representing a polynomial.

Note

In Matlab/Octave this function is called poly().

See also

Examples

  Poly(c(1, -1, 1i, -1i))  # Solves x^4 -1 = 0
#> [1]  1  0  0  0 -1
  # Wilkinson's example:
  roots(Poly(1:20))
#>  [1] 19.999874 19.001295 17.993672 17.018542 15.959718 15.059326 13.930186
#>  [8] 13.062664 11.958874 11.022464  9.991191  9.002713  7.999394  7.000097
#> [15]  5.999990  5.000001  4.000000  3.000000  2.000000  1.000000