Vector Fields

You must include this line before you can plot vector fields

<<  Graphics`PlotField`

Here we define a vector field explicitly

VF[x_, y_] := {-y, x}

VF[x, y]

We plot the vecor field with the command:

PlotVectorField[VF[x, y], {x, -2, 2}, {y, -2, 2}]

This time will compute the vector field which is the gradient of a function f:

F[x_, y_] := y Cos[x]

F[x, y]

Mathematica can compute the partial derivatives for us:

D[F[x, y], x]
D[F[x, y], y]

Now, create a new function which gives us the gradient of f at the point (x,y):

GradF[x_, y_] := {-y Sin[x], Cos[x]}

GradF[x, y]

Now, we plot this new vector field

PlotVectorField[GradF[x, y], {x, -1, 1}, {y, -1, 1}]

Here we plot more points

PlotVectorField[GradF[x, y], {x, -5, 5}, {y, -5, 5}, 
        PlotPoints -> 30]

PlotVectorField[GradF[x, y], {x, -5, 5}, {y, 15, 25}, 
        PlotPoints -> 30]