Ask Your Question

# Revision history [back]

Hello yotama9,

I copied your code as-is into a new Sage Notebook and received no error. I have some guesses, though, as to what might be wrong.

• _(Not as likely.)_ You have an extra comma somewhere where it shouldn't.
• _(More likely.)_ You defined x as a list / tuple / Sequence somewhere previously. I tried the following and got a similar error:

(In Notebook:)

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

Traceback (most recent call last):
...
TypeError: can't multiply sequence by non-int of type 'float'


That last line in the error text says that you're trying to multiply a list by a number. One way to fix this is to include the line statement x = var('x') just before the show(plot(...)) statement. That way x will locally (within the interact function) be a variable yet outside it will continue to be your list.