Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I am afraid there is more then one syntax error ;-)

You forgot to declare t as variable.

@interact has to be followed by the definition of a function, not by print statement.

You have to repeat the @interact decorator for each interacting function.

missing ':' after else.

in parametric_plot( ( x(t), y(t) ), ...) you need a tuple of functions.

My sage version (4.7.1) don't know ContiniousSlider.

var('t')
print "Choose 1 for Lissajous curve and 2 for beat"
@interact
def choise(v =(1..2)):
  if v==1:
    @interact
    def lissa(delta =(-pi,pi),a = (1..10),b = (1,10)):
      p = parametric_plot((cos(a*t+delta),cos(b*t)),(t,0,5*pi))
      p.show()
  else:
    @interact
    def beat(a = (0,5), omega = (0,5),percent = (0,0.1)):
      domega = percent*omega;
      p = parametric_plot((2*a*cos(domega/2*t)*cos(omega*t),2*a*cos(domega/2*t)),(t,0,5*pi))
      p.show()

I am afraid there is more then one syntax error ;-)

You forgot to declare t as variable.

@interact has to be followed by the definition of a function, not by print statement.

You have to repeat the @interact decorator for each interacting function.

missing ':' after else.

in parametric_plot( ( x(t), y(t) ), , ...) is wrong, you need a tuple of functions.

functions parametric_plot( ( x(t), y(t) ), ...).

( My sage version (4.7.1) don't doesn't know ContiniousSlider.ContiniousSlider ).

var('t')
print "Choose 1 for Lissajous curve and 2 for beat"
@interact
def choise(v =(1..2)):
  if v==1:
    @interact
    def lissa(delta =(-pi,pi),a = (1..10),b = (1,10)):
      p = parametric_plot((cos(a*t+delta),cos(b*t)),(t,0,5*pi))
      p.show()
  else:
    @interact
    def beat(a = (0,5), omega = (0,5),percent = (0,0.1)):
      domega = percent*omega;
      p = parametric_plot((2*a*cos(domega/2*t)*cos(omega*t),2*a*cos(domega/2*t)),(t,0,5*pi))
      p.show()

I am afraid there is more then one syntax error ;-)

You forgot to declare t as variable.

@interact has to be followed by the definition of a function, not by print statement.

You have to repeat the @interact decorator for each interacting function.

missing ':' after else.

in In parametric_plot( x(t), y(t) , ...) is wrong,

you need a tuple of functions parametric_plot( ( x(t), y(t) ), ...).

( My sage version (4.7.1) doesn't know ContiniousSlider ).

var('t')
print "Choose 1 for Lissajous curve and 2 for beat"
@interact
def choise(v =(1..2)):
  if v==1:
    @interact
    def lissa(delta =(-pi,pi),a = (1..10),b = (1,10)):
      p = parametric_plot((cos(a*t+delta),cos(b*t)),(t,0,5*pi))
      p.show()
  else:
    @interact
    def beat(a = (0,5), omega = (0,5),percent = (0,0.1)):
      domega = percent*omega;
      p = parametric_plot((2*a*cos(domega/2*t)*cos(omega*t),2*a*cos(domega/2*t)),(t,0,5*pi))
      p.show()

I am afraid there is more then than one syntax error ;-)

You forgot to declare t as variable.

@interact has to be followed by the definition of a function, not by print statement.

You have to repeat the @interact decorator for each interacting function.

missing ':' after else.

In parametric_plot( x(t), y(t) , ...) is wrong,

you need a tuple of functions parametric_plot( ( x(t), y(t) ), ...).

( My sage version (4.7.1) doesn't know ContiniousSlider ).

var('t')
print "Choose 1 for Lissajous curve and 2 for beat"
@interact
def choise(v =(1..2)):
  if v==1:
    @interact
    def lissa(delta =(-pi,pi),a = (1..10),b = (1,10)):
      p = parametric_plot((cos(a*t+delta),cos(b*t)),(t,0,5*pi))
      p.show()
  else:
    @interact
    def beat(a = (0,5), omega = (0,5),percent = (0,0.1)):
      domega = percent*omega;
      p = parametric_plot((2*a*cos(domega/2*t)*cos(omega*t),2*a*cos(domega/2*t)),(t,0,5*pi))
      p.show()