powered by

compan(p)

length(p)-1

p

-p[2:length(p)]/p[1]

The eigenvalues of this matrix are the roots of the polynomial.

roots

p <- c(1, 0, -7, 6) compan(p) # 0 7 -6 # 1 0 0 # 0 1 0

Run the code above in your browser using DataLab