[GAP Forum] algebraic integers: testing the minimal polynomial

Alexander Hulpke hulpke at math.colostate.edu
Wed Apr 16 18:00:19 BST 2014


Dear Forum, dear Marc Bogaerts,

> I want to know if x is an algebraic integer by  inspecting the coefficients
> of its minimal polynomial using tne command
> PolynomialCoefficientsOfPolynomial.

PolynomialCoefficientsofPolynomial always returns (as the name says, and to be consistent with the multivariate case) coefficients that are polynomials, that cc[1] is really -6*a^0.

gap> p:=a^3-8*a-6;
a^3-8*a-6
gap> cc:=PolynomialCoefficientsOfPolynomial(p,a);
[ -6, -8, 0, 1 ]
gap> cc[1]=-6;
false
gap> cc[1]=-6*a^0;
true

(As the objects display the same way, you could detect this by looking for example at the categories of the coefficients:

gap> CategoriesOfObject(cc[1]);
[ "IsExtAElement", "IsNearAdditiveElement", "IsNearAdditiveElementWithZero", 
  "IsNearAdditiveElementWithInverse", "IsAdditiveElement", "IsExtLElement", 
  "IsExtRElement", "IsMultiplicativeElement", "IsMultiplicativeElementWithOne"
    , "IsMultiplicativeElementWithInverse", "IsZDFRE", "IsPolynomialFunction",
  "IsRationalFunction", "IsPolynomialFunctionsFamilyElement", 
  "IsRationalFunctionsFamilyElement" ]

while integers look very different:

gap> CategoriesOfObject(6);    
[ "IsInt", "IsRat", "IsCyc", "IsExtAElement", "IsNearAdditiveElement", 
  "IsNearAdditiveElementWithZero", "IsNearAdditiveElementWithInverse", 
  "IsAdditiveElement", "IsExtLElement", "IsExtRElement", 
  "IsMultiplicativeElement", "IsMultiplicativeElementWithOne", 
  "IsMultiplicativeElementWithInverse", "IsZDFRE", "IsAssociativeElement", 
  "IsAdditivelyCommutativeElement", "IsCommutativeElement", "IsCyclotomic", 
  "IsPosRat" ]    )

If you use instead CoefficientsOfUnivariatePolynomial, you get the integer coefficients as desired:

gap> cc:=CoefficientsOfUnivariatePolynomial(p);
[ -6, -8, 0, 1 ]
gap> List(cc,c->c in Integers);
[ true, true, true, true ]

Best wishes,

   Alexander Hulpke

-- Colorado State University, Department of Mathematics,
Weber Building, 1874 Campus Delivery, Fort Collins, CO 80523-1874, USA
email: hulpke at math.colostate.edu, Phone: ++1-970-4914288
http://www.math.colostate.edu/~hulpke





More information about the Forum mailing list