Slope fields for systems and phase planes in Mathematica
Math 330 
David McClendon

IMPORTANT:  Before you get started :  this file contains several commands of use.  Rather than editing these programs in this file, I suggest you open a new Mathematica file (File -> New -> Notebook), and copy and paste the cells containing these commands into your new file before editing/using them.  Recall that to highlight a cell, click on the "]" to the right of the cell (the cell's contents can then be copied using [CONTROL]+C, etc.)

Command 1 (Plotting a Slope Field) :

To produce the slope field first-order 2 by 2 system of ODEs of the form y' = Φ(t, y), call the formula for x’ (Subscript[ϕ, 1])and call the formula for y’ (Subscript[ϕ, 2]).   Then run the following command (here, x’ = x-y and y’ = x+2y):

phi1[x_,y_] := x-y;
phi2[x_,y_] := x + 2y;
VectorPlot[{phi1[x,y],phi2[x,y]},{x,-3,3},{y,-3,3}, 
VectorPoints -> 30, Axes -> True, 
VectorScale->{Automatic,Automatic,None}, 
VectorStyle -> Orange,
VectorColorFunction -> None]

The individual pieces of this command are similar to those for individual ODEs discussed in the file slopefields.nb.

Command 2 (Graphing a family of solution curves with the slope field) :

phi1[x_,y_] := x-y;
phi2[x_,y_] := x + 2y;
VectorPlot[{phi1[x,y],phi2[x,y]},{x,-3,3},{y,-3,3},
 VectorPoints -> 30, Axes -> True,
 VectorScale->{Automatic,Automatic,None}, 
VectorStyle -> Orange,
VectorColorFunction -> None, 
StreamPoints ->35, 
StreamScale -> Full, 
StreamStyle -> Black,
StreamColorFunction -> None]

Command 3 (Graphing a solution curve through a specified point) :

If you want only the stream line passing through the point (1, 2), your command would be:

phi1[x_,y_] := x-y;
phi2[x_,y_] := x + 2y;
VectorPlot[{phi1[x,y],phi2[x,y]},{x,-3,3},{y,-3,3},
 VectorPoints -> 30, Axes -> True,
 VectorScale->{Automatic,Automatic,None}, 
VectorStyle -> Orange, 
VectorColorFunction -> None,
StreamPoints ->{{-1,2}}, 
StreamScale -> Full, 
StreamStyle -> Black,
StreamColorFunction -> None]

Command 4 (Sketching a phase plane)

This command plots only the stream lines (a.k.a. solution curves) of the ODE, and omits the mini-tangents comprising the slope field:

phi1[x_,y_] := x-y;
phi2[x_,y_] := x + 2y;
StreamPlot[{phi1[x,y],phi2[x,y]},{x,-3,3},{y,-3,3},
StreamPoints ->80, 
StreamScale -> Full, 
StreamStyle -> Black,
StreamColorFunction -> None]

Command 5 (Sketching a single solution curve)

This command plots only the solution curve passing through (-1,2), and omits the mini-tangents comprising the slope field:

phi1[x_,y_] := x-y;
phi2[x_,y_] := x + 2y;
StreamPlot[{phi1[x,y],phi2[x,y]},{x,-3,3},{y,-3,3},
StreamPoints ->{{-1,2}}, 
StreamScale -> Full, 
StreamStyle -> Black,
StreamColorFunction -> None]