lec8_anim_diffeqn

lec8_anim_diffeqn - from pylab import * #-SLIDE 3-#from...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
from pylab import * #---SLIDE 3---- #from pylab import * #def mysin(x,k): # return sin(k*x) #x=linspace(0,4*np.pi,400) ##NOTE ','after line! #line, = plot(x,mysin(x,1),'b-') #axis([min(x),max(x),-1.1,1.1]) #k=linspace(0.2,30,20) #for ki in k: # line.set_ydata(mysin(x,ki)) # draw() #-------SLIDE 4--------- #more complicated animation #saveFigs=False # #def gauss(x,A=1.,sig=1.,x0=5.): # return A*np.exp(-(x-x0)**2/sig) # # #close('all') ##dx is the step size in the animation #dx=0.5 #StopX=10 #x=np.arange(0,10,0.02) #StartX=0. ##ion() ### NOTE the trailing comma - "line" needs to be a tuple referring to a particular curve #line,=plot(x,gauss(x,x0=StartX)*np.sin(4*x)) #axis([min(x),max(x),-1,1]) #title("An Animation") #CurrentX=StartX #Reflects=0 #base='wavepacket_' #frameNumber=0 # #while Reflects <=1: # #Check if we need to send the pulse back the other way. # if CurrentX >= StopX or CurrentX < StartX: # dx=-dx # Reflects+=1 # frameNumber+=1 # CurrentX+=dx # #This updates the y-values ony.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/05/2010 for the course PHYS phy503 taught by Professor Gladden during the Spring '09 term at Ole Miss.

Page1 / 3

lec8_anim_diffeqn - from pylab import * #-SLIDE 3-#from...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online