 linalg(deprecated)/companion - Maple Help

linalg(deprecated)

 companion
 companion matrix associated with a polynomial Calling Sequence companion(p, x) Parameters

 p - monic univariate polynomial in x x - name (the variable) Description

 • Important: The linalg package has been deprecated. Use the superseding command LinearAlgebra[CompanionMatrix], instead.
 - For information on migrating linalg code to the new packages, see examples/LinearAlgebraMigration.
 • The call companion(p, x) will return a companion matrix associated with the polynomial p(x).
 • If C := companion(p, x) and p is $\mathrm{a0}+\mathrm{a1}x+...+{x}^{n}$ (a monic univariate polynomial) then ${C}_{i,n}=-\mathrm{coeff}\left(p,x,i-1\right)$ ($i=1..n$), ${C}_{i,i-1}=1$ ($i=2..n$), and ${C}_{i,j}=0$ for other values of i and j.
 • The command with(linalg,companion) allows the use of the abbreviated form of this command. Examples

Important: The linalg package has been deprecated. Use the superseding command LinearAlgebra[CompanionMatrix], instead.

 > $\mathrm{with}\left(\mathrm{linalg}\right):$
 > $p≔{x}^{4}+9{x}^{3}+2{x}^{2}+17x+5$
 ${p}{≔}{{x}}^{{4}}{+}{9}{}{{x}}^{{3}}{+}{2}{}{{x}}^{{2}}{+}{17}{}{x}{+}{5}$ (1)
 > $\mathrm{companion}\left(p,x\right)$
 $\left[\begin{array}{cccc}{0}& {0}& {0}& {-5}\\ {1}& {0}& {0}& {-17}\\ {0}& {1}& {0}& {-2}\\ {0}& {0}& {1}& {-9}\end{array}\right]$ (2)
 > $q≔\mathrm{expand}\left(\left(z+2\right)\left(z-5\right)\left(z+3\right)\right)$
 ${q}{≔}{{z}}^{{3}}{-}{19}{}{z}{-}{30}$ (3)
 > $\mathrm{companion}\left(q,z\right)$
 $\left[\begin{array}{ccc}{0}& {0}& {30}\\ {1}& {0}& {19}\\ {0}& {1}& {0}\end{array}\right]$ (4)