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.Tue, 25 Feb 2020 16:53:17 +0100NumberField NotImplemented Errorhttps://ask.sagemath.org/question/50052/numberfield-notimplemented-error/Hello!
I am currently trying to use NumberFields but I am getting random errors when using them.
I am trying to construct a NumberField by using
K=NumberField(x^2 +x+ 1, 'y')
or
K.<y> = NumberField(x^2+x+1)
Sometimes it works out just fine and other times i just get this NotImplemented Error:
Traceback (most recent call last):
File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1234, in execute flags=compile_flags), namespace, locals)
File "", line 1, in <module>
File "sage/modules/free_module_element.pyx", line 2023, in sage.modules.free_module_element.FreeModuleElement.__pow__ (build/cythonized/sage/modules/free_module_element.c:14871)
raise NotImplementedError
NotImplementedError
And after that I can't make it work anymore.
I tried resetting variables but that doesn't seem to be the problem.
Does anybody might have an idea what causes this issue?
CheersTue, 25 Feb 2020 12:54:32 +0100https://ask.sagemath.org/question/50052/numberfield-notimplemented-error/Answer by rburing for <p>Hello!</p>
<p>I am currently trying to use NumberFields but I am getting random errors when using them.
I am trying to construct a NumberField by using</p>
<pre><code>K=NumberField(x^2 +x+ 1, 'y')
</code></pre>
<p>or</p>
<pre><code>K.<y> = NumberField(x^2+x+1)
</code></pre>
<p>Sometimes it works out just fine and other times i just get this NotImplemented Error:</p>
<pre><code>Traceback (most recent call last):
File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1234, in execute flags=compile_flags), namespace, locals)
File "", line 1, in <module>
File "sage/modules/free_module_element.pyx", line 2023, in sage.modules.free_module_element.FreeModuleElement.__pow__ (build/cythonized/sage/modules/free_module_element.c:14871)
raise NotImplementedError
NotImplementedError
</code></pre>
<p>And after that I can't make it work anymore.
I tried resetting variables but that doesn't seem to be the problem.
Does anybody might have an idea what causes this issue?</p>
<p>Cheers</p>
https://ask.sagemath.org/question/50052/numberfield-notimplemented-error/?answer=50059#post-id-50059Both definitions of `K` are valid *when `x` is a generator of a polynomial ring* (or symbolic).
The error says that `__pow__` is not implemented, because (in this case) your `x` is somehow an element of a free module, so it doesn't make sense to raise it to a power.
So you must have used the name `x` for something else. So don't do that and/or (re)define it as `x = polygen(QQ)` or `R.<x> = QQ[]` or `R.<x> = PolynomialRing(QQ)` (or `var('x')` to make it symbolic), etc.Tue, 25 Feb 2020 15:56:25 +0100https://ask.sagemath.org/question/50052/numberfield-notimplemented-error/?answer=50059#post-id-50059Comment by Erratis for <p>Both definitions of <code>K</code> are valid <em>when <code>x</code> is a generator of a polynomial ring</em> (or symbolic).</p>
<p>The error says that <code>__pow__</code> is not implemented, because (in this case) your <code>x</code> is somehow an element of a free module, so it doesn't make sense to raise it to a power.</p>
<p>So you must have used the name <code>x</code> for something else. So don't do that and/or (re)define it as <code>x = polygen(QQ)</code> or <code>R.<x> = QQ[]</code> or <code>R.<x> = PolynomialRing(QQ)</code> (or <code>var('x')</code> to make it symbolic), etc.</p>
https://ask.sagemath.org/question/50052/numberfield-notimplemented-error/?comment=50062#post-id-50062Hello rburing.
I will try this solution and if the error gets raised again I will report the issue.
Thank you for your quick reply.Tue, 25 Feb 2020 16:53:17 +0100https://ask.sagemath.org/question/50052/numberfield-notimplemented-error/?comment=50062#post-id-50062