interact in Simple Compute Server

20 views
Skip to first unread message

Francisco Botana

unread,
Dec 23, 2011, 11:14:59 AM12/23/11
to sage-n...@googlegroups.com
Hi,

I get a "name 'y' is not defined" when evaluating in the Single Compute
Server

var('y')
@interact
def example(f=4*x*exp(-x^2-y^2)):
plot3d(f, (x, 0,1), (y,0,1)).show()

if I change, say, 'y^2' by 'y^3' (that is, the first plot is ok. The
error appears when changing the function). Nevertheless, the same code
works in the standard notebook.

Any hint?
Thanks,
Francisco

Jason Grout

unread,
Dec 23, 2011, 11:30:25 AM12/23/11
to sage-n...@googlegroups.com

I just pasted your code into sagemath.org:5467 and up popped a plot;
there were no error messages.

Can you try again?

Thanks,

Jason


fbotana

unread,
Dec 23, 2011, 1:11:02 PM12/23/11
to sage-notebook
Jason, *first* interact running is OK, but, change *inside* the
interact 'y^2' by 'y^3', for instance. I get the reported error once I
modified the function. sagemath.org:5467 answers as I state.

Thanks,
Francisco

Jason Grout

unread,
Dec 24, 2011, 11:39:57 AM12/24/11
to sage-n...@googlegroups.com
On 12/23/11 12:11 PM, fbotana wrote:
> Jason, *first* interact running is OK, but, change *inside* the
> interact 'y^2' by 'y^3', for instance. I get the reported error once I
> modified the function. sagemath.org:5467 answers as I state.
>

Thanks for clarifying. I see that in your original message now.

I tracked down where the problem is (it isn't evaluating changes in the
same context as the original function). We completely rewrote interacts
for the singlecell, and I've identified the code in the old interact
that implements the necessary feature. We'll work on fixing this bug,
which is tracked here:
https://github.com/jasongrout/simple-python-db-compute/pull/216

Thanks,

Jason

fbotana

unread,
Dec 25, 2011, 7:20:07 AM12/25/11
to sage-notebook
Thank you very much!

BTW, the problem does not appear when using 'input_box':

var('y')
@interact
def example(f=input_box(default=4*x*exp(-x^2-y^2))):
plot3d(f, (x, 0,1), (y,0,1)).show()

Francisco
Reply all
Reply to author
Forward
0 new messages