Hi, As far as I can see, there is no method available to compute the companion matrix of a polynomial. May I suggest the addition of a method along these lines?: // Creates the Companion matrix for a given polynomial GiNaC::matrix CreateCompanion(const GiNaC::ex &poly, const GiNaC::ex &symbol) { if(poly.is_polynomial(symbol)) { int rank = poly.degree(symbol); GiNaC::matrix mat(rank, rank); GiNaC::ex majorCoeff = poly.coeff(symbol, rank); for(int i = 0; i < rank; ++i) { for(int j = 0; j < rank; ++j) { if(i - j == 1) { mat(i, j) = 1; } else if(i == 0) { mat(i, j) = -1 * poly.coeff(symbol, rank - j - 1) / majorCoeff; } } } return mat; } else { // Throw exception or return empty matrix } } Regards, James.