companion_matrix, a Python code which computes the companion matrix for a polynomial. The polynomial may be represented in the standard monomial basis, or as a sum of Chebyshev, Gegenbauer, Hermite, Laguerre, or Lagrange basis polynomials. All the roots of the polynomial can be determined as the eigenvalues of the corresponding companion matrix.


The information on this web page is distributed under the MIT license.


companion_matrix is available in a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

chebyshev_polynomial, a Python code which considers the Chebyshev polynomials T(i,x), U(i,x), V(i,x) and W(i,x). Functions are provided to evaluate the polynomials, determine their zeros, produce their polynomial coefficients, produce related quadrature rules, project other functions onto these polynomial bases, and integrate double and triple products of the polynomials.

gegenbauer_polynomial, a Python code which evaluates the Gegenbauer polynomial and associated functions.

hermite_polynomial, a Python code which evaluates the physicist's Hermite polynomial, the probabilist's Hermite polynomial, the Hermite function, and related functions.

laguerre_polynomial, a Python code which evaluates the Laguerre polynomial, the generalized Laguerre polynomial, and the Laguerre function.

legendre_polynomial, a Python code which evaluates the Legendre polynomial and associated functions.

polynomial_conversion, a Python code which converts representations of a polynomial between monomial, Bernstein, Chebyshev, Hermite, Laguerre and Legendre forms.

test_matrix, a Python code which defines test matrices for which the condition number, determinant, eigenvalues, eigenvectors, inverse, null vectors, P*L*U factorization or linear system solution are known. Examples include the Fibonacci, Hilbert, Redheffer, Vandermonde, Wathen and Wilkinson matrices.


Source Code:

Last revised on 16 April 2024.