/**/ Use R ::= QQ[x,y,z];
/**/ F := 3*x^2*y + 5*y^2 - x*y;
/**/ Coeffs := coefficients(F); Coeffs; -- with one argument
[3, -1, 5]
/**/ phi := CoeffEmbeddingHom(RingOf(F));
/**/ F = ScalarProduct(apply(phi,Coeffs), support(F));
true
/**/ Skeleton := [1, x, y, z, x^2, x*y, y^2, y*z, z^2];
/**/ Coeffs := coefficients(F, Skeleton); Coeffs; -- with two arguments
[0, 0, 0, 0, 0, -1, 5, 0, 0]
/**/ ScalarProduct(apply(phi,Coeffs), Skeleton);
-x*y +5*y^2
/**/ L := CoefficientsWRT(F,[x,y,z]); indent(L); -- similar function
[
record[PP := y^3, coeff := 5],
record[PP := x^2*y, coeff := 3],
record[PP := x*y^5, coeff := -1]
]
/**/ F = sum([X.coeff * X.PP | X In L]);
true
/**/ L := CoeffListWRT(F, y); L; -- similar function
[0, 3*x^2 -x, 5]
/**/ F = sum([L[d+1]*y^d | d in 0..(len(L)-1)]);
true
/**/ R3 := NewFreeModule(R,3);
/**/ V := ModuleElem(R3, ***[3x^2+y, x-5z^3, x+2y]***);
/**/ ConcatLists([coefficients(V[i]) | i In 1..NumCompts(V)]);
[3, 1, -5, 1, 1, 2]
|