Ask Your Question

syntex error

asked 2016-09-16 07:42:34 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

[this line is inserted to help code formatting]

print "Prime field P=",p
F.<a> = GF(p);F
K.<b> = F.extension(x^2+(a^2+a+1)*x +a^2) ;K

when i run the code following error obtained on my macbook sage terminal and sage math cloud

Prime field P= 8
Finite Field in a of size 2^3

Error in lines 4-4
Traceback (most recent call last):
  File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/smc_sagews/", line 957, in execute
    exec compile(block+'\n', '', 'single') in namespace, locals
  File "", line 1, in <module>
  File "sage/rings/finite_rings/finite_field_base.pyx", line 1193, in sage.rings.finite_rings.finite_field_base.FiniteField.extension (/projects/sage/sage-7.3/src/build/cythonized/sage/rings/finite_rings/finite_field_base.c:12767)
    E = Field.extension(self, modulus, name=name, embedding=embedding)
  File "sage/rings/ring.pyx", line 1486, in sage.rings.ring.CommutativeRing.extension (/projects/sage/sage-7.3/src/build/cythonized/sage/rings/ring.c:13322)
    poly = poly.polynomial(self)
  File "sage/rings/polynomial/multi_polynomial.pyx", line 449, in sage.rings.polynomial.multi_polynomial.MPolynomial.polynomial (/projects/sage/sage-7.3/src/build/cythonized/sage/rings/polynomial/multi_polynomial.c:6868)
    raise ValueError("var must be one of the generators of the parent polynomial ring.")
***ValueError: var must be one of the generators of the parent polynomial ring.**
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-09-16 15:27:07 +0200

nbruin gravatar image

You didn't define "x", so your result depends on what its value happens to be. What the error indicates (although perhaps not so clearly) is that you need:


before the definition of K.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-09-16 07:42:34 +0200

Seen: 287 times

Last updated: Sep 16 '16