Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

unable to use interact

Hi guys.

I'm tying to use interact to show a plot. I input the following commands:

@interact
def _(a=(0,2)):
    show(plot(sin(x*(1+a*x)), (x,0,6)), figsize=4)

which I found typing help(sage) and got an error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_171.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8
-*-\\n" +
_support_.preparse_worksheet_cell(base64.b64decode("X2ludGVyYWN0Xy5yZWNv\
bXB1dGUoIjc1Iik="),globals())+"\\n");
execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single')
  File "", line 1, in <module>

  File "/tmp/tmpgG2nqV/___code___.py", line 2, in <module>
    exec compile(u'_interact_.recompute("75")' + '\n', '', 'single')
  File "", line 1, in <module>

  File
"/home/yotam/Documents/Apps/sage/sage-4.5.2-linux-32bit-ubuntu_10.04_lts\
-i686-Linux/local/lib/python2.6/site-packages/sagenb-0.8.2-py2.6.egg/sag\
enb/notebook/interact.py", line 3746, in recompute
    S['function']()
  File
"/home/yotam/Documents/Apps/sage/sage-4.5.2-linux-32bit-ubuntu_10.04_lts\
-i686-Linux/local/lib/python2.6/site-packages/sagenb-0.8.2-py2.6.egg/sag\
enb/notebook/interact.py", line 2558, in _
    z = f(*[variables[arg] for arg in args])
  File "/tmp/tmpE4fUak/___code___.py", line 5, in _
    show(plot(sin(x*(_sage_const_1 +a*x)), (x,_sage_const_0
,_sage_const_6 )), figsize=_sage_const_4 )
TypeError: can't multiply sequence by non-int of type 'float'

What have I missed?