1.3 Qualitative Technique:  Slope Fields

September 4, 1998

Sample Slope Field

> with(DEtools);#This loads the package containing dfieldplot.

> dfieldplot( diff(y(t),t) = y*t-t^3, y(t),
           t=-3..3, y=-3..3, arrows=line );#This plots the slope field (or "direction field").

> dsolve(diff(y(t),t) = y(t)*t-t^3);

> with(plots):
plot1:=plot(t^2+2-4*exp(t^2/2),t=-3..3):

plot2:=plot(t^2+2-3*exp(t^2/2),t=-3..3):

plot3:=plot(t^2+2-2*exp(t^2/2),t=-3..3):

plot4:=plot(t^2+2-exp(t^2/2),t=-3..3):

plot5:=plot(t^2+2,t=-3..3):

plot6:=plot(t^2+2+exp(t^2/2),t=-3..3):

plot7:=dfieldplot( diff(y(t),t) = y*t-t^3, y(t),

           t=-3..3, y=-3..6, arrows=line,color=blue ):

plot8:=plot(t^2,t=-3..3,color=green):

display([plot1,plot2,plot3,plot4,plot5,plot6,plot7,plot8]);

The On-Off RC Circuit

> V:=t->Heaviside(sin(Pi*t));

V := proc (t) options operator, arrow; Heaviside(sin(Pi*t)) end proc

> plot(V(t),t=0.00001..10.0001);

[Plot]

> dfieldplot(diff(vc(t),t)=V(t)-vc(t),vc(t),t=0..5,vc=0..2,             arrows=line);

[Plot]

> dsolve(diff(vc(t),t)=V(t)-vc(t));

vc(t) = exp(-t)*Int(Heaviside(sin(Pi*t))*exp(t), t)+exp(-t)*_C1

> plot1:=plot(exp(-t)*Int(Heaviside(sin(Pi*s))*exp(s),s=0..t)+exp(-t)*1,t=0..10):
plot2:=plot(exp(-t)*Int(Heaviside(sin(Pi*s))*exp(s),s=0..t)+exp(-t)*2,t=0..10):

plot0:=dfieldplot(diff(vc(t),t)=V(t)-vc(t),vc(t),t=0..10,vc=0..2,             arrows=line,color=blue):

display([plot0,plot1,plot2]);

[Plot]