poly: Define Polynomial by Roots

Description Usage Arguments Details Value Note See Also Examples

Description

Define a polynomial by its roots.

Usage

1
  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

polyval, roots

Examples

1
2
3
  Poly(c(1, -1, 1i, -1i))  # Solves x^4 -1 = 0
  # Wilkinson's example:
  roots(Poly(1:20))

Example output

[1]  1  0  0  0 -1
 [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

pracma documentation built on Dec. 11, 2021, 9:57 a.m.