ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 02 Jun 2019 22:55:35 +0200How to sum or product of two elements of two different fields?https://ask.sagemath.org/question/46768/how-to-sum-or-product-of-two-elements-of-two-different-fields/ I would like to sum of product two elements from different fields and the resultant operation should be in the bigger field. I have used the following codes, but it gives errors.
R.<x> = PolynomialRing(GF(2))
F = GF(2^3, name='x', modulus=x^3 + x^2 + 1)
G = GF(2^8, name='x', modulus=x^8 + x^5 + x^3 + x + 1)
print F.fetch_int(3)
print G.fetch_int(5)
#F.fetch_int(3) => x + 1
#G.fetch_int(5) => x^2 + 1
#print F.fetch_int(3)*G.fetch_int(5)
print (x^2 + 1)*(x + 1)Sun, 02 Jun 2019 07:47:14 +0200https://ask.sagemath.org/question/46768/how-to-sum-or-product-of-two-elements-of-two-different-fields/Comment by tmonteil for <p>I would like to sum of product two elements from different fields and the resultant operation should be in the bigger field. I have used the following codes, but it gives errors. </p>
<pre><code>R.<x> = PolynomialRing(GF(2))
F = GF(2^3, name='x', modulus=x^3 + x^2 + 1)
G = GF(2^8, name='x', modulus=x^8 + x^5 + x^3 + x + 1)
print F.fetch_int(3)
print G.fetch_int(5)
#F.fetch_int(3) => x + 1
#G.fetch_int(5) => x^2 + 1
#print F.fetch_int(3)*G.fetch_int(5)
print (x^2 + 1)*(x + 1)
</code></pre>
https://ask.sagemath.org/question/46768/how-to-sum-or-product-of-two-elements-of-two-different-fields/?comment=46772#post-id-46772Is it homework ?Sun, 02 Jun 2019 22:55:35 +0200https://ask.sagemath.org/question/46768/how-to-sum-or-product-of-two-elements-of-two-different-fields/?comment=46772#post-id-46772Answer by tmonteil for <p>I would like to sum of product two elements from different fields and the resultant operation should be in the bigger field. I have used the following codes, but it gives errors. </p>
<pre><code>R.<x> = PolynomialRing(GF(2))
F = GF(2^3, name='x', modulus=x^3 + x^2 + 1)
G = GF(2^8, name='x', modulus=x^8 + x^5 + x^3 + x + 1)
print F.fetch_int(3)
print G.fetch_int(5)
#F.fetch_int(3) => x + 1
#G.fetch_int(5) => x^2 + 1
#print F.fetch_int(3)*G.fetch_int(5)
print (x^2 + 1)*(x + 1)
</code></pre>
https://ask.sagemath.org/question/46768/how-to-sum-or-product-of-two-elements-of-two-different-fields/?answer=46771#post-id-46771Regarding mathematics, how could F be embedded in G ? How could the generator "x" of F be the same that the generator "x" of G ?
Regarding Sage code, you can have a look at https://doc.sagemath.org/html/en/reference/coding/sage/coding/relative_finite_field_extension.htmlSun, 02 Jun 2019 22:52:13 +0200https://ask.sagemath.org/question/46768/how-to-sum-or-product-of-two-elements-of-two-different-fields/?answer=46771#post-id-46771