Phat Tran on Wed, 17 Mar 2010 07:09:00 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

How to access coefficients of multivariate polynomials in PARI


I want to evaluate this multivariate polynomials (1 + x + y)^5 mod (7, x^3 - 2, y^2 - 3) and below is the code in C.

GEN x = pol_x[fetch_user_var("x")];
GEN y = pol_x[fetch_user_var("y")];
GEN a = pol_x[fetch_user_var("a")];
ÂÂÂ ÂÂÂ
a = gpowgs(gmodulo(gadd(x, gmodulo(gadd(y, gmodulss(1, 7)), gsubgs(gsqr(y), 3))), gsubgs(gpowgs(x, 3), 2)), 5);

Right now I can only print out the result as below:

Mod(Mod(Mod(4, 7)*y + Mod(4, 7), y^2 - 3)*x^2 + Mod(Mod(6, 7)*y + Mod(3, 7), y^2 - 3)*x + Mod(Mod(2, 7), y^2 - 3), x^3 - 2)

I wonder if there is a way to retrieve the coefficient of a term in this polynomial; for example I want to retrieve the coefficient of the term xy, which is 6 or Mod(6, 7).

Thanks,

Phat