Ask Your Question
1

Mixing GP and @interact in one cell

asked 2020-01-11 12:03:01 -0500

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-01-13 01:42:34 -0500

The following code works:

gp.eval("square(x)=x^2")
@interact
def _(x=2):
    print(gp.function_call("square",[x]).sage())
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-01-11 12:03:01 -0500

Seen: 44 times

Last updated: Jan 13