# Divergence / Gradient / Laplace Operator

Yao Yao on June 11, 2018
$\newcommand{\icol}[1]{ \bigl[ \begin{smallmatrix} #1 \end{smallmatrix} \bigr] }$

## Divergence

Quote from Wikipedia: Divergence:

Let $x$, $y$, $z$ be a system of Cartesian coordinates in 3-dimensional Euclidean space, and let $\mathbf{i}$, $\mathbf{j}$, $\mathbf{k}$ be the corresponding basis of unit vectors. The divergence of a continuously differentiable vector field $F = U \mathbf{i} + V \mathbf{j} + W \mathbf{k}$ is defined as the scalar-valued function:

$\operatorname {div} \mathbf {F} = \nabla \cdot \mathbf {F} = \left ( {\frac {\partial }{\partial x}}, {\frac {\partial }{\partial y}}, {\frac {\partial }{\partial z}} \right) \cdot (U,V,W) = {\frac {\partial U}{\partial x}} + {\frac {\partial V}{\partial y}} + { \frac {\partial W}{\partial z}}.$

1. 写法。$F = U \mathbf{i} + V \mathbf{j} + W \mathbf{k}$ 其实就是 $\vec F = \icol{U \newline V \newline W}$，它其实是一个 vector
2. 这里 $\nabla \cdot \mathbf {F}$ 明显不是 dot product，但是计算方法类似，最后的结果是一个 scalar
3. Gradient 的写法 $\nabla f$ 不带这个 dot

## Divergence 的物理意义

Quote from Erik Anson’s answer on Quora:

Imagine a fluid, with the vector field representing the velocity of the fluid at each point in space. Divergence measures the net flow of fluid out of (i.e., diverging from) a given point. If fluid is instead flowing into that point, the divergence will be negative.

A point or region with positive divergence is often referred to as a “source” (of fluid, or whatever the field is describing), while a point or region with negative divergence is a “sink”.

The bigger the flux density (positive or negative), the stronger the flux source or sink. A div of zero means there’s no net flux change in side the region.

## Laplace Operator

\begin{aligned} \nabla \cdot \nabla f(x, y, z) &= \left ( {\frac {\partial }{\partial x}}, {\frac {\partial }{\partial y}}, {\frac {\partial }{\partial z}} \right) \cdot \left ( \frac{\partial f}{\partial x}(x,y,z), \frac{\partial f}{\partial y}(x,y,z), \frac{\partial f}{\partial z}(x,y,z) \right ) \newline &= \frac {\partial^{2} f}{\partial x^{2}}(x,y,z) + \frac {\partial^{2} f}{\partial y^{2}}(x,y,z) + \frac {\partial^{2} f}{\partial z^{2}}(x,y,z) \newline &= \nabla^2 f(x, y, z) \end{aligned}

which happens to be the $lap$ of $f(x, y, z)$.

I.e. $\operatorname{lap} f = \operatorname{div}(\operatorname{grad} f)$

• 如果你在 $f$ 的 local minimum $a$，你周围的 gradient 全部流出 $a$ (任意方向都是 ascending)，divergence 是 highly positive，所以 $a$ 是 gradient 的 source
• 如果你在 $f$ 的 local maximum $b$，你周围的 gradient 全部流入 $b$ (任意方向都是 descending)，divergence 是 highly negative，所以 $b$ 是 gradient 的 sink