Ask Your Question
1

Mixing GP and @interact in one cell

asked 2020-01-11 19:03:01 +0100

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 08:42:34 +0100

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 19:03:01 +0100

Seen: 273 times

Last updated: Jan 13 '20