Example 7.1.8

Solve the characteristic equation:

Solve[r^2-r-2==0,r]

Define the general solution to the second order differential equation:

y[t_]=(Subscript[c, 1])Exp[-t]+(Subscript[c, 2])Exp[2t]

Solve the IVP:

eq1=y[0]==1/2
eq2=y'[0]==5
coeffs=Solve[{eq1,eq2},{(Subscript[c, 1]),(Subscript[c, 2])}]
y[t_]=y[t]/.Flatten[coeffs]

Plot the solution in the y t- plane:

Plot[y[t],{t,-3,1},AxesLabel->{"t","y"},ImageSize->{400,Automatic}]

Plot the solution in the (Subscript[x, 1])(Subscript[x, 2])- plane:

(Subscript[x, 2])[t_]=y[t]
(Subscript[x, 1])[t_]=Simplify[1/2*((Subscript[x, 2])'[t]+2(Subscript[x, 2])[t])]

sol=ParametricPlot[{(Subscript[x, 1])[t],(Subscript[x, 2])[t]},{t,-3,1},AxesLabel->{"(Subscript[x, 1])","(Subscript[x, 2])"},ImageSize->{400,Automatic},PlotStyle->{Red}]

We can also plot a direction field in the  (Subscript[x, 1])(Subscript[x, 2])- plane:

field=VectorPlot[{3(Subscript[x, 1])-2(Subscript[x, 2]),2(Subscript[x, 1])-2(Subscript[x, 2])},{(Subscript[x, 1]),-20,30},{(Subscript[x, 2]),-30,20},VectorScale->{Tiny,Small,None}]

Show[sol,field,ImageSize->{600,Automatic}]