# # This worksheet contains some of the computations for problems 2 and 4 # of the first exam. # > with(DEtools):with(plots): # # The computations for problem 2 are below. # > f:=y^2*(y-6);df:=diff(f,y); > subs(y=0,df);subs(y=6,df); > plot(f,y=-2..2); > DEplot(diff(y(t),t)=subs(y=y(t),f),[y(t)],t=0..0.01,{[y(0)=0],[y(0)=1] > ,[y(0)=3],[y(0)=6],[y(0)=5],[y(0)=7]},arrows=NONE); # # Problem 4 calculations follow. # > eq1:=0.3*x-0.1*x*y,-0.1*y+2*x*y;eq2:=0.3*x-3*x*y,-2*y+0.1*x*y; > solve({eq1},{x,y}); > nullclines:=plot({[[0,3],[.25,3]],[[.05,2],[.05,4]]},x=-.01..0.25,y=2. > .4,thickness=3): > dirfield:=DEplot([diff(x(t),t)=subs({x=x(t),y=y(t)},eq1[1]),diff(y(t), > t)=subs({x=x(t),y=y(t)},eq1[2])],[x(t),y(t)],t=0..1,x=0..0.25,y=2..4,d > irgrid=[20,10]): > text:=textplot({[0.15,3.5,'1'],[0.02,3.5,'2'],[0.02,2.5,'3'],[0.15,2.5 > ,'4']},font=[TIMES,BOLD,24]): > display({nullclines,dirfield,text},title=`Direction field at > (0.5,3)`); > x[0]:=25;y[0]:=10; > i:='i':for i from 1 to 2 do > x[i]:=x[i-1]+subs({x=x[i-1],y=y[i-1]},eq2[1]); > y[i]:=y[i-1]+subs({x=x[i-1],y=y[i-1]},eq2[2]);od; > >