e.g. something like sage: gp.eval("square(x)=x^2") '(x)->x^2' sage: gp.function_call("square",[20]).sage() 400
So one can have def foo(x): return gp.function_call("square",[x]).sage() to create a Sage function that will square a number using GP On Sun, Jan 12, 2020 at 2:26 PM Dima Pasechnik <dimp...@gmail.com> wrote: > > this way Python does not know anything about GP functions. > You need to pass the input/output from/to Python. > > On Sun, 12 Jan 2020, 14:06 Pedja, <tersi...@gmail.com> wrote: >> >> Why the following code doesn't work inside Sage Cell? >> >> gp(""" >> square(x)=x^2; >> """) >> >> @interact >> def _(x=2): >> print(square(x)) >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sage-support" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to sage-support+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/sage-support/25a5f980-f93d-4721-94d4-e5f1677b285d%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CAAWYfq0rwwUEQFxmexC9vn8PaLczFSBFGSekYQFQMKi5bTPFFw%40mail.gmail.com.