Vector fields

You’ve maybe seen something similar to vector fields previously.  If we are given (dy/dx) = 3x - 2y, we can form the slope field (pictured below)

VectorPlot[{1, 3x-2y}, {x, -5, 5}, {y, -5, 5}, VectorStyle->Arrowheads[0],VectorScale->{Automatic,Automatic,None}, ImageSize->Large]

This graphs the slope (dy/dx) at a given point.  As we’ve seen, the slope of a line corresponds to just taking the direction of a vector.  This is useful to visualize solutions to (ordinary/non-partial) differential equations.

Show[
VectorPlot[{1, 3x-2y}, {x, -5, 5}, {y, -5, 5}, VectorStyle->Arrowheads[0],VectorScale->{Automatic,Automatic,None}, ImageSize->Large],
Plot[{.5Exp[-2x]+((3x)/2) - (3/4)}, {x, -5, 5}, ColorFunction->"Rainbow"]
]

In vector fields, we include the whole vector, adding representations for length and which direction the arrow points in.  Thus, instead of associating a number with each point (the slope) we associate a vector.  Here is the vector field <1, 3x - 2y>.  Note that the slopes of the arrows are the same as above, but we’ve added direction and magnitude.

VectorPlot[{1, 3x-2y}, {x, -5, 5}, {y, -5, 5}]

We can also plot vector fields in three dimensions, although these are harder to see.  The following vector field is <y,z, x>.

VectorPlot3D[{y,z,x}, {x, -5,5}, {y,-5,5}, {z, -5,5}, ImageSize->Large]

The following vector field is <((-x)/((((x^2)+(y^2)+(z^2)))^(3/2))),((-y)/((((x^2)+(y^2)+(z^2)))^(3/2))),((-z)/((((x^2)+(y^2)+(z^2)))^(3/2)))>, which represents the force of gravity that a mass at the origin exerts on (x, y, z) (up to a constant factor.

VectorPlot3D[{((-x)/((((x^2)+ (y^2)+(z^2)))^(3/2))),((-y)/((((x^2)+ (y^2)+(z^2)))^(3/2))),((-z)/((((x^2)+ (y^2)+(z^2)))^(3/2)))},{x, -1,1}, {y,-1,1}, {z, -1,1}, ImageSize->Large]

Vector fields that represent the force exerted on a point are sometimes called force fields.  These can also come from magnetism, wind, or water.

The key difference between vector fields and previous functions that we’ve graphed is that, rather than outputting a number (scalar), vector functions output a vector.  For this reason, they are sometimes called vector functions.  Note that parameterized surfaces, etc. also output a vector, but these were not typically graphed with their domain.

We write a vector field as a function F.  We can split this into components as F(x,y) = < P(x,y), Q(x, y) > or F(x,y,z) = <P(x,y,z), Q(x,y,z), R(x, y,z)>, where P, Q, and R are normal (scalar functions).

An important class of vector fields comes from gradients of functions.  For instance, take a function f(x,y) = y cos(x).  Then we can find the gradient ▽f(x,y) = <-y sin x, cos x> and this is a vector function, so we can look at the vector field it forms.

VectorPlot[{-y Sin[x], Cos[x]}, {x, -5, 5}, {y, -5,5}, ImageSize->Large]

A vector field is called a gradient field if it comes from the gradient of a function; this function is called the potential.  Note that if the partials are continuous, then ▽f(x,y) = <(Subscript[f, x]), (Subscript[f, y])> has the property that the partial with respect to y of the first component is equal to the partial with respect to x of the second component, (Subscript[f, xy])=(Subscript[f, yx]).  The converse of this statement is often true and we will discuss what “often” means on Thursday

Similar to finding solutions in slope fields, we can draw flow lines in gradient fields that represent paths that have tangent vectors.

Show[
VectorPlot[{-y Sin[x], Cos[x]}, {x, -5, 5}, {y, -5,5}, ImageSize->Large],
Plot[{(1/(Sin[x])), (2/(Sin[x])), ((-3)/(Sin[x]))},{x, -5,5}]
]

We can do both by making a Stream Plot that graphs the flow lines instead of vectors.

StreamPlot[{-y Sin[x], Cos[x]}, {x, -5, 5}, {y, -5,5}, ImageSize->Large]

Sketching and Matching

On your homework, you might have to sketch some vector fields (of two dimensions) and match vector fields.

For sketching, you should actually draw these by hand.  They don’t have to be perfect, just sketch them as good as possible.  For matching, again this is a hard exercise, but we have the same basic rules: think about features you would expect to see in each case and especially the difference between vector fields.

Below we have the vector fields <1,2,3>, <1,2,z>, <x,y,3> and <-z,y,2x>.

GraphicsRow[
{VectorPlot3D[{1,2,3}, {x, -5,5}, {y,-5,5}, {z, -5,5}, VectorScale->Medium],
VectorPlot3D[{1,2,z}, {x, -5,5}, {y,-5,5}, {z, -5,5}, VectorScale->Medium],
VectorPlot3D[{x,y,3}, {x, -5,5}, {y,-5,5}, {z, -5,5}, VectorScale->Medium],
VectorPlot3D[{-z,y,2x}, {x, -5,5}, {y,-5,5}, {z, -5,5}, VectorScale->Medium]},
ImageSize->Full
]

Below we have the vector fields <2x,2y>, <2(x+y), 2(x+y)>, <y, cos x>, and <xy, x-y>.

GraphicsRow[{
VectorPlot[{2x,2y}, {x, -5,5}, {y,-5,5}, VectorScale->Medium],
VectorPlot[{2(x+y),2(x+y)}, {x, -5,5}, {y,-5,5}, VectorScale->Medium],
VectorPlot[{y,Cos[x]}, {x, -5,5}, {y,-5,5}, VectorScale->Medium],
VectorPlot[{x y, x-y}, {x, -5, 5}, {y, -5,5}, VectorScale->Medium]
},
ImageSize->Full]