Abstract. A smooth surface carries curvature, a Laplace operator, a spectrum, a notion of distance, and a homology. A triangle mesh — a finite list of vertices and triangles — has none of these a priori. Discrete differential geometry (DDG) constructs operators on meshes that do not merely approximate the smooth theory but reproduce its theorems exactly: discrete Gauss–Bonnet holds to machine precision, the discrete Laplacian is symmetric with the constants in its kernel, and the dimension of the discrete harmonic space equals a topological invariant. This notebook builds that core in pure Wolfram Language. For every construction we state the smooth object, derive the discrete one, and report the check that pins it down — including the measured order of accuracy. A single sparse matrix, the cotangent Laplacian, drives all of it. The 3D figures are live: drag to rotate them. The same operators are then run unchanged on a 3D-scanned figurine, and finally pushed beyond meshes to graphs — Ollivier-Ricci curvature and emergent dimension — bridging to the discrete geometry of the Wolfram Physics Project.
Setup: the two accompanying packages
Setup: the two accompanying packages
Every operator used below lives in one of two small, plain-text Wolfram packages that travel with this notebook: ddg.wl (mesh operators — curvature, the cotangent Laplacian, spectra, mean-curvature flow, heat-method geodesics, DEC) and graphgeometry.wl (graph curvature and emergent dimension). Keep all three files in the same folder; the initialization cell below loads the packages automatically from NotebookDirectory[] when you evaluate the notebook. Thereafter every figure is preceded by the exact code — with all arguments — that produced it. The displayed figures are the committed high-resolution renders, so reading the notebook needs no evaluation; re-running the code cells regenerates them.
(*Initializationcell:loadsthetwoaccompanyingpackagesautomaticallywhenthenotebookisevaluated.Keepddg.wlandgraphgeometry.wlintheSAMEfolderasthisnotebook--theyareimportedfromNotebookDirectory[].Everyfigurebelowisthenprecededbytheexactcallsthatproducedit.*)Needs["DDG`",FileNameJoin[{NotebookDirectory[],"ddg.wl"}]];Needs["GraphDDG`",FileNameJoin[{NotebookDirectory[],"graphgeometry.wl"}]];
0. The discrete world: meshes and a dictionary
0. The discrete world: meshes and a dictionary
A triangle mesh is a pair: vertex positions ∈ and triangles, each an ordered triple of vertex indices. A scalar field is one number per vertex, interpolated across each triangle by the barycentric "hat" functions (so fields are piecewise linear). Almost every smooth notion has a discrete counterpart on this data:
x
i
3
ϕ
i
smooth | discrete |
surface Σ | vertices + triangles |
function f : Σ | one value per vertex |
Gaussian curvature K dA | angle defect at a vertex |
Laplace–Beltrami Δ | cotangent matrix M⁻¹ L |
∫ f over Σ | mass-weighted sum f M 1 |
k-form | value per vertex / edge / face |
de Rham cohomology | kernel of the Hodge Laplacian |
The guiding principle is mimetic: rather than discretise a smooth formula numerically, we build operators that satisfy the same structural identities (Stokes' theorem, d = 0, self-adjointness) by construction. Structure-preservation, not merely small truncation error, is what keeps the theorems exact. Two closed-form test surfaces — a torus and a geodesic sphere (a subdivided icosahedron) — let us check every answer.
²
(*Thetwoclosed-formtestsurfacesusedthroughout.*)R=2.;r=0.8;torus=DDG`torusMesh[R,r,80,160];(*closedgenus-1torusfromaperiodic(u,v)grid*)sphere=DDG`icosphereMesh[4];(*icosahedronsubdivided4x,projectedtotheunitsphere*){Length[DDG`meshCoords[torus]],Length[DDG`meshCoords[sphere]]}(*vertexcounts*)
1. Curvature: the shape operator, angle defect, Gauss–Bonnet
1. Curvature: the shape operator, angle defect, Gauss–Bonnet
At a point of a smooth surface, the shape operator S = −dn (the derivative of the unit normal) is a self-adjoint map of the tangent plane. Its eigenvalues are the principal curvatures , , and from them come the two scalar curvatures:
κ
1
κ
2
KS
κ
1
κ
2
H(+)
Tr[S]
2
1
2
κ
1
κ
2
The Gaussian curvature K is intrinsic — Gauss's Theorema Egregium says it depends only on lengths and angles within the surface, not on how it bends in space. That is exactly why a mesh can capture it from angles alone: flatten the triangles around a vertex and they leave an angular gap, the angle defect,
K
i
∑
j
θ
j
This is the integrated Gaussian curvature at vertex i; dividing by the vertex area gives the pointwise value. Summing over a closed mesh, the corner angles telescope (each triangle's three angles sum to π) into a purely topological identity:
A
i
Discrete Gauss–Bonnet. For a closed triangle mesh, 2πχ, with χ = V − E + F the Euler characteristic. An exact identity, true at every resolution — not an approximation.
∑
i
K
i
The mean curvature H is extrinsic and comes from the cotangent Laplacian of §2 applied to the vertex positions: the mean-curvature normal satisfies Δx = 2H n (Meyer et al. 2003). Below, the torus is coloured by K (left) and H (right) — both are live, so rotate them to see the warm positive-curvature outer rim and the cool inner rim:
(*GaussiancurvatureK(angledefect)andmeancurvatureH(cotanLaplacian)onthetorus,drawnastwolive,rotatablepanels.*)R=2.;r=0.8;tor=DDG`torusMesh[R,r,48,96];tp=DDG`meshCoords[tor];tt=DDG`meshTriangles[tor];K=DDG`gaussianCurvature[tor];(*=angleDefect/vertexArea*)H=DDG`meanCurvature[tor];H=Sign[Mean[H]]H;(*fixtheglobalsign*)diverging[v_]:=With[{m=Max[Abs[v]]+1.*^-12},Map[ColorData["TemperatureMap"],Rescale[v,{-m,m}]]];surf[cols_]:=Graphics3D{EdgeForm[],GraphicsComplex[tp,Polygon[tt],VertexColors->cols]},;Row[{surf[diverging[K]],surf[Map[ColorData["TemperatureMap"],Rescale[H]]]}]
This is a live 3D object — click and drag to rotate it.
Quantitatively the discrete K matches the analytic torus curvature to relative L² error 5×10 and H to 3×10; the unit sphere's H = 1 is recovered to 5×10. The convergence rates are quantified in §7.
⁻⁴
⁻⁴
⁻³
2. The cotangent Laplace–Beltrami operator
2. The cotangent Laplace–Beltrami operator
The Laplace–Beltrami operator Δ = div grad is the engine of the smooth theory. Its discrete form is the finite-element stiffness matrix of the hat functions: entry (i,j) is the integral of over the surface. Carrying out that integral over each triangle yields the famous cotangent weights,
∇·∇
ϕ
i
ϕ
j
Lf
i
1
2
∑
j
α
ij
β
ij
f
j
f
i
with , the angles opposite edge (i,j). Three properties make it the right operator, all holding by construction: it is symmetric (real spectrum); it kills constants, L 1 = 0 ("Δ of a constant is zero"); and it is negative semi-definite and local. Paired with the diagonal mass matrix M of vertex areas, ML is the discrete Δ. Every later section is this one matrix with a different right-hand side.
α
ij
β
ij
⁻¹
(*ThecotangentLaplaciananditsstructuralproperties,plusthemassmatrix.*)mesh=DDG`icosphereMesh[5];L=DDG`cotanLaplacian[mesh];(*VxVSparseArray*)Max[Abs[L-Transpose[L]]](*0:symmetric*)Max[Abs[L.ConstantArray[1.,Length[L]]]](*~1e-15:constantsinthekernel,L.1=0*)M=DDG`massMatrix[mesh];(*diagonallumpedvertexareas*)
In §6 the very same matrix re-emerges from discrete exterior calculus as L = — two independent derivations of one object.
d
0
⋆
1
d
0
3. Spectral geometry: hearing the shape of a mesh
3. Spectral geometry: hearing the shape of a mesh
Kac (1966) asked: can one hear the shape of a drum? The eigenpairs of Δ are a surface's natural frequencies and standing waves. We solve the generalized eigenproblem
-L.ϕλM.ϕ
symmetrised as (-L), positive semi-definite so the eigenvalues ≥ 0 are real. Two facts make the spectrum meaningful. First, on the unit sphere it is known exactly — the spherical harmonics satisfy — so the eigenvalues must be l(l+1) with multiplicity 2l+1:
-1/2
M
-1/2
M
λ
k
Δ-l(l+1)
Y
"lm"
Y
"lm"
l | l(l+1) | discrete eigenvalues |
0 | 0 | 0 |
1 | 2 | 2.000, 2.000, 2.000 |
2 | 6 | 5.97, 5.97, 5.97, 5.97, 5.97 |
3 | 12 | 11.80×3, 11.85×4 |
Second, Weyl's law says the eigenvalue counting function grows like the area: . So although you cannot fully hear a shape (isospectral non-isometric drums exist), you can hear its area — which is why the spectrum is used as an isometry-invariant Shape-DNA fingerprint (Reuter et al. 2006). The discrete eigenvectors are M-orthonormal to 10 and, on the sphere, are literally the spherical harmonics. Rotate one:
(λ)≈
Aλ
4π
⁻¹⁵
(*AsingleLaplace-Beltramieigenfunctiononthesphere(adiscretesphericalharmonic),drawnlive.laplacianSpectrumsolves(-L)phi=lambdaMphi.*)sph=DDG`icosphereMesh[4];sp=DDG`meshCoords[sph];st=DDG`meshTriangles[sph];{vals,vecs}=DDG`laplacianSpectrum[sph,6];(*6smallesteigenpairs*)Graphics3D{EdgeForm[],GraphicsComplex[sp,Polygon[st],VertexColors->Map[ColorData["BlueGreenYellow"],Rescale[vecs[[5]]]]]},
This is a live 3D object — click and drag to rotate it.
The first nine non-constant eigenfunctions on a geodesic sphere — the discrete spherical harmonics for l = 1, 2, 3.
Because the eigenvectors are an orthonormal basis, truncating it low-pass filters geometry exactly as a Fourier series filters a signal:
Spectral mesh smoothing: a bumpy sphere reconstructed from its lowest K Laplacian eigenmodes — geometry's Fourier compression.
4. Mean-curvature flow: smoothing as gradient descent of area
4. Mean-curvature flow: smoothing as gradient descent of area
This is a live 3D object — click and drag to rotate it.
Animation. The flow over time; the mean-curvature heat-map settles to uniform as the shape rounds.
5. Geodesic distance by the heat method
5. Geodesic distance by the heat method
On the unit sphere the distance from the pole is the colatitude arccos(z); the method matches it and converges under refinement (§7). The level sets are the wavefronts; where they collide is the cut locus (the antipode on a sphere, a richer set on the torus) — the points reachable by more than one shortest path, where the distance is non-smooth. Rotate the fields and follow a band around the torus' hole:
This is a live 3D object — click and drag to rotate it.
6. Discrete exterior calculus and the Hodge decomposition
6. Discrete exterior calculus and the Hodge decomposition
This is a live 3D object — click and drag to rotate it.
The full Hodge decomposition of the swirl: exact (gradient, ≈0%), coexact (curl, 27%), harmonic (73%). The harmonic component is the topological circulation around the hole.
7. Convergence and the order of accuracy
7. Convergence and the order of accuracy
Two lessons. (i) The pointwise operators are second-order accurate — the same order as piecewise-linear finite elements, which is exactly what they are. (ii) The Gauss–Bonnet residual does not improve with refinement because it never had error to begin with: it is a combinatorial identity. Structure-preservation and approximation accuracy are different virtues, and DDG delivers both — exact where a theorem demands it, convergent where a number is estimated.
8. The operators on a real 3D scan
8. The operators on a real 3D scan
Spheres and tori let us check answers; real geometry shows the operators are not toys. We take a 332k-vertex photogrammetric scan of a Tyrannosaurus rex skull (a museum cast, released CC0 by Emily Hauf / Digital Atlas of Ancient Life), weld its duplicate vertices, keep the largest component, and quadric-decimate it to a clean 12k-triangle mesh (a one-off open3d step; the result is committed, so the analysis stays pure Wolfram Language). Every operator runs on it unchanged. Rotate the geodesic field — note the distance creeping back from the snout, reaching the back of the cranium only after travelling along the jaws and around the skull's openings, exactly as an ant on the surface would:
This is a live 3D object — click and drag to rotate it.
And mean curvature picks out the teeth, the rims of the eye sockets and the skull fenestrae, and the bone sutures (a robust quantile clip suppresses scan noise):
This is a live 3D object — click and drag to rotate it.
Laplace–Beltrami eigenfunctions on the scan: the elongated snout carries a distinct low-frequency mode; spatial frequency rises with the eigenvalue. The DDG operators degrade gracefully on messy, boundary-carrying geometry — the skull's fenestrae are real boundaries — which is why they underpin real geometry-processing software.
9. From meshes to networks: discrete curvature on graphs
9. From meshes to networks: discrete curvature on graphs
A triangle mesh is, underneath, just a graph — vertices joined by edges. Strip away the coordinates and ask: how much geometry survives in the bare combinatorics? This is the question of network science and of the Wolfram Physics Project, where space itself is meant to emerge from a graph. Remarkably, both curvature and dimension can be read off connectivity alone.
Ollivier-Ricci is principled but costs a linear program per edge. A cheap alternative is Forman-Ricci, a purely local count,
Forman-Ricci vs Ollivier-Ricci, edge by edge. The cheap, degree-based Forman curvature correlates strongly with the transport-based Ollivier curvature — a fast proxy — though offset by the degree term.
Now point this at our own meshes, as graphs. A geodesic sphere is almost a hexagonal tiling — but Euler's formula forbids tiling a sphere with hexagons alone. Exactly twelve pentagons (degree-5 vertices) are forced, and that is precisely where the positive Ollivier-Ricci curvature concentrates: the soccer-ball theorem, a combinatorial face of Gauss–Bonnet (χ = 2). Rotate the sphere to find its twelve defects:
This is a live 3D object — click and drag to rotate it.
The structured torus, by contrast, is a perfect triangular lattice — every vertex has degree 6 — so its Ollivier-Ricci curvature is zero everywhere, the combinatorial signature of an intrinsically flat surface (χ = 0). The graph cannot see the embedding's bending, only its intrinsic, topological curvature.
recovers the dimension. On periodic lattices it returns 1, 2, 3 (with a characteristic finite-size underestimate from the discrete ball corrections), and our sphere and torus mesh-graphs both come out two-dimensional — read purely from their connectivity, with no coordinates at all:
Emergent dimension from ball growth. The log-log slopes separate 1D (ring), 2D (2-torus and both mesh-graphs) and 3D (3-torus).
Curvature-guided coarsening
Curvature-guided coarsening
Because Forman-Ricci is so cheap, it can drive a computation, not just describe one. A discrete analogue of Ricci flow — which contracts regions of high curvature — is to repeatedly merge the edge of maximal Forman curvature (the most clustered, redundant edge). This coarse-grains the graph while preserving its large-scale shape. Two consequences are worth seeing. First, coarsening a 2D mesh-graph leaves its emergent dimension essentially unchanged — dimension is scale-invariant, the renormalization-group signature of a genuine geometry:
A 2D mesh-graph coarsened from ~1000 to ~500 vertices keeps dimension d ≈ 1.8; only when the graph becomes too small to fit a power law does the estimate dip.
Second, on a graph with planted communities the dense (high-curvature) intra-community edges collapse first, so the same coarsening merges each community into a super-vertex and recovers the network's modular skeleton (here at ≈ 82% purity):
Forman-guided coarsening as community detection: 180 vertices in four planted communities (left) collapse to a handful of super-vertices coloured by their dominant community (right; size = number of members absorbed).
10. A Wolfram-Physics bridge: emergent geometry of a hypergraph
10. A Wolfram-Physics bridge: emergent geometry of a hypergraph
A Wolfram-model hypergraph (the spatial graph of a rewriting system).
We can interrogate its geometry with the very same tools. Its geodesic balls grow faster than any power of r (no finite dimension), and its Ollivier-Ricci curvature is negative on average (mean ≈ −0.13) with strongly negative spikes (to −1.5) at the high-degree hubs: this rule grows a negatively curved, tree-like emergent space — the opposite of the flat lattices and the two-dimensional mesh-graphs above.
The Wolfram-model spatial graph coloured by Ollivier-Ricci curvature (blue = negative): a negatively curved, tree-like emergent geometry.
A gallery of networks
A gallery of networks
The two probes — curvature κ and dimension d — are a general lens, so we turn them on a small zoo of networks. Each is laid out, then placed in the curvature-dimension plane:
A geometric zoo: periodic lattices, a random geometric graph, a small-world (Watts–Strogatz) and a scale-free (Barabási–Albert) network, and a Wolfram-model hypergraph, each labelled with its estimated dimension and mean Ollivier-Ricci curvature.
The curvature-dimension plane. The κ = 0 line is the robust classifier: lattices sit on it (Euclidean), the clustered random geometric graph rises above it (positively curved), and the small-world, scale-free and Wolfram-model networks fall below (negatively curved). Ball-growth dimension is reliable for the regular lattices and only indicative for the small-world and dense graphs, whose balls saturate too fast for a clean power law.
Two robust lessons survive the noise in d. First, curvature is the cleaner classifier: it cleanly separates flat (κ=0), clustered/positively-curved, and hub-dominated/negatively-curved networks. Second, the networks that look geometric (lattices, the random geometric graph) are precisely those near κ=0 with an integer-ish dimension; small-world structure — shortcuts, hubs — shows up as negative curvature and a runaway, ill-defined dimension. This is exactly the diagnostic the search for a physically realistic Wolfram-model rule needs.
A small rule-search
A small rule-search
A first 20-rule screen: emergent geometry is either ~1D or exponential; the flat 2D/3D regime is empty. A 1D rule and an exponential rule bracket the g²/g³ growth a 2D/3D space would need.
Scaling up to 160 rules, and replacing the crude growth exponent with a proper exponential-vs-power-law fit (a two-point exponent cannot tell an exponential of small base from a genuine power law), sharpens the picture: 103 grow exponentially, 31 are trivial, 19 are ~1D, just 5 are ~2D and none ~3D — only two of the 160 land anywhere in the flat 2D/3D band.
The census over 160 rules. Left: the finite-dimensional rules cluster at d ≈ 1; the flat 2D/3D band is nearly empty. Right: exponential (hyperbolic) growth is overwhelmingly the norm.
The open problem. Most simple rules give either 1-dimensional or exponentially-growing (hyperbolic) space. Finding rules whose large-scale limit is flat and finite-dimensional — like the 3+1-dimensional space we live in — is the central challenge of the programme. The discrete-geometry toolkit of this notebook is exactly what one needs to test a candidate rule.
11. Validation summary
11. Validation summary
Nothing above is asserted without a check against a smooth reference, a conservation law, or a topological invariant:
12. References
12. References
Meyer, M., Desbrun, M., Schröder, P., Barr, A. (2003). Discrete differential-geometry operators for triangulated 2-manifolds. Visualization and Mathematics III, 35–57.
Desbrun, M., Meyer, M., Schröder, P., Barr, A. (1999). Implicit fairing of irregular meshes using diffusion and curvature flow. SIGGRAPH '99, 317–324.
Crane, K., Weischedel, C., Wardetzky, M. (2013). Geodesics in heat. ACM Trans. Graph. 32(5). cs.cmu.edu/~kmcrane/Projects/HeatMethod
Reuter, M., Wolter, F.-E., Peinecke, N. (2006). Laplace–Beltrami spectra as Shape-DNA of surfaces and solids. Computer-Aided Design 38, 342–366.
Huisken, G. (1984). Flow by mean curvature of convex surfaces into spheres. J. Differential Geom. 20, 237–266.
Crane, K. Discrete Differential Geometry: An Applied Introduction (CMU 15-458/858). cs.cmu.edu/~kmcrane/Projects/DDG
Botsch, M., Kobbelt, L., Pauly, M., Alliez, P., Lévy, B. (2010). Polygon Mesh Processing. AK Peters.
Forman, R. (2003). Bochner's method for cell complexes and combinatorial Ricci curvature. Discrete & Computational Geometry 29, 323–374.
Ollivier, Y. (2009). Ricci curvature of Markov chains on metric spaces. J. Functional Analysis 256, 810–864.
Wolfram, S. (2020). A Project to Find the Fundamental Theory of Physics. Wolfram Media. wolframphysics.org
13. Reproducibility
13. Reproducibility
All code is pure Wolfram Language, and the code behind every figure is shown inline above it. The two packages wolfram/ddg.wl and wolfram/graphgeometry.wl (loaded in the Setup cell) hold the operators; each section then shows the full calls — with all arguments — that produced its figures. The package wolfram/ddg.wl defines the mesh accessors, test meshes and operators; each section's figures come from one standalone script, and every operator has a sanity check in tests/ (all exit 0). wolfram/models.wls exports the live Graphics3D in this notebook; the one non-WL step is a one-off open3d decimation of the T. rex skull scan. That scan is a museum cast digitised by Emily Hauf for the Digital Atlas of Ancient Life (Paleontological Research Institution) and released into the public domain (CC0); see data/CREDITS.md.
wolframscript -file wolfram/curvature.wls # §1 Gaussian curvature
wolframscript -file wolfram/meancurvature.wls # §1-2 mean curvature
wolframscript -file wolfram/spectral.wls # §3 spectrum + harmonics
wolframscript -file wolfram/meanflow.wls # §4 mean-curvature flow
wolframscript -file wolfram/heat.wls # §5 heat-method geodesics
wolframscript -file wolfram/hodge.wls # §6 DEC + Hodge
wolframscript -file wolfram/convergence.wls # §7 order of accuracy
wolframscript -file wolfram/trex.wls # §8 the 3D scan
wolframscript -file wolfram/graphcurvature.wls # §9 graph curvature + dimension
wolframscript -file wolfram/wolframmodel.wls # §10 Wolfram-model hypergraph
wolframscript -file wolfram/networkgallery.wls # §10 network gallery
wolframscript -file wolfram/forman.wls # §9 Forman vs Ollivier
wolframscript -file wolfram/coarsen.wls # §9 curvature-guided coarsening
# scripts/search_wolframmodel.wls, scripts/enumerate_wolframmodel.wls
# -- one-off Wolfram-model rule searches (need internet)
wolframscript -file wolfram/models.wls # live rotatable models
wolframscript -file community/build_notebook.wls # this notebook
# wolfram/run_all.wls runs the whole pipeline end to end.
wolframscript -file wolfram/meancurvature.wls # §1-2 mean curvature
wolframscript -file wolfram/spectral.wls # §3 spectrum + harmonics
wolframscript -file wolfram/meanflow.wls # §4 mean-curvature flow
wolframscript -file wolfram/heat.wls # §5 heat-method geodesics
wolframscript -file wolfram/hodge.wls # §6 DEC + Hodge
wolframscript -file wolfram/convergence.wls # §7 order of accuracy
wolframscript -file wolfram/trex.wls # §8 the 3D scan
wolframscript -file wolfram/graphcurvature.wls # §9 graph curvature + dimension
wolframscript -file wolfram/wolframmodel.wls # §10 Wolfram-model hypergraph
wolframscript -file wolfram/networkgallery.wls # §10 network gallery
wolframscript -file wolfram/forman.wls # §9 Forman vs Ollivier
wolframscript -file wolfram/coarsen.wls # §9 curvature-guided coarsening
# scripts/search_wolframmodel.wls, scripts/enumerate_wolframmodel.wls
# -- one-off Wolfram-model rule searches (need internet)
wolframscript -file wolfram/models.wls # live rotatable models
wolframscript -file community/build_notebook.wls # this notebook
# wolfram/run_all.wls runs the whole pipeline end to end.
Built June 12, 2026 with Wolfram Language. Repository scaffolding and notebook build assisted by Claude Code.
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Discrete differential geometry on meshes via the cotangent Laplacian
by Marco Thiel
Wolfram Community, STAFF PICKS, June 12, 2026
https://community.wolfram.com/groups/-/m/t/3732396
by Marco Thiel
Wolfram Community, STAFF PICKS, June 12, 2026
https://community.wolfram.com/groups/-/m/t/3732396