Maybe you've seen diagrams like the ones below.

Meteorology: Wind Map | Fluid Dynamics |

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

If \(R\) is a set of points in \(\mathbb{R}^2\), then a vector field in \(\mathbb{R}^2\) is a function that assigns to each point \((x,y)\) in \(R\) a two-dimensional vector: \[\ans{\begin{align} \vec{F} (x,y) &= \langle f(x,y), g(x,y) \rangle\\ &= f(x,y)\ \hat{\imath} + g(x,y)\ \hat{\jmath} \end{align}}\] The functions \(f(x,y)\) and \(g(x,y)\) define the components of \(\vec{F} (x,y)\).

In three dimensions, a vector field can be defined similarly:

\[\vec{F} (x,y,z) = \langle f(x,y,z), g(x,y,z), h(x,y,z) \rangle\]Draw a graph for the vector field \(\vec{F} (x,y) = -y \hat{\imath} + x \hat{\jmath}\).

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

\[\begin{align} \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{align}\]The graph, with a few representative vectors drawn, is shown below.

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 \(\vec{F} (x,y) = \langle 1-y^2,0 \rangle\) for \(|y| \leq 1\).

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.

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)

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

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.

This is an example of a *radial vector field*.

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

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 \(\vec{F} (x,y) = \langle 0,y \rangle\).

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.

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

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

\[\begin{align} \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{align}\]The scalar function \(\phi(x,y)\) is called a **potential function**, and \(\nabla \phi(x,y)\) is called the **gradient field** in this context.

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

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.

- Find the gradient field for the potential function \(\phi(x,y) = x^2y-y^2x\).
- Find the gradient field for the potential function \(\phi(x,y) = \sqrt{xy}\).
- Find the gradient field for the potential function \(\phi(x,y,z) = \dfrac{1}{2}(x^2+y^2+z^2)\).
- Find the gradient field for the potential function \(\phi(x,y,z) = \ln(1+x^2+y^2+z^2)\).

\(\nabla \phi (x,y) = \langle 2xy-y^2,x^2-2xy \rangle\)

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

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

\(\nabla \phi (x,y,z) = \dfrac{1}{1+x^2+y^2+z^2} \langle 2x,2y,2z \rangle\)

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 \(\phi(x,y)=x^2+y^2\). Plot the gradient field and level curves on the same plot.

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 \(\phi(x,y)=xe^{-x^2-y^2}\). Plot the gradient field and level curves on the same plot.

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.