Math 245
Visualization of a Vector Field using Vector Field Plots

This command loads into Mathematica the formula for the vector field F[x,y] of interest:

F[x_,y_]:=(1/Sqrt[x^2+y^2])*{y,x};

The next commands creates the corresponding vector field plot for the above defined vector field F[x,y].   Note that in this case all of the arrows have the same length because |F[x,y]| = 1 = constant.

VectorPlot[F[x,y],{x,-2,2 },{y,-2,2}, Axes-> True, AxesLabel->{"x","y"}, PlotLabel->"Vector Field Plot for (y,x)\|(y,x)|"]

The StreamPlot command creates a smooth interpolation of the given vector field.  In exchange for smoothness, the magnitude of the vector field is lost:

StreamPlot[F[x,y],{x,-2,2 },{y,-2,2}, Axes-> True, AxesLabel->{"x","y"}, PlotLabel->"Stream Plot for (y,x)\|(y,x)|"]

Lets try two new choices for F[x,y].  These vector fields does not have a constant magnitude of 1.  Therefore, the length of each plotted arrow is varies from point to point.

F[x_,y_]:={-y,x};  G[x_,y_]:={x,-y}

VectorPlot[F[x,y],{x,-2,2 },{y,-2,2}, Axes->True,AxesLabel->{"x","y"}]

StreamPlot[F[x,y],{x,-2,2 },{y,-2,2}, Axes->True,AxesLabel->{"x","y"}]


VectorPlot[G[x,y],{x,-2,2 },{y,-2,2}, Axes->True,AxesLabel->{"x","y"}]

StreamPlot[G[x,y],{x,-2,2 },{y,-2,2}, Axes->True,AxesLabel->{"x","y"}]

Lets  try a very complicated choice for F[x,y]:

F[x_,y_]:={Sin[x+y],-x*y};

VectorPlot[F[x,y],{x,-Pi,Pi },{y,-2Pi,3Pi}, Axes->True,AxesLabel->{"x","y"}]

Note how almost no detail is visible.  One solution to this problem is to "unitize" the vector field by dividing it by its magnitude.  The other option is to use the StreamPlot command :

F[x_,y_]:={Sin[x+y],-x*y};

StreamPlot[F[x,y],{x,-Pi,Pi },{y,-2*Pi,3Pi}, Axes->True,AxesLabel->{"x","y"}]

Three dimensional vector fields can also be plotted :

VectorPlot3D[{x,y,z^2}/Sqrt[x^2+y^2+z^2],{x,-1,1},{y,-1,1},{z,-1,1},AxesLabel->{"x","y","z"}]

VectorPlot3D[{y,-x,0},{x,-1,1},{y,-1,1},{z,-1,1},AxesLabel->{"x","y","z"},VectorScale->{Automatic,Scaled[0.5]},VectorColorFunction->Hue]