The divergence a 2D vector Field $\mathbf{F}(x,y) = F_x(x,y)\, \hat{i} + F_y(x,y)\, \hat{j}$ is defined as $$\mathrm{div}\,\mathbf{F} = \bigg( \dfrac{\partial F_x}{\partial x} + \dfrac{\partial F_y}{\partial y}\bigg).$$ This can be calculated IF a function $\mathbf{F}(x,y)$ is given.

How do I compute the divergence if I don't know the function $\mathbf{F}(x,y)$ that describes my vector field but rather I have an array of numbers (noisy) that form a vector field as depicted below.

enter image description here

I know only the $(x,y)$ coordinates of the tip and the tail of each vector. Just by looking at the picture below, the field has a negative divergence. How can one calculate the divergence of such a field?

Note: This is a part of the problem addressed here

  • $\begingroup$ Perhaps you can try numerical differentiation? (e.g. Euler method) $\endgroup$
    – K_inverse
    Oct 1, 2020 at 7:17

1 Answer 1


In many physical systems the field will be divergent only at a point, or a few points. In that case I'd be inclined to use the divergence theorem. Choose some suitable surface and integrate the flux over that surface. The integration over a large surface will average out a lot of the noise, and you can do an integration over surfaces not enclosing the divergent point(s) to get an idea how big the noise is.

If your system doesn't have the divergence restricted to a point or points you could still use the method to get a coarse grained estimate of the divergence. Without more info about your system I don't know how useful this would be for you.

You give a 2D example, though I'm not sure if that means your data is restricted to two dimensions. If so Wikipedia tells me the 2D version of the divergence theorem is Green's theorem.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.