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, 14 Nov 2017 06:03:09 +0100Magma coercion equivalent in Sage?https://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 23:23:49 +0100https://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>
https://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.
Tue, 14 Nov 2017 06:03:09 +0100https://ask.sagemath.org/question/39521/magma-coercion-equivalent-in-sage/?answer=39524#post-id-39524