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.Mon, 27 Jan 2020 12:13:58 +0100Polynomial evaluation over finite fieldshttps://ask.sagemath.org/question/49688/polynomial-evaluation-over-finite-fields/Hello, how do I make Sagemath understand that it should evaluate polynomials in a finite field?
Currently, this is how I'm declaring my polynomial ring.
R.<x>=GF(5)[]
f=x^2
f(5)
>>> 25
Am I not declaring my polynomial ring properly?
I want to make Sagemath understand that whenever it sees a variable $x$, it should treat the polynomial as one being declared over $GF(5)$. How do I make Sagamath output $f(5)=0$ instead?Mon, 27 Jan 2020 09:54:23 +0100https://ask.sagemath.org/question/49688/polynomial-evaluation-over-finite-fields/Answer by rburing for <p>Hello, how do I make Sagemath understand that it should evaluate polynomials in a finite field?</p>
<p>Currently, this is how I'm declaring my polynomial ring.</p>
<pre><code>R.<x>=GF(5)[]
f=x^2
f(5)
>>> 25
</code></pre>
<p>Am I not declaring my polynomial ring properly?</p>
<p>I want to make Sagemath understand that whenever it sees a variable $x$, it should treat the polynomial as one being declared over $GF(5)$. How do I make Sagamath output $f(5)=0$ instead?</p>
https://ask.sagemath.org/question/49688/polynomial-evaluation-over-finite-fields/?answer=49689#post-id-49689This should work (since forever?). On 9.0:
sage: R.<x>=GF(5)[]
sage: f=x^2
sage: f(5)
0
sage: f(5).parent() is GF(5)
True
What version of SageMath are you using?Mon, 27 Jan 2020 10:42:42 +0100https://ask.sagemath.org/question/49688/polynomial-evaluation-over-finite-fields/?answer=49689#post-id-49689Comment by Stockfish3709 for <p>This should work (since forever?). On 9.0:</p>
<pre><code>sage: R.<x>=GF(5)[]
sage: f=x^2
sage: f(5)
0
sage: f(5).parent() is GF(5)
True
</code></pre>
<p>What version of SageMath are you using?</p>
https://ask.sagemath.org/question/49688/polynomial-evaluation-over-finite-fields/?comment=49693#post-id-49693I'm using Sagemath 8.5. Perhaps that is the problem?Mon, 27 Jan 2020 12:13:58 +0100https://ask.sagemath.org/question/49688/polynomial-evaluation-over-finite-fields/?comment=49693#post-id-49693