Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I formally multiply two polynomials from different rings.

Suppose I take a polynomial from R[x] say x2+5x and another polynomial from R[y] say y3. I want to formally multiply them and print x2y3+5xy3 as the output.

How can I do that?

Note: K is finite field of size 4 in 'a'

My efforts:

R_1=PolynomialRing(K,['z%s'%p for p in range(1,3)])
R_2=PolynomialRing(K,['x%s'%p for p in range(1,3)])

pp=R_1.random_element()
(a + 1)*z1^2 + (a)*z1*z2 + (a + 1)*z2 + (a)

qq=R_2.random_element()
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'

How can I formally multiply two polynomials from different rings.

Suppose I take a polynomial from R[x] K[x], say x2+5x x2+5x, and another polynomial from R[y] K[y], say y3. y3. I want to formally multiply them and print get $x^2y^3 +5xy^3$ + 5xy^3$ as the output. output.

How can I do that?

Note: K K is the finite field of size 4 in 'a'a.

My efforts:

R_1=PolynomialRing(K,['z%s'%p sage: K.<a> = FiniteField(4)

sage: R_1 = PolynomialRing(K, ['z%s' % p for p in range(1,3)])
R_2=PolynomialRing(K,['x%s'%p range(1, 3)])
sage: R_2 = PolynomialRing(K, ['x%s' % p for p in range(1,3)])

pp=R_1.random_element()
range(1, 3)])

sage: pp = R_1.random_element()
sage: pp
(a + 1)*z1^2 + (a)*z1*z2 + (a + 1)*z2 + (a)

qq=R_2.random_element()
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 Ring
in z1, z2 over Finite Field in a of size 2^2' and 'Multivariate Polynomial Polynomial
Ring in x1, x2 over Finite Field in a of size 2^2'

How can I formally multiply two 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'