Note to new Mathematica users

To execute the cell you are currently in, press Shift-Enter. The cells in this notebook are intended to be executed in order, but you can also go back and modify earlier commands.

Slope Fields

Setup

NormalizeVector[{v_,w_}]=(1/(Sqrt[v^2+w^2])){v,w};

Constant Slope

constantSlopeField=VectorPlot[
NormalizeVector[{1,1}],{x,0,5},{y,0,5},
VectorPoints->16,VectorStyle->"Segment",VectorScale->{0.025, Scaled[1],#5&}
]

Linear DE

linearDESlopeField=VectorPlot[
NormalizeVector[{1,y-x}],{x,0,5},{y,-1,4},
VectorPoints->16,VectorStyle->"Segment",VectorScale->{0.02, Scaled[1],#5&}
]

Solution to this DE through the point (x0, y0) :

linearDESolution[x0_,y0_, x_] =x + 1 + (y0 -x0- 1) (E^(x-x0));

linearDEPlots=Plot[{
linearDESolution[0,0,x],
linearDESolution[0,1,x],
linearDESolution[0,0.75,x],
linearDESolution[0,1.25,x],
linearDESolution[2,2,x]
},{x,0,5},PlotRange->{-1,4}];
Show[linearDESlopeField,linearDEPlots]

Newton' s Law of Cooling

newtonSlopeField = VectorPlot[
NormalizeVector[{1,0.1(40-T)}],{t,0,60},{T,0,100},
VectorPoints->16,VectorStyle->"Segment",VectorScale->{0.02, Scaled[1],#5&}
]

NewtonCool[k_,A_,T0_,t_]=A+(T0-A)(E^(-k t))

newtonPlots= Plot[
{
NewtonCool[0.1,40,100,t],
NewtonCool[0.1,40,0,t],
NewtonCool[0.1,40,40,t]
},{t,0,60},PlotRange->{0,100}
];
Show[newtonSlopeField,newtonPlots]

Logistic Growth

logisticSlopeField =VectorPlot[
{1,0.0075P(100-P)},{t,0,10},{P,0,150},
VectorPoints->19,VectorStyle->"Segment",VectorScale->{0.05, Automatic,#5&},PlotRange->{{-0.25,10.25},{-5,155}}
]

logistic[k_,M_,P0_,t_]=((M P0)/(P0 +(M-P0)(E^(-k M t))));

logisticPlots=Plot[{
logistic[0.0075,100,10,t],
logistic[0.0075,100,150,t],
logistic[0.0075,100,100,t]
},{t,0,10},PlotRange->{0,150}];
Show[logisticSlopeField,logisticPlots]