We have polynomial in three variables x, y, z
.
How to list all coefficients of odd powers of z
or y
and any power of x
?
Red are coefficients of z y^(2n)
or z^3 y^(2n)
.
Green are coefficients of y z^(2n)
or y^3 z^(2n)
.
Yellow are coefficients of z^3 y
or z y^3
or z y
(or z^3 y^3
though there are not any).
Collect[(a1 x + a2 y + a3 z)^4 + (b1 x + b2 y + b3 z)^4 + (c1 x +
c2 y + c3 z)^4, {z, y, x}, Factor]
I can do it by selecting parts of CoefficientList
and the parts defined manually.
I can automatize creation of the list of parts but the code would be cumbersome and hard to read.
I would prefer a code that it would be evident what the code is doing at the first glance.
From my code it is not evident that it selects coefficients of odd powers of z, y
.
DeleteCases[
CoefficientList[(a1 x + a2 y + a3 z)^4 + (b1 x + b2 y +
b3 z)^4 + (c1 x + c2 y + c3 z)^4, {z, y,
x}][[Sequence @@ #]] & /@ {{1, 2}, {1, 4}, {2, 1}, {2, 2}, {2,
3}, {2, 4}, {3, 2}, {3, 4}, {4, 1}, {4, 2}, {4, 3}, {4, 4}} //
Flatten, 0] // Factor
(* {4 (a1^3 a2 + b1^3 b2 + c1^3 c2),
4 (a1 a2^3 + b1 b2^3 + c1 c2^3), 4 (a1^3 a3 + b1^3 b3 + c1^3 c3),
12 (a1^2 a2 a3 + b1^2 b2 b3 + c1^2 c2 c3),
12 (a1 a2^2 a3 + b1 b2^2 b3 + c1 c2^2 c3),
4 (a2^3 a3 + b2^3 b3 + c2^3 c3),
12 (a1 a2 a3^2 + b1 b2 b3^2 + c1 c2 c3^2),
4 (a1 a3^3 + b1 b3^3 + c1 c3^3), 4 (a2 a3^3 + b2 b3^3 + c2 c3^3)} *)