Vector Fields
Math 211  Prof. Leise

Email completed labs to tleise@amherst.edu by noon Monday.

Vector fields are vector-valued functions involving more than one variable. Each point (x,y) or (x,y,z) is associated with a vector that can be interpreted as giving the velocity of something flowing through space, like water flowing down a river or water circulating in the ocean or air currents in the atmosphere. Vector fields are also used to represent force fields in physics, such as gravitational and magnetic force fields. Today we want to visualize vector fields using Mathematica and learn about one of the special derivatives used to analyze force fields.

Here’s how to plot 2D and 3D vector fields in Mathematica using the VectorPlot command. The size of the arrow indicates the magnitude of the vector at that point:

VectorPlot[{-y,x},{x,-10,10},{y,-10,10}]

VectorPlot3D[{x,y,z},{x,-1,1},{y,-1,1},{z,-1,1}]

Exercise 1. Plot the following vector fields over the region with -4<x<4 and -4<y<4 (and -4<z<4 if 3D).

a) F(x,y)={3x, 2y}

b) F(x,y)={y, -x}

c) F(x,y)={-3x-2, -2y+1}

d) F(x,y,z)={y, -x, z}

A vector field is said to be “expanding” if a drop of dye increases in size as the flow carries it along. If instead it decreases in size, then we say the vector field is “compressing.”

In this graph, a red drop of dye starts at (1, 1) and then flows outward and expands:

In this graph, a blue drop of dye starts at (11, 11) and then flows inward and shrinks (compresses):

To find out whether a vector field is "expanding" or "compressing" the volume as particles flow, we take the divergence of the vector field:

div F(x,y) =  ((∂(Subscript[F, 1]))/(∂x)) + ((∂(Subscript[F, 2]))/(∂y)), where F={ (Subscript[F, 1]), (Subscript[F, 2]) }

div F(x,y,z) =   ((∂(Subscript[F, 1]))/(∂x)) + ((∂(Subscript[F, 2]))/(∂y)) + ((∂(Subscript[F, 3]))/(∂z)), where F={ (Subscript[F, 1]), (Subscript[F, 2]),(Subscript[F, 3]) }

If divF > 0, then F is expanding. If divF<0, then F is compressing. If divF=0, then the flow is carrying particles along but not changing the volume.

Exercise 2. Find the divergence for each of the four vector fields in Exercise 1.  Is the flow expanding or compressing or neither in each case?

We can try to visualize the flow induced by a vector field by following the arrows, treating them as the velocity of some particles moving through space.  We can make this more precise by finding flow lines r(t) which satisfy r'(t)=F(r(t)).  That is, F is a velocity field and particles move in this field along paths r(t) whose derivative r'(t) equals the velocity given by F.  

Exercise 3. First let’s find flow lines for the simple vector field F(x,y)={x, y}. The arrows seem to be lined up, flowing outward from the origin. Determine a vector-valued function r(t)={x(t),y(t)} that describes the flow line starting at the point (1,1) by solving r'(t)=F(r(t)). Note that this gives two differential equations to solve, one for x(t) and another for y(t). You don’t need any fancy methods to solve them--just think about what functions satisfy them.

Exercise 4. Plot your flow line from Exercise 3 on top of the vector field by changing the following graphics command, typing the correct functions for x(t) and y(t) in the ParametricPlot where the question marks are.

Show[VectorPlot[{x,y},{x,-10,10},{y,-10,10}],ParametricPlot[{?,?},{t,0,10},PlotStyle->Red]]

Exercise 5. Next find flow lines for the vector field F(x,y)={-x, -2y,-z}. Again, the arrows seem to be lined up, but this time flowing inward toward the origin. Determine a vector-valued function r(t)={x(t),y(t),z(t)} that describes the flow line starting at the point (10,10,10) by solving r'(t)=F(r(t)).

Exercise 6. Plot your flow line from Exercise 5 on top of the vector field by changing the following graphics command, putting the correct functions in the ParametricPlot3D.

Show[VectorPlot3D[{-x,-2y,-z},{x,-10,10},{y,-10,10},{z,-10,10}],ParametricPlot3D[{?,?,?},{t,0,10},PlotStyle->{Red,Thickness[0.01]}]]

Exercise 7. As a final example, find flow lines for the vector field F(x,y)={-y,x}. Since the flow appears circular, let’s guess r(t)={r Cos[t],r Sin[t])}. For instance, the flow line starting at the point (7,0) would be r(t)={7 Cos[t], 7 Sin[t])}. Check that this satisfies r'(t)=F(r(t)), and then plot this curve on top of the vector field, imitating Exercise 4.