Semantics of Integrating and Differentiating Singularities
A \textit{singular function} is a partial function such that at one or more points, the left and/or right limit diverge (e.g., the function $1/x$). Since programming languages typically support division, programs may denote singular functions. Although on its own, a singularity may be considered a bug, introducing a division-by-zero error, \textit{singular integrals}—a version of the integral that is well-defined when the integrand is a singular function and the domain of integration contains a singularity—arise in science and engineering, including in physics, aerodynamics, mechanical engineering, and computer graphics.
In this paper, we present the first semantics of a programming language for singular integration. Our differentiable programming language, \textsc{SingularFlow}, supports the evaluation and differentiation of singular integrals. We formally define the denotational semantics of \textsc{SingularFlow}, deriving all the necessary mathematical machinery so that this work is rigorous and self-contained. We then define an operational semantics for \textsc{SingularFlow} that estimates integrals and their derivatives using Monte Carlo samples, and show that the operational semantics is a well-behaved estimator for the denotational semantics.
We implement \textsc{SingularFlow} in JAX and evaluate the implementation on a suite of benchmarks that perform the \textit{finite Hilbert transform}, an integral transform related to the Fourier transform, which arises in domains such as physics and electrical engineering. We then use \textsc{SingularFlow} to approximate the solutions to four \textit{singular integral equations}—equations where the unknown function is in the integrand of a singular integral—arising in aerodynamics and mechanical engineering.