Previous Up Next

6.57.11  Matrice compagnon d’un polynôme : companion

companion a comme argument un polynôme P unitaire et le nom de sa variable.
companion renvoie la matrice qui a pour polynôme caractéristique le polynôme P.
Si P(x)=xn+an−1xn−1+...+a−1x+a0, cette matrice est égale à la matrice unité d’ordre n−1 bordée par [0,0..,0,−a0] comme première ligne, et par [−a0,−a1,....,−an−1] comme dernière colonne.
On tape :

companion(x^2+5x-7,x)

On obtient :

[[0,7],[1,-5]]

On tape :

companion(x^4+3x^3+2x^2+4x-1,x)

On obtient :

[[0,0,0,1],[1,0,0,-4],[0,1,0,-2],[0,0,1,-3]]

Previous Up Next