Vector Fields

Introduction

Maybe you've seen diagrams like the ones below.

Meteorology: Wind Map Fluid Dynamics
Wind map Fluid dynamics

Many applications can be modeled by vector fields, which describe a vector at each point (x,y)(x,y) in the plane.

More precisely:

If RR is a set of points in R2\mathbb{R}^2, then a vector field in R2\mathbb{R}^2 is a function that assigns to each point (x,y)(x,y) in RR a two-dimensional vector:

F(x,y)=f(x,y),g(x,y)=f(x,y) ı^+g(x,y) ȷ^\ans{\begin{aligned} \vec{F} (x,y) &= \langle f(x,y), g(x,y) \rangle\ &= f(x,y)\ \hat{\imath} + g(x,y)\ \hat{\jmath} \end{aligned}}

The functions f(x,y)f(x,y) and g(x,y)g(x,y) define the components of F(x,y)\vec{F} (x,y).

In three dimensions, a vector field can be defined similarly: F(x,y,z)=f(x,y,z),g(x,y,z),h(x,y,z)\vec{F} (x,y,z) = \langle f(x,y,z), g(x,y,z), h(x,y,z) \rangle

Examples

Draw a graph for the vector field F(x,y)=yı^+xȷ^\vec{F} (x,y)=−y\hat{\imath}+x\hat{\jmath}.

Solution

To graph this, pick a point and find the vector located at that point, then repeat.

F(1,0)=ȷ^F(0,1)=ı^F(1,0)=ȷ^F(0,1)=ı^F(1,1)=ı^+ȷ^etc.\begin{aligned} \vec{F} (1,0) &= \hat{\jmath}\ \vec{F} (0,1) &= -\hat{\imath}\ \vec{F} (-1,0) &= -\hat{\jmath}\ \vec{F} (0,-1) &= \hat{\imath}\ \vec{F} (1,1) &= -\hat{\imath} + \hat{\jmath}\ &\textrm{etc.} \end{aligned}

The graph, with a few representative vectors drawn, is shown below.

Rotational vector field

To draw this graph in Matlab, follow these steps:

>> [x,y]=meshgrid(-1:0.2:1,-1:0.2:1);
>> u=-y;
>> v=x;
>> quiver(x,y,u,v)

This is an example of a rotational vector field.

Draw a graph for the vector field F(x,y)=1y2,0\vec{F} (x,y) = \langle 1-y^2,0 \rangle for y1|y|≤1.

Solution

To draw this graph in Matlab, follow these steps:

>> [x,y]=meshgrid(-1:0.2:1,-1:0.2:1);
>> u=1-y.^2;
>> v=0.*x;
>> quiver(x,y,u,v)

The resulting graph is shown below.

Channel flow

This is an example of channel flow. Notice how near the "walls," the flow is reduced. When water flows through a channel, the walls slow the water down; in fact, in most studies of fluid dynamics, the flow is assumed to be zero at the wall (called the "no-slip condition").

We can also draw a three-dimensional version of this (although the picture is much harder to read).

>> [x,y,z]=meshgrid(-1:0.2:1,-1:0.2:1,-1:0.2:1);
>> u=1-y.^2-z.^2;
>> v=0.*x;
>> w=0.*x;
>> quiver3(x,y,z,u,v,w)

alt text

Draw a graph for the vector field F(x,y)=2x,2y\vec{F} (x,y) = \langle 2x,2y \rangle.

Solution

Once again, using Matlab:

>> [x,y]=meshgrid(-2:0.5:2,-2:0.5:2);
>> u=2.*x;
>> v=2.*y;
>> quiver(x,y,u,v)

The resulting graph is shown below.

Radial vector field

This is an example of a radial vector field.

Draw a graph for the vector field F(x,y)=0,x.\vec{F} (x,y) = \langle 0,x \rangle.

Solution

In Matlab:

>> [x,y]=meshgrid(-2:0.5:2,-2:0.5:2);
>> u=0.*x;
>> v=x;
>> quiver(x,y,u,v)

The resulting graph is shown below.

Draw a graph for the vector field F(x,y)=0,y.\vec{F} (x,y) = \langle 0,y \rangle.

Solution

In Matlab:

>> [x,y]=meshgrid(-2:0.5:2,-2:0.5:2);
>> u=0.*x;
>> v=y;
>> quiver(x,y,u,v)

The resulting graph is shown below.

  1. Sketch the vector field F=1,y.\vec{F}=\langle 1,y \rangle.

Potential Functions and Gradient Fields

