companion INDEX

COMPANION _ _ _ _ _ _ _ _ _ _ _ _ operator

syntax:

companion(<poly>,<x>)

<poly> :- a monic univariate polynomial in <x>.

<x> :- the variable.

companioncreates the companion matrix C of <poly>.

This is the square matrix of dimension n, where n is the degree of <poly> w.r.t. <x>.

The entries of C are:

C(i,n) = -coeffn(<poly>,<x>,i-1) for i = 1 ... n, C(i,i-1) = 1 for i = 2 ... n and the rest are 0.

examples:



companion(x^4+17*x^3-9*x^2+11,x); 


  [0  0  0  -11]
  [            ]
  [1  0  0   0 ]
  [            ]
  [0  1  0   9 ]
  [            ]
  [0  0  1  -17]

Related functions: find_companion.