from __future__ import division from visual import * dx = 0.05 g = curve(x=arange(-10,10,dx), color=color.green) scene.autoscale =0 wlth = 2.0 omega = pi t = 0.0 dt = 0.005 #### add traveling waves while 1: for pt in g.pos: pt[1]=2.5*cos(omega*t-2*pi*pt[0]/wlth)+2.5*cos(omega*t+2*pi*pt[0]/wlth) t = t+dt #### or product of cosines ##while 1: ## for pt in g.pos: ## pt[1]=5*cos(2*pi*pt[0]/wlth)*cos(omega*t) ## t = t+dt