ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 13 Nov 2017 23:03:09 -0600Magma coercion equivalent in Sage?http://ask.sagemath.org/question/39521/magma-coercion-equivalent-in-sage/I'm working on converting a code written in Magma to Sage. I have something like this in Magma:
Fp;=FiniteField(p);
if (p mod 4) eq 3 then
q:=1;
else
q:=3;
while IsSquare(-Fp!q) do
q:=q+4;
end while;
end if;
Now there is the `!` operator used, which is called coercion in Magma. Is there an equivalent operator in Sage? I mean how would one conver the `IsSquare(-Fp!q)` part valid Sage?Mon, 13 Nov 2017 16:23:49 -0600http://ask.sagemath.org/question/39521/magma-coercion-equivalent-in-sage/Answer by slelievre for <p>I'm working on converting a code written in Magma to Sage. I have something like this in Magma:</p>
<pre><code>Fp;=FiniteField(p);
if (p mod 4) eq 3 then
q:=1;
else
q:=3;
while IsSquare(-Fp!q) do
q:=q+4;
end while;
end if;
</code></pre>
<p>Now there is the <code>!</code> operator used, which is called coercion in Magma. Is there an equivalent operator in Sage? I mean how would one conver the <code>IsSquare(-Fp!q)</code> part valid Sage?</p>
http://ask.sagemath.org/question/39521/magma-coercion-equivalent-in-sage/?answer=39524#post-id-39524The coercion of `q` to `Fp` is just achieved by `Fp(q)` in Sage.
Mon, 13 Nov 2017 23:03:09 -0600http://ask.sagemath.org/question/39521/magma-coercion-equivalent-in-sage/?answer=39524#post-id-39524