First time here? Check out the FAQ!
answered 3 years ago
If p is a polynomial, then matrix.companion(p) returns a matrix which has p as its characteristic polynomial. Since such matrices are not unique, you shouldn't expect it to give the precise matrix that you've specified.
p
matrix.companion(p)