# How to compute the Helmholtz decomposition of 2D and 3D vector fields?

I have a sample of 100 particles with their 3D positions and velocities. I want to decompose the velocity vector field to its curl free and divergence free components.

Is it a feasible to do so for the sampled data using Python, Matlab or Mathematica?

The short answer is "It depends".

Certainly, you can try to find the Helmholtz decomposition on your sampled data, and find your irrotational and solenoidal components. However, there are certain requirements on your original vector field you started with. In general, it is that the vector field you are trying to decompose has to be sufficiently smooth and decay rapidly. Commonly, that corresponds to the vector field $\mathbf F$ being twice continuously differentiable on some bounded domain $V$, and $\mathbf F$ decay faster than $1/r$, leading to $$\mathbf F=-\nabla\Phi+\nabla\times\mathbf A$$ decomposition with scalar potential $\Phi$ (for the irrotational component) and vector potential $\mathbf A$ (for the solenoidal component).

Now, you have to know, where your vector field comes from (what physics) to answer the question of applicability of Helmholtz decomposition in the first place for the continuous problem. Then, if positive, you must ensure your discretization (sampling) is sufficient enough to capture the behaviour of the original field.

I would also consider Hodge-Helmholtz decomposition that in addition to irrotational and solenoidal components would allow extracting the harmonic component. A recent paper, E. Ahusborde et al, "Discrete Hodge Helmholtz decomposition," Monografías Matemáticas, vol. 39, pp. 1–10, 2014 might be useful.