Here's one way to generate a vector field: start with a scalar function (as opposed to a vector function). For example, start with ϕ(x,y)=x2yy3ϕ(x,y)=x^2y−y^3. The gradient of this function is a vector field:

ϕ(x,y)=ϕx(x,y)ı^+ϕy(x,y)ȷ^=2xyı^+(x23y2)ȷ^\begin{aligned} \nabla \phi(x,y) &= \phi_x (x,y) \hat{\imath} + \phi_y (x,y) \hat{\jmath}\ &= 2xy \hat{\imath} + (x^2-3y^2) \hat{\jmath} \end{aligned}

The scalar function ϕ(x,y)ϕ(x,y) is called a potential function, and ϕ(x,y)∇ϕ(x,y) is called the gradient field in this context.

Consider the potential function ϕ(x,y)=xex2y2\phi(x,y)=xe^{-x^2-y^2}. Find the gradient field for this function.

Solution

ϕx=ex2y22x2ex2y2ϕy=2xyex2y2ϕ(x,y)=ex2y22x2ex2y2,2xyex2y2=ex2y212x2,2xy\begin{aligned} \phi_x &= e^{-x^2-y^2}-2x^2e^{-x^2-y^2}\ \phi_y &= -2xye^{-x^2-y^2}\ \ \nabla \phi (x,y) &= \left\langle e^{-x^2-y^2}-2x^2e^{-x^2-y^2},-2xye^{-x^2-y^2} \right\rangle\ &= \ans{e^{-x^2-y^2} \langle 1-2x^2,-2xy \rangle} \end{aligned}

We can graph this vector field, as we did with the others, in Matlab, by defining it using the gradient function:

>> [x,y]=meshgrid(-2:0.2:2,-2:0.2:2);
>> z=x.*exp(-x.^2-y.^2);
>> [u,v]=gradient(z);
>> quiver(x,y,u,v)

The resulting graph is shown below.

  1. Find the gradient field for the potential function ϕ(x,y)=x2yy2x\phi(x,y) = x^2y-y^2x.

  2. ϕ(x,y)=2xyy2,x22xy\nabla \phi (x,y) = \langle 2xy-y^2,x^2-2xy \rangle

  3. Find the gradient field for the potential function ϕ(x,y)=xy\phi(x,y) = \sqrt{xy}.

  4. ϕ(x,y)=1xyy,x\nabla \phi (x,y) = \dfrac{1}{\sqrt{xy}} \langle y,x \rangle

  5. Find the gradient field for the potential function ϕ(x,y,z)=12(x2+y2+z2)\phi(x,y,z) = \dfrac{1}{2}(x^2+y^2+z^2).

  6. ϕ(x,y,z)=x,y,z\nabla \phi (x,y,z) = \langle x,y,z \rangle

  7. Find the gradient field for the potential function ϕ(x,y,z)=ln(1+x2+y2+z2)\phi(x,y,z) = \ln(1+x^2+y^2+z^2).

  8. ϕ(x,y,z)=11+x2+y2+z22x,2y,2z\nabla \phi (x,y,z) = \dfrac{1}{1+x^2+y^2+z^2} \langle 2x,2y,2z \rangle

Gradient Fields and Level Curves

Recall that the gradient points in the direction of steepest ascent along a function, and if we travel orthogonally to the gradient, the elevation doesn't change. Therefore, the gradient is orthogonal to the level curves of the function. We can observe this graphically by graphing the gradient field and the level curves (using the contour command in Matlab) on the same plot.

Consider the potential function ϕ(x,y)=x2+y2\phi(x,y)=x^2+y^2. Plot the gradient field and level curves on the same plot.

Solution

In Matlab:

>> [x,y]=meshgrid(-2:0.2:2,-2:0.2:2);
>> z=x.^2+y.^2;
>> [u,v]=gradient(z);
>> quiver(x,y,u,v)
>> hold on
>> contour(x,y,z)
>> axis equal

The graph is shown below.

Note how you can see that the vectors are orthogonal to the level curves.

Consider the potential function ϕ(x,y)=xex2y2\phi(x,y)=xe^{-x^2-y^2}. Plot the gradient field and level curves on the same plot.

Solution

In Matlab:

>> [x,y]=meshgrid(-2:0.2:2,-2:0.2:2);
>> z=x.*exp(-x.^2-y.^2);
>> [u,v]=gradient(z);
>> quiver(x,y,u,v)
>> hold on
>> contour(x,y,z)
>> axis equal

The graph is shown below.

This one is similar to a magnetic field that results from two point charges, one positive and one negative, where the vector at each point represents the magnetic force felt by a test charge at that point. The level curves represent lines of equal magnetic potential energy.