Shapes & spaces

Discrete Hodge decomposition calculator for a mesh edge field

Split an oriented edge cochain into gradient, coexact and harmonic components under unit Euclidean cochain inner products.

Your numbers

Use finite values within the stated calculator bounds.
One row of three distinct zero-based vertex indices per triangle.
Exactly one row per mesh edge; reversing u, v reverses the sign convention.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Split an oriented edge cochain into gradient, coexact and harmonic components under unit Euclidean cochain inner products.

THE FORMULAω=d0φ+d1ᵀψ+h; d0ᵀh=0; d1h=0; d1d0=0.

A worked example

For one triangle with canonical edge values (1,0,1), gradient energy is 2/3, coexact energy 4/3 and harmonic dimension 0.

Good to know

3–30 declared vertices, 1–30 distinct triangular faces and up to 40 unique edges. Exactly one oriented value per edge. Unit cochain inner products, not cotangent metric weights; rank-checked orthogonal projections and reconstruction checks.

An edge field has different algebraic parts

A scalar value on each oriented edge is a one-cochain. It can contain differences of vertex potentials, circulation contributed by face potentials and a harmonic remainder. Discrete Hodge decomposition separates these components according to the chosen inner products and incidence operators.

This page uses the ordinary unit Euclidean inner product on cochain coordinates. It does not infer edge lengths, triangle areas or a cotangent Hodge star from a geometric embedding. That makes the algebraic convention explicit, but it is not automatically the same decomposition as a metric-weighted physical vector field on a curved surface.

Orthogonal components on one filled triangle0 → 1: 10 → 2: 01 → 2: 1Gradient: (1,2,1)/3Coexact: (2,−2,2)/3Harmonic dimension = 0Energies: 2/3 + 4/3
Scroll across to see the full diagram.
In canonical edge order,ω=(1,0,1)has gradient energy 2/3 and coexact energy 4/3.

Compare this with the Cotangent Laplacian calculator from a triangle mesh. Split a supplied oriented edge1-cochain into gradient, curl and harmonic parts, rather than just assemble a vertex Laplacian.

Orientation is part of the data

Face rows contain three distinct zero-based vertex indices. The calculator gathers their edges and assigns each a canonical orientation from the smaller endpoint index to the larger one. Enter exactly one edge-value row for every resulting edge, using either endpoint order.

Reversing an entered endpoint order reverses the sign of its value in canonical coordinates. Supplying both orientations as separate rows is a duplicate, not two independent measurements. The declared vertex count can include isolated vertices; they affect the potential's nonuniqueness but contribute no edge component by themselves.

A single-triangle worked example

The default complex has one triangular face and three edges. In canonical edge order zero-one, zero-two, one-two, the entered field is one, zero, one. Its gradient component is one-third, two-thirds, one-third, and its coexact component is two-thirds, minus-two-thirds, two-thirds.

Adding those two vectors reconstructs the original field. Their squared Euclidean norms are two-thirds and four-thirds, and their dot product is zero. No harmonic direction remains for this filled triangle, so the returned harmonic dimension is zero and its tiny computed energy is only floating rounding residue.

Incidence matrices encode the complex

The vertex-to-edge operator d0 subtracts the scalar potential at an edge's first endpoint from that at its second. The edge-to-face operator d1 sums edge values around an oriented face. Consistent signs make their product zero: the boundary sum of vertex differences cancels exactly.

The implementation checks that identity before projection. Gradient components lie in the column space of d0, while coexact components lie in the column space of d1 transpose. Because d1d0 vanishes, these two subspaces are orthogonal in the selected unit inner products without introducing a special geometric weighting scheme.

Projecting without arbitrary potential gauges

Vertex potentials can be shifted by a constant on each connected component without changing their edge differences. Face potentials can also have linear dependencies. Solving blindly for unique raw potentials would therefore confuse harmless gauge freedom with failure of the decomposition itself.

The calculator constructs orthonormal bases for the relevant image spaces and projects the supplied edge vector into them. The harmonic remainder is what remains after both projections. Its dimension is edge count minus the two image ranks, which makes the topological contribution visible without inventing a unique set of potentials.

Certificates and their meanings

The returned table lists each canonical edge's original, gradient, coexact and harmonic values. The components must sum back to the input. Their cross dot products should vanish within numerical tolerance, and the harmonic part must have both zero discrete divergence and zero discrete curl under these operators.

The residuals test the finite calculation, not the accuracy of a measured field. A large input scale can expose numerical loss even when the abstract decomposition exists, so unresolved certificate failures are rejected. A small harmonic energy is also different from harmonic dimension: one input can simply have no component along an existing harmonic subspace.

Using the decomposition in context

A hole in the complex can introduce harmonic circulation that is neither a global gradient nor generated by filled faces. Filling that hole changes d1 and can remove the corresponding harmonic direction. The face list therefore matters as much as the graph's edge connectivity.

Use the page to inspect a small discrete complex or compare algebraic flow components. For a physical surface field, choose and document the appropriate metric Hodge stars and boundary conditions in a dedicated geometry-processing workflow. This unit-cochain calculator does not silently claim that all those geometric choices are equivalent.

A few questions, answered

Are edge lengths used?

No. This page uses unit Euclidean cochain inner products rather than metric or cotangent weights.

Why reverse an edge value when its endpoints reverse?

A one-cochain is oriented; the same geometric edge has opposite coordinate sign under the opposite orientation.

Does zero harmonic energy imply no holes?

No. It can mean only that this particular input field has no component in the harmonic subspace.

Are raw potentials unique?

Generally no. Gauge freedoms can leave the edge components unchanged; the page reports the projected components instead.

Find your calculator

Start typing to explore the library.