Estimating divergence of set of vectors I have a set of points where directions and intensities of a flow are given (in 3D). Is it possible to estimate the divergence of the flow defined by those vectors? I only need a rough estimate and I can assume continuity and smoothness.
I expected this to be a common question, but I wasn't able to find any literature, which makes me suspect I used uncommon phrases to describe my problem...
 A: The definition of divergence is
$$\textrm{div}\,\vec{F} = \lim_{V \to p}\iint_{S(V)} \frac{\vec{F}\cdot\vec{n}}{|V|}dS, \qquad [1]$$
where $\vec{F}$ is the vector field, $V$ is the volume surrounding the point $p$ where the divergence is calculated, $\vec{n}$ is a unit-length normal vector of the surface, $S(V)$, of the volume, and $|V|$ is the total volume.
To approximate this with a sampling of the vector field, instead of shrinking the volume to a point, $$\lim_{V \to p},$$ choose a small volume that surrounds the point in question and make it large enough to encompass many samples of the vector field (divergence is zero for a constant field).
$$\textrm{div}\,\vec{F} \approx \iint_{S(V)} \frac{\vec{F}\cdot\vec{n}}{|V|}dS.$$
If you are working in Cartesian coordinates, you could make your life easier and choose a cube aligned with your axes so $\vec{n}$ is constant on each side. Take the average of the vector field across the surface, interpolating as needed. If your cube as side lengths $x$, then your calculation becomes:
$$\sum_{i=1}^6 \frac{\vec{F_i}\cdot\hat{e_i}x^2}{x^3} = \frac{1}{x}\sum_{i=1}^6 \vec{F_i}\cdot\hat{e_i}$$
where $\vec{F_i}$ is the average vector on each surface and $\hat{e_i}$ is the unit normal vector on each cube face, $[\pm 1, 0, 0]$ for the faces perpendicular to the x-axis.
[1] http://en.wikipedia.org/wiki/Divergence#Definition_of_divergence
