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, 13 Jan 2020 08:42:34 +0100Mixing GP and @interact in one cellhttps://ask.sagemath.org/question/49508/mixing-gp-and-interact-in-one-cell/ What's wrong with my code? It doesn't work inside Sage Cell.
gp("""
square(x)=x^2;
""")
@interact
def _(x=2):
print(square(x))
When I press evaluate button code runs forever with no output at all. I can't figure out what is the problem.Sat, 11 Jan 2020 19:03:01 +0100https://ask.sagemath.org/question/49508/mixing-gp-and-interact-in-one-cell/Answer by Pedja for <p>What's wrong with my code? It doesn't work inside Sage Cell. </p>
<pre><code>gp("""
square(x)=x^2;
""")
@interact
def _(x=2):
print(square(x))
</code></pre>
<p>When I press evaluate button code runs forever with no output at all. I can't figure out what is the problem.</p>
https://ask.sagemath.org/question/49508/mixing-gp-and-interact-in-one-cell/?answer=49524#post-id-49524The following code works:
gp.eval("square(x)=x^2")
@interact
def _(x=2):
print(gp.function_call("square",[x]).sage())Mon, 13 Jan 2020 08:42:34 +0100https://ask.sagemath.org/question/49508/mixing-gp-and-interact-in-one-cell/?answer=49524#post-id-49524