Multiply polynomials from different rings
Suppose I take a polynomial from K[x], say x2+5x, and another polynomial from K[y], say y3. I want to formally multiply them and get x2y3+5xy3 as the output.
How can I do that?
Note: K
is the finite field of size 4 in a
.
My efforts:
sage: K.<a> = FiniteField(4)
sage: R_1 = PolynomialRing(K, ['z%s' % p for p in range(1, 3)])
sage: R_2 = PolynomialRing(K, ['x%s' % p for p in range(1, 3)])
sage: pp = R_1.random_element()
sage: pp
(a + 1)*z1^2 + (a)*z1*z2 + (a + 1)*z2 + (a)
sage: qq = R_2.random_element()
sage: qq
x1*x2 + (a + 1)*x2^2 + x1 + 1
When I do pp*qq
I get the following output
unsupported operand parent(s) for *: 'Multivariate Polynomial Ring
in z1, z2 over Finite Field in a of size 2^2' and 'Multivariate Polynomial
Ring in x1, x2 over Finite Field in a of size 2^2'