# Polynomial transformation coefficients

Given a 3D polynomial of degree $$m$$ and coefficients $$a_{ijk}^0$$, $$p(x_0, y_0, x_0) = \sum_{i,j,k}^{m} a_{ijk}^0 x_0^i y_0^j z_0^k, \quad i + j + k \le m,$$

I want to make the transformation: $$x_0 = m_{11}x_1+ m_{12}y_1 + m_{13}z_1 + b_1 \\y_0 = m_{21}x_1+ m_{22}y_1 + m_{23}z_1 + b_2 \\ z_0 = m_{31}x_1+ m_{32}y_1 + m_{33}z_1 + b_3.$$

We can write this new polynomial as, $$p(x_1, y_1, z_1) = \sum_{i,j,k}^{m} a_{ijk}^1 x_1^i y_1^j z_1^k, \quad i + j + k \le m.$$

I want to use Mathematica to come up with a general expression for the coefficient terms $$a_{ijk}^1$$ in front of each monomial in the resultant polynomial. In Mathematica, if I explicitly specify the degree $$m$$, make the substitution for $$x_0, y_0, z_0$$ and evaluate the original sum then I can get the output for each new coefficient. However, is there a way to evaluate this in Mathematica (or another software) in the general case, without specifying a degree?

Edit: Here is the code to find the coefficients for a polynomial of deg 2:

x0 = m11*x1 + m12*y1 + m13*z1 + b1
y0 = m21*x1 + m22*y1 + m23*z1 + b2
z0 = m31*x1 + m32*y1 + m33*z1 + b3
m = 2
eqn = Sum[If[i + j + k <= m, Subscript[a, i, j, k]*x0^i*y0^j*z0^k, 0], {i, 0, m}, {j, 0, m}, {k, 0, m}]
Plus @@ MonomialList[Expand[eqn], {x1, y1, z1}]

• Please add your expressions in MMA code, not as LaTeX, so we don't have to rewrite everything to play around with it. Also, since you say that have already done so successfully in some cases, please also include that case as code as well. – MarcoB Dec 11 '19 at 16:19

Hint.

x0 = m11*x1 + m12*y1 + m13*z1 + b1
y0 = m21*x1 + m22*y1 + m23*z1 + b2
z0 = m31*x1 + m32*y1 + m33*z1 + b3
m = 2
eqn = Sum[If[i + j + k <= m, Subscript[a, i, j, k]*x0^i*y0^j*z0^k, 0], {i, 0, m}, {j, 0, m}, {k, 0, m}]
coefs = Flatten[CoefficientRules[eqn, {x1, y1, z1}]]

For[i = 1; Lindex = {}, i <= Length[coefs], i++, AppendTo[Lindex, First[coefs[[i]]]]];
n = Max[Lindex];
As = Flatten[Array[Subscript[A, #1, #2, #3] &, {n, n, n}]];
For[i = 1; ListA = {}, i <= Length[coefs], i++, {u, v, w} = First[coefs[[i]]];
AppendTo[ListA, Subscript[A, u, v, w] -> Last[coefs[[i]]]]]

ListA

• Thanks, this is great way to get the coefficients but only if the degree of the polynomial is defined like it was defined m=2 above. What I am really after is a general expression for the coefficients for a polynomial of any degree. Is there a way to do such a thing in Mathematica? – sm89 Dec 11 '19 at 17:52