Direction Fields

Kurt Bryan and SIMIODE

A notebook to illustrate how to draw a direction field for an ODE.

Consider an ODE u'(t) = t*cos(u(t)) - sin(t). Define the right side of this ODE as a function f(t,u) = t*cos(u) - sin(t):

f[t_,u_] = t*Cos[u] - Sin[t]

The direction field (i.e., vector field or slope field) can be sketched (in red)  with

VectorPlot[{1,f[t,u]}, {t, 0, 5}, {u, 0, 5},VectorColorFunction->None,VectorStyle->Red]

Or superimpose the graphs of solutions to u' = f(t,u)  in blue with

VectorPlot[{1,f[t,u]}, {t, 0, 5}, {u, 0, 5},StreamPoints->Coarse,VectorColorFunction->None,VectorStyle->Red,StreamColorFunction->None,StreamStyle->Blue]