CompanionMatrix¶
The companion matrix of a monic polynomial, given by its coefficient vector
{c0, …, c[n-1]}:
An explicit polynomial in a named variable works too, and is divided through by its leading coefficient first:
Its characteristic polynomial recovers the coefficients:
The last argument says where the negated coefficients go. Right is the
default; Bottom is its transpose, Left turns it through half a turn, and
Top is the transpose of Left:
Anything else in the placement slot is refused:
$ wo 'CompanionMatrix[{5, 2, 3, 1}, foo]'
CompanionMatrix::plspecc: Specification foo for placement of coefficients must be Top, Bottom, Left or Right.
CompanionMatrix[{5, 2, 3, 1}, foo]
So is a first argument that is neither a coefficient vector nor a polynomial of degree at least one: