[GAP Forum] Retrieving coefficients of linear equations

Bulutoglu Dursun A Civ AFIT/ENC Dursun.Bulutoglu at afit.edu
Wed Jan 17 00:32:42 GMT 2007


Dear Gap Forum,
I was wondering how I can extract the coefficients of a multivariate
polynomial (in my case it is a linear polynomial) and put them in a
list.
I wrote the code below and would like to extract the coefficients of the
variables x_1,x_2,...x_10 in A8 into a list where the first element is
the coefficient of x_1 the second element is the coefficient of x_2 and
the last element is the constant (or the first element is the constant,
the second element is the coefficient of x_1 the third element is the
coefficient of x_2
and so on...
Thanks in advance.
Dursun.

m:=10;
N:=20;
aa:=PolynomialRing(Rationals,[1..20]);
 mm:=IndeterminatesOfPolynomialRing(aa);
ccf:=(2*([1..10]-5)-1);

mm8:=List(ccf, x->x^8)*mm{[1..10]};
mm6:=List(ccf, x->x^6)*mm{[1..10]};
mm4:=List(ccf, x->x^4)*mm{[1..10]};

A4:=(mm4-N^2*(m-1)*(3*(m-1)-2))/(24);

A6:=(mm6-N^2*(15*(m-1)*(m-2)^2+(m-1))-(360*(m-1)-960)*A4)/720;

A8:=(mm8-(20160*(m-1)-80640)*A6-(5040*(m-1)^2-30240*(m-1)+48384)*A4
-N^2*(105*(m-1)^4-420*(m-1)^3+588*(m-1)^2-272*(m-1)))/40320;








More information about the Forum mailing list