Dear Form, Dear Mark Bogaerts,

Mark Bogaerts asked:

> r:=W[n];
> x_8-x_9+x_10-x_11
> d:=11;       #this is the only line I have to repeat for each loop and
> that I would like to be done automatically
> PolynomialCoefficientsOfPolynomial(r,d);
> [ x_37-x_39+x_40, -Z(3)^0 ]
> rr[n]:=[last[1],d];
> [ x_37-x_39+x_40, 42 ]
> for i in [n..20] do r:=W[i]; W[i]:=Value(r, [X(F,d)], [rr[n][1]]); od;
> 
> So the question is how to obtain the number of the last term of a
> multivariate polynomial (of degree 1).

While for the leading term there is a function `LeadingTermOfPolynomial' (that 
also allows to use different orderings) there is no specific one for the lowest 
term. However in your situation it seems you are happy to use the ordering GAP 
uses for a polynomials terms. (This ordering currently is DegLex and unlikely 
to change, but this is not guaranteed to be stable in perpetuity should we ever 
change the underlying arithmetic routines.) If you call
ExtRepPolynomialRatFun 
on a polynomial, you get (what is called the ``ExternalRepresentation', meaning 
a GAP-language object representing the data stored in the object) a list of the 
form
term,coefficient,term,coefficient,...
with terms sorted in increasing order. This is very quick, as it essentially 
just returns a list that is already stored in the polynomial.
In your example x_8-x_9+x_10-x_11 you get

gap> ExtRepPolynomialRatFun(a);
[ [ 11, 1 ], -1, [ 10, 1 ], 1, [ 9, 1 ], -1, [ 8, 1 ], 1 ]

That is the lowest term is x_11^1 with coefficient -1. If you know that the 
degree is 1, you will only need the indeterminate number 11.

Hope this helps.

   Alexander Hulpke

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



_______________________________________________
Forum mailing list
Forum@mail.gap-system.org
http://mail.gap-system.org/mailman/listinfo/forum

Reply via email to