Skip to main content

monocert

tests License: MIT Python

Certified interior evaluation of monogenic fields from boundary samples, in any dimension.

Problem

A field annihilated by the Dirac operator, $\nabla F = 0$, is determined inside a ball by its values on the sphere through the Clifford–Cauchy formula. In practice the boundary values are finitely many samples carrying error, and the reconstruction degrades towards the boundary. Two questions have to be answered before such a reconstruction can be used: how wide is the interval that provably contains $F(a)$, and how deep into the ball a given sample count and noise level still supports a stated accuracy.

The ingredients are classical — the Cauchy kernel, spherical monogenics, the Cauchy–Kovalevskaya extension, Gegenbauer representations of reproducing kernels, cubature on $S^{n-1}$. What is assembled here is the chain from finite positive cubature and bounded per-sample errors to an attained amplification constant and a recoverable depth. clifford and galgebra implement the algebra, Arb implements rigorous arithmetic, and the cubature literature stops at harmonics; none of them carries the constants through to this statement. A full literature review is still to be written, and the phrasing here is deliberately about what this library does rather than about what does not exist.

What is proved

$\mathrm{Cl}(\mathbb{R}^n)$ has $e_ie_j+e_je_i=2\delta_{ij}$; $x$ is the position vector, $r=|x|$, $\hat\omega=x/r$; $\nabla=\sum_i e_i\partial_i$; $\mathsf E=x\cdot\nabla$; $\mathsf L=x\wedge\nabla$.

Proposition 1. As operators on Clifford-valued fields,

$$x\nabla=\mathsf E+\mathsf L,\qquad \nabla x=n+\mathsf E-\mathsf L,\qquad \mathsf L(xF)=x\big((n-1)F-\mathsf LF\big)$$

$$r^2\nabla^2=\mathsf E^2+(n-2)\mathsf E+(n-2)\mathsf L-\mathsf L^2$$

The third is the intertwining relation $\mathsf L\hat\omega=\hat\omega((n-1)-\mathsf L)$ cleared of $1/r$; the fourth is the radial–angular split, with $\Delta_{S^{n-1}}=(n-2)\mathsf L-\mathsf L^2$. Verified in exact rational arithmetic for $n=2,\dots,6$.

Proposition 2. For $P_k$ left monogenic and homogeneous of degree $k$,

$$\mathsf E P_k=kP_k,\qquad \mathsf L P_k=-kP_k,\qquad \Delta_{S^{n-1}}P_k=-k(k+n-2)P_k$$

Theorem 1. Let $F$ be left monogenic on a neighbourhood of $\overline B(0,R)\subset\mathbb R^n$ with $F=\sum_{k\le d}P_k$. Let $(\xi_j,w_j)$ be a cubature rule on $S^{n-1}$ with $w_j>0$, $\sum_j w_j=S_{n-1}$, exact for polynomials of degree at most $2d$. Put $\rho=|a|/R<1$, $\hat a=a/|a|$, $t=\langle\xi,\hat a\rangle$, and

$$K_d(\rho,\hat a,\xi)=\sum_{k=0}^{d}\rho^k\Big(\xi,C_k^{n/2}(t)-\hat a,C_{k-1}^{n/2}(t)\Big)$$

If $|\hat F_j-F(R\xi_j)|\le\varepsilon_j$ and $\tilde F(a)=S_{n-1}^{-1}\sum_j w_j K_d(\rho,\hat a,\xi_j),\xi_j,\hat F_j$, then

$$\big|\tilde F(a)-F(a)\big|;\le;\frac{1}{S_{n-1}}\sum_j w_j\big|K_d(\rho,\hat a,\xi_j)\big|,\varepsilon_j$$

and equality holds for an admissible sample error. For a common $\varepsilon$ the factor is $A_d(a)=S_{n-1}^{-1}\sum_j w_j|K_d|$, so $A_d$ is not an estimate of the conditioning, it is the conditioning.

Proof. Write the Cauchy formula with the kernel scaled, $F(a)=S_{n-1}^{-1}\int G(\xi,a),\xi,F(R\xi),d\sigma$, $G=R^{n-1}(R\xi-a)|R\xi-a|^{-n}$. Since $|R\xi-a|=R|\xi-\rho\hat a|$ and $|\xi-\rho\hat a|^2=1-2\rho t+\rho^2$,

