Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

linalg::companion

Companion matrix of a univariate polynomial

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

linalg::companion(p, <x>)

Description

linalg::companion(p) returns the companion matrix associated with the polynomial p.

p must be monic and of degree one at least.

If p is a polynomial, i.e., an object of type DOM_POLY, then specifying x has no effect.

If p is a polynomial, then the component ring of the returned matrix is the coefficient ring of p, except in two cases for built-in coefficient rings: if the coefficient ring of p is Expr then the domain Dom::ExpressionField() is the component ring of the companion matrix. If it is IntMod(m) then the companion matrix is defined over the ring Dom::IntegerMod(m) (see Example 2).

If p is a polynomial expression, then the companion matrix is defined over Dom::ExpressionField().

If p is a polynomial expression containing several symbolic indeterminates then x must be specified and distinguishes the indeterminate x from the other symbolic parameters.

Examples

Example 1

We start with the following polynomial expression:

delete a_0, a_1, a_2, a_3: 
p := x^4 + a_3*x^3 + a_2*x^2 + a_1*x + a_0

To compute the companion matrix of p with respect to x we must specify the second parameter x, because the expression p contains the indeterminates a0, a1, a2, a3 and x:

linalg::companion(p)
Error: Variables in multivariate polynomials must be specified by the second argument. [linalg::companion]
linalg::companion(p, x)

Of course, we can compute the companion matrix of p with respect to a0 as well.

linalg::companion(p, a_0)

The following fails with an error message, because the polynomial p is not monic with respect to a1:

linalg::companion(p, a_1)
Error: Polynomial must be monic. [linalg::companion]

Example 2

If we enter a polynomial over the built-in coefficient domain Expr, then the companion matrix is defined over the standard component ring for matrices (the domain Dom::ExpressionField()):

C := linalg::companion(poly(x^2 + 10*x + PI, [x]))

domtype(C)

If we define a polynomial over the build-in coefficient domain IntMod(m), then the companion matrix is defined over the corresponding component ring Dom::IntegerMod(m), as shown in the next example:

p := poly(x^2 + 10*x + 7, [x], IntMod(3))

C := linalg::companion(p)

domtype(C)

Parameters

p

An univariate polynomial, or a polynomial expression

x

An identifier

Return Values

Matrix of the domain Dom::Matrix(R).

Algorithms

The companion matrix of the polynomial xn + an1xn - 1 + … + a1x + a0 is the matrix:

.

The companion matrix of a univariate polynomial p of degree n is an n×n matrix C with pC = p, where pC is the characteristic polynomial of C.

Was this topic helpful?