ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 18 Nov 2019 08:49:06 -0600simple script gives "ValueError: element is not in the prime field"https://ask.sagemath.org/question/48794/simple-script-gives-valueerror-element-is-not-in-the-prime-field/ I have a very simple script that does not work. It is the following.
for a in range(1,r):
for b in range(1,r):
g=a+b*x^2+x^4
if g.is_irreducible():
K.<a>=FiniteField(r^4, name='a', modulus = g)
if a^l != 1:
print("hooray")
Here l is defined somewhere else, but that is not what gives the error I think. I think the error occurs when sage goes over the line "K.<a>=FiniteField(r^4, name='a', modulus = g)", because maybe the line "g=a+b*x^2+x^4" does not work? If I do this script manually without the for loops, by just assigning some values to a and b, then it works fine.
Mon, 18 Nov 2019 07:02:03 -0600https://ask.sagemath.org/question/48794/simple-script-gives-valueerror-element-is-not-in-the-prime-field/Comment by rburing for <p>I have a very simple script that does not work. It is the following.</p>
<pre><code>for a in range(1,r):
for b in range(1,r):
g=a+b*x^2+x^4
if g.is_irreducible():
K.<a>=FiniteField(r^4, name='a', modulus = g)
if a^l != 1:
print("hooray")
</code></pre>
<p>Here l is defined somewhere else, but that is not what gives the error I think. I think the error occurs when sage goes over the line "K.=FiniteField(r^4, name='a', modulus = g)", because maybe the line "g=a+b*x^2+x^4" does not work? If I do this script manually without the for loops, by just assigning some values to a and b, then it works fine.</p>https://ask.sagemath.org/question/48794/simple-script-gives-valueerror-element-is-not-in-the-prime-field/?comment=48796#post-id-48796The error depends on the information you've omitted, such as the definition of `r`, `l`, and `x`. As a general rule, please give an unambiguous self-contained example that produces the error. Probably the problem is that `l` cannot be lifted to an integer.Mon, 18 Nov 2019 08:49:06 -0600https://ask.sagemath.org/question/48794/simple-script-gives-valueerror-element-is-not-in-the-prime-field/?comment=48796#post-id-48796