Divergence
In[214]:=
vF1[x_,y_] := {Sin[x],Cos[y]}
We can examine this function in various ways. We can draw vectors representing the field. See the vector fields section.
In[215]:=
PlotVectorField[vF1[x,y],{x,-5,5},{y,-5,5},Axes->True];

Notice that there are points in this field where the vectors seem to be
converging (such as the point x » 3.1, y » 1.5) and other points where the field
appears to be diverging (such as the point x » 0, y » 1.5). If this field
represents fluid flow, then the areas where vectors are converging can be
considered sinks and the areas where the lines are diverging can be thought of
as sources. In other words, particles flow from the sources to the sinks. But
how do we measure the strength of a source or a sink? That's where the
divergence is useful.
The divergence of a vector function f(x,y) is written
¶fx / ¶x + ¶fy / ¶y.
We can calculate the divergence of vF1 symbolically.
In[216]:=
divF1 = div2[vF1][x,y]
Out[216]=
Cos[x] - Sin[y]
Note that this is a scalar function of x and y. Now let's plot the divergence over the same region we examined above.
In[217]:=
ContourPlot[divF1,{x,-5,5},{y,-5,5}];

Note: Lighter regions are higher.
In[218]:=
Plot3D[divF1,{x,-5,5},{y,-5,5},AxesLabel->{"x","y","z"}];

The more positive the divergence, the greater the source strength. The more negative, the stronger the sink. When the divergence is zero, the point is neither a source nor a sink. We can say that there is no change in vector magnitude about a point with zero divergence.