Slope Fields
For Various Differential Equations
> | restart:with(DEtools): |
> | DirField:=dfieldplot(diff(y(x),x)=y(x)*cos(x),y(x),x=0..6.28,y=-3.14..3.14,color=BLUE,arrows=MEDIUM,axes=BOXED): |
> | with(plots): |
Warning, the name changecoords has been redefined
> | soln1:=plot(exp(sin(x)),x=0..6.28,y=0..3.14,color=red,thickness=2): |
> | soln2:=plot(-exp(sin(x)),x=0..6.28,y=0..3.14,color=red,thickness=2): |
> | soln3:=plot(0.4*exp(sin(x)),x=0..6.28,y=0..3.14,color=red,thickness=2): |
> | soln4:=plot(-0.4*exp(sin(x)),x=0..6.28,y=0..3.14,color=red,thickness=2): |
> | display(DirField,soln1,soln2,soln3,soln4); |
> | restart:with(DEtools): |
> | DirField:=dfieldplot(diff(y(x),x)=(y(x)*exp(-x)-sin(x))/(exp(-x)+2*y(x)),y(x),x=0..10,y=-1..2,color=BLUE,arrows=MEDIUM,axes=BOXED): |
> | with(plots): |
> | display(DirField); |
> | DirField:=dfieldplot(diff(y(x),x)=2*y(x)/x+sin(3*x)*x^2,y(x),x=1.57..8,y=-90..90,color=BLUE,arrows=MEDIUM,axes=BOXED): |
> | with(plots): |
> | display(DirField); |
Here is an animation of solutions for various initial conditions.
> | animate((-1/3)*(x^2)*cos(3*x)+(4*t/3.14^2)*x^2,x=1.57..8,t=-3..3,frames=13); |
> | SolnPics:=animate((-1/3)*(x^2)*cos(3*x)+(4*t/3.14^2)*x^2,x=1.57..8,t=-3..3,thickness=2,frames=13): |
> | display(DirField,SolnPics); |
> | DirFieldb:=dfieldplot(diff(y(x),x)=2*y(x)/x+sin(3*x)*x^2,y(x),x=1.57..8,y=0..65,color=BLUE,arrows=MEDIUM,axes=BOXED): |
> | Solnb:=plot((-1/3)*(x^2)*cos(3*x)+(8/Pi^2)*x^2,x=Pi/2..8,y=0..65,thickness=2): |
> | display(DirFieldb,Solnb); |
> | DirField2:=dfieldplot(diff(y(x),x)=0.01*y(x)*(100-y(x)),y(x),x=0..20,y=-10..110,color=BLUE,arrows=MEDIUM,axes=BOXED): |
> | Soln2:=plot(100*exp(x)/(9+exp(x)),x=0..20,y=-10..110,thickness=2): |
> | display(DirField2,Soln2); |
> | DirField3:=dfieldplot(diff(y(x),x)=y(x)/x+(y(x)/x)^2,y(x),x=1..4,y=-40..40,color=BLUE,arrows=MEDIUM,axes=BOXED): |
> | Soln3:=plot(x/(1-ln(x)),x=1..4,y=-40..40,thickness=2): |
> | display(DirField3,Soln3); |
> | DirField4:=dfieldplot(diff(y(x),x)=(y(x)*exp(-x)-sin(x))/(exp(-x)+2*y(x)),y(x),x=0..20,y=-1..2,color=BLUE,arrows=MEDIUM,axes=BOXED): |
> | Soln4:=plot((-exp(-x)+sqrt(exp(-2*x)+4*cos(x)+4))/2,x=0..20,y=-1..2,thickness=2): |
> | display(DirField4,Soln4); |
> | DirField5:=dfieldplot(diff(y(x),x)=(y(x)*exp(-x)-sin(x))/(exp(-x)+2*y(x)),y(x),x=0..8,y=0..1.5,color=BLUE,arrows=MEDIUM,axes=BOXED): |
> | Soln5:=plot((-exp(-x)+sqrt(exp(-2*x)+4*cos(x)+4))/2,x=0..8,y=0..1.5,thickness=2): |
> | display(DirField5,Soln5); |
> | DirField6:=dfieldplot(diff(y(x),x)=(y(x)*exp(-x)-sin(x))/(exp(-x)+2*y(x)),y(x),x=2.8..3.4,y=0..0.3,color=BLUE,arrows=MEDIUM,axes=BOXED): |
> | Soln6:=plot((-exp(-x)+sqrt(exp(-2*x)+4*cos(x)+4))/2,x=2.8..3.4,y=0..0.3,thickness=2): |
> | display(DirField6,Soln6); |
> | DirField7:=dfieldplot(diff(y(x),x)=(y(x)*exp(-x)-sin(x))/(exp(-x)+2*y(x)),y(x),x=3.1..3.18,y=0..0.02,color=BLUE,arrows=MEDIUM,axes=BOXED): |
> | Soln7:=plot((-exp(-x)+sqrt(exp(-2*x)+4*cos(x)+4))/2,x=3.1..3.18,y=0..0.02,thickness=2): |
> | display(DirField7,Soln7); |
> | DirField8:=dfieldplot(diff(y(x),x)=(y(x)*exp(-x)-sin(x))/(exp(-x)+2*y(x)),y(x),x=6.24..6.32,y=1.4128..1.4134,color=BLUE,arrows=MEDIUM,axes=BOXED): |
> | Soln8:=plot((-exp(-x)+sqrt(exp(-2*x)+4*cos(x)+4))/2,x=6.24..6.32,y=1.4128..1.4134,thickness=2): |
> | display(DirField8,Soln8); |
> | DirField9:=dfieldplot(diff(y(x),x)=(2*y(x)*sin(x)-3)/cos(x),y(x),x=0..4*Pi,y=-10..10,color=BLUE,arrows=MEDIUM,axes=BOXED): |
> | Soln9:=plot((1-3*sin(x))/(1-(sin(x))^2),x=0..4*Pi,y=-10..10,thickness=2): |
> | display(DirField9,Soln9); |
> | DirField10:=dfieldplot(diff(y(x),x)=(2*y(x)*sin(x)-3)/cos(x),y(x),x=Pi/2..3*Pi/2,y=-10..10,color=BLUE,arrows=MEDIUM,axes=BOXED): |
> | Soln10:=plot((1-3*sin(x))/(1-(sin(x))^2),x=Pi/2..3*Pi/2,y=-10..10,thickness=2): |
> | display(DirField10,Soln10); |
> |