$$G(\xi,a)=(\xi-\rho\hat a)\big(1-2\rho t+\rho^2\big)^{-n/2}=\sum_{k\ge0}\rho^k\Big(\xi,C_k^{n/2}(t)-\hat a,C_{k-1}^{n/2}(t)\Big)$$

by the Gegenbauer generating function with $\lambda=n/2$. The degree $k$ term reproduces $P_k$ and annihilates $P_l$ for $l\ne k$, so truncating at $d$ is exact on $F$. Next, $C_k$ is scalar and $\xi^2=1$ on the sphere, so $K_d\xi=\sum_k\rho^k(C_k(t)-\hat a,\xi,C_{k-1}(t))$ has degree at most $d$ in $\xi$, not $d+1$; the integrand $K_d,\xi,F(R\xi)$ therefore has degree at most $2d$ and the rule integrates it exactly. Finally $K_d$ is a vector and $|vM|=|v||M|$ for a vector $v$, which gives the bound; taking $\delta_j=\varepsilon_j\widetilde{K_j\xi_j}/|K_j|$ makes every summand a nonnegative multiple of a common unit, which gives equality. $\square$

Degree $2d$ is sharp: test_exactness_2d_is_sharp reconstructs exactly with a rule of exactness $2d$ and fails with $2d-1$.

Theorem 2. Under the hypotheses of Theorem 1, for every direction,

$$\frac{1}{S_{n-1}}\sum_j w_j\big|K_d(\rho,\hat a,\xi_j)\big|^2=\sum_{k=0}^{d}\binom{k+n-2}{k}\rho^{2k}$$

Hence, writing $\Phi_d(\rho)$ for the square root of the right-hand side,

$$A_d(\rho,\hat a);\le;\Phi_d(\rho);\le;\big(1-\rho^2\big)^{\frac{1-n}{2}}$$

Proof. $|K_d|^2$ has degree at most $2d$ in $\xi$, so the sum equals the integral, which is rotation invariant and therefore independent of $\hat a$. Expanding $|G|^2=(1-2\rho t+\rho^2)^{1-n}$ and averaging term by term gives the stated coefficients; truncation at $d$ keeps the first $d+1$ of them. The first inequality is Cauchy–Schwarz against the probability measure $w_j/S_{n-1}$, the second is the completion of the series, $\sum_k\binom{k+n-2}{k}\rho^{2k}=(1-\rho^2)^{1-n}$. $\square$

Every coefficient of $\Phi_d^2$ is positive, so $\Phi_d$ is strictly increasing.

Definition. The certified ball is $\rho_*(\delta,\varepsilon)=\sup{\rho:\Phi_d(\rho)\varepsilon\le\delta}$, the largest relative radius at which the enclosure width stays below $\delta$ at every interior point and in every direction. Monotonicity of $\Phi_d$ is proved, so bisection needs no further hypothesis.

The pointwise $A_d$ is sharper than $\Phi_d$ — typically by a factor near $1.5$ — but its monotonicity in $\rho$ is not proved here, so no depth is defined through it.

What is in the code

core — Clifford-valued polynomial fields over $\mathbb{Q}$ with $\nabla$, $\mathsf E$, $\mathsf L$, dimension-generic and exact. monogenic — spherical monogenics of any degree and dimension by Cauchy–Kovalevskaya extension. sphere — positive product cubature on $S^{n-1}$ from nested Gauss–Gegenbauer rules, the truncated kernel $K_d$, $\Phi_d$, and rule_defect. certify — the reconstruction, $A_d$, the enclosure with per-sample error bounds, and the certified ball.

Propositions 1 and 2 are tested symbolically, so those tests are proofs on the polynomial test space rather than samples. Theorem 1 is tested against exactly known monogenics, its sharpness by constructing the worst case, and the heterogeneous form the same way. Theorem 2 is tested as an identity across $n=2,\dots,6$, all degrees, arbitrary directions and $\rho$ up to $0.99$.

import numpy as np
from monocert import sphere_rule, exactness, monogenic_basis, sample, certify

n, d, R, eps = 3, 4, 1.0, 1e-4
nodes, w = sphere_rule(n, d + 1, 2 * d + 1)
F = monogenic_basis(n, d)[-1]                    # a test field
c = certify(nodes, w, sample(F, nodes, R), a=[0, 0, 0.8], R=R,
            d=d, eps=eps, exact_to=exactness(d + 1, 2 * d + 1))
c.value, c.radius, c.amplification, c.uniform_bound

examples/depth.py prints the amplification table, the certified ball, and a mixed-accuracy sensor case.

What is certified, and what is not

Theorems 1 and 2 govern the propagation of sample error under their hypotheses, and that is what Certificate.radius reports, plus a rounding term for the final summation. The arithmetic is floating point throughout: the Gauss–Gegenbauer nodes and weights, the Gegenbauer recurrence and the kernel are computed in double precision, and those errors are measured rather than bounded — sphere.rule_defect returns the observed failure of exactness of the constructed rule, which is around $10^{-15}$ inside the exactness range. End-to-end certification needs ball arithmetic and is not done here.

Theorem 1 also covers only fields of degree at most $d$. For general monogenic $F$ the truncation leaves a remainder whose bound needs an explicit estimate of the best degree $d$ approximation of $G(\cdot,a),\xi,F(R\xi)$ on the sphere, in $n$ and $\rho$. Until that constant is written down the unbounded-degree case is not certified, and the code does not pretend otherwise: certify records the degree and the exactness of the rule, and Certificate.valid checks them.

Notation

$n$, dimension. $\mathrm{Cl}(\mathbb{R}^n)$, Clifford algebra with $e_ie_j+e_je_i=2\delta_{ij}$; juxtaposition is the geometric product, $\cdot$ and $\wedge$ its scalar and bivector parts; $|\cdot|$ the Euclidean norm on blades; $\widetilde M$ the reverse of $M$. $x$, position vector, components $x_i$; $r=|x|$; $\hat\omega=x/r$. $\nabla=\sum_ie_i\partial_i$, the vector derivative, $\nabla^2=\Delta$. $\mathsf E=x\cdot\nabla$, Euler operator. $\mathsf L=x\wedge\nabla$, bivector-valued, components $\mathsf L_{ij}=x_i\partial_j-x_j\partial_i$. $\Delta_{S^{n-1}}$, Laplace–Beltrami operator on the unit sphere. $F$, Clifford-valued field, left monogenic when $\nabla F=0$; $P_k$ its homogeneous monogenic component of degree $k$; $d$, the truncation degree. $S^{n-1}$, unit sphere; $d\sigma$, its surface measure; $S_{n-1}=2\pi^{n/2}/\Gamma(n/2)$, its mass. $R$, ball radius; $a$, interior evaluation point; $\rho=|a|/R$; $\hat a=a/|a|$. $\xi_j,w_j$, cubature nodes and weights; $\hat F_j$, samples; $\delta_j$, sample errors; $\varepsilon_j$, their bounds; $\delta$, target enclosure width. $C_k^{\lambda}$, Gegenbauer polynomial; $t=\langle\xi,\hat a\rangle$. $G$, Cauchy kernel; $K_d$, its truncation; $A_d$, the attained amplification; $\Phi_d$, the direction-free bound; $\rho_*$, the certified ball.

Install

pip install -e ".[test]"
pytest -q

Python 3.10 or later, NumPy only. MIT. Cite through CITATION.cff.

Release files for monocert 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for monocert 0.1.0
File Size Uploaded
monocert-0.1.0.tar.gz 18.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for monocert 0.1.0
File Interpreter ABI Platform
monocert-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size:32.7 kB

Release files / monocert-0.1.0.tar.gz

Download URL monocert-0.1.0.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cfbf97bd8d74f9cd7dd92d39190ee527af86a434d56c4379523ee6588dcb9fa6
BLAKE2b-256 checksum
How to use checksums
1714ad63484241c67c33c9d1a2aa17be6c06c1f77fd3e071159326e9ef7cd378
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / monocert-0.1.0-py3-none-any.whl

Download URL monocert-0.1.0-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd8e4141c153a329b606a3dacd5226447e3a7f5e3ee4335ba2007754e9cedbd9
BLAKE2b-256 checksum
How to use checksums
eaff1969e70c6f0e4b3482ec551462bd0b16dff2704ea9f5b7e281ceff1fee45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page