--- abstract: 'The interaction between discrete and continuous mathematics lies at the heart of many fundamental problems in applied mathematics and computational sciences. In this paper we discuss the problem of discretizing vector-valued functions defined on finite-dimensional Euclidean spaces in such a way that the discretization error is bounded by a pre-specified small constant. While the approximation scheme has a number of potential applications, we consider its usefulness in the context of computational homology. More precisely, we demonstrate that our approximation procedure can be used to rigorously compute the persistent homology of the original continuous function on a compact domain, up to small explicitly known and verified errors. In contrast to other work in this area, our approach requires minimal smoothness assumptions on the underlying function.' author: - | Pawe<span>ł</span> D<span>ł</span>otko\ Inria Saclay – Ile-de-France\ 1 rue Honoré d'Estienne d'Orves\ 91120 Palaiseau, France - | Thomas Wanner\ Department of Mathematical Sciences\ George Mason University\ Fairfax, VA 22030, USA date: title: | Rigorous cubical approximation and persistent homology\ of continuous functions --- Introduction {#sec:introduction} ============ In many applied situations it is necessary to replace a given smooth function by a discretized version which in some sense is close to the given original mapping. In this paper we discuss a number of algorithms for approximating a continuous function $f : D \rightarrow \mathbb{R}^m$, defined on a compact rectangular domain $D \subset \mathbb{R}^n$, using piecewise constant functions. In order to achieve approximations with mathematically verified approximation bounds, our approach relies on the use of rigorous computer arithmetic. One such example is interval arithmetic @moore, and it will form the foundation of the algorithms described in the present paper. However, our approach can also be used with any other rigorous computer arithmetic which provides rigorous enclosures of function values. For example, our algorithms can readily be adapted to employ alternative tools such as affine arithmetic @affineArithmetic, generalized interval arithmetic @generalizedIntervalArithmetic, or in fact, any other rigorous arithmetic capable of providing range enclosures. Upon successful completion, the algorithms presented in this paper will return a decomposition of the rectangular domain $D$ into a collection of compact $n$-dimensional rectangles, any two of which only intersect in a subset of their topological boundaries. Furthermore, each rectangle $R$ in the collection is assigned a value $val(R)$ in $\mathbb{R}^m$. The approximating function $\Box f$ is then defined in the following way. For every rectangle $R$ in the constructed decomposition, the function value of $\Box f$ in the interior of $R$ is given by $val(R)$. On the other hand, if $x \in D$ lies in the intersection of $k$ rectangles $R_1, \ldots, R_k$, then we define $\Box f(x) = \min_{i = 1,\ldots,k} val(R_i)$. In this way, the decomposition of $D$ produced upon successful completion of the algorithm gives rise to a lower semi-continuous piecewise constant approximation $\Box f$ of the given continuous function $f$. We will see later that the algorithm in fact guarantees the inequality $$\| f - \Box f \|_{\infty} < {\varepsilon}\; , \quad\mbox{ where ${\varepsilon}> 0$ denotes the input parameter of the algorithm,}$$ and where $\| \cdot \|_\infty$ denotes the usual maximum norm. This procedure is illustrated in the two panels of Figure \[fig:introex\]. In the left panel, the approximating function $\Box f$ is shown for the one-dimensional function $f(x) = 2 - 25 x + 108 x^2 - 162 x^3 + 81 x^4$ on the interval $D = [0,1]$, and with approximation parameter ${\varepsilon}= 1/2$. The right panel contains the approximation for the so-called Ackley function, which is one of the standard test functions in nonlinear optimization and which will be discussed in more detail later in this paper. ![Sample approximating functions $\Box f$. The left image is for the one-dimensional function $f(x) = 2 - 25 x + 108 x^2 - 162 x^3 + 81 x^4$ on the interval $D = [0,1]$, and with approximation parameter ${\varepsilon}= 1/2$. The function $f$ is shown in blue, while its approximation $\Box f$ is depicted in red. Red dots indicate the function values at the points in $D$ which are contained in more than one intervals of the final decomposition. The right panel shows an approximation for the Ackley function with ${\varepsilon}= 2$.<span data-label="fig:introex"></span>](introex1a.pdf){width="7cm"} ![Sample approximating functions $\Box f$. The left image is for the one-dimensional function $f(x) = 2 - 25 x + 108 x^2 - 162 x^3 + 81 x^4$ on the interval $D = [0,1]$, and with approximation parameter ${\varepsilon}= 1/2$. The function $f$ is shown in blue, while its approximation $\Box f$ is depicted in red. Red dots indicate the function values at the points in $D$ which are contained in more than one intervals of the final decomposition. The right panel shows an approximation for the Ackley function with ${\varepsilon}= 2$.<span data-label="fig:introex"></span>](introex1b.pdf){width="8.2cm"} The approximation algorithms presented in this paper can in principle be applied in a number of situations. For example, in the context of global optimization they allow one to rigorously narrow down the search for global minima or maxima of a real-valued function, as can easily be seen in the examples of Figure \[fig:introex\]. Rather than pursuing such applications, we confine ourselves to the computation of the persistent homology of a function. One-dimensional persistent homology was introduced in @zomorodianPersistence, and since then has become one of the main topological tools in the applied sciences for studying the shape of functions or spaces. Its popularity can be attributed to a variety of factors: - Persistent homology provides quantitative information about the object of interest, including information about its shape, - the obtained information is both metric and coordinate free, and - the information is preserved under continuous deformations, i.e., it is invariant with respect to isometries. - Persistence captures topological information at different scales, - it is robust with respect to the influences of random noise, and - efficient algorithms are available for its computation. At present, persistent homology can only be determined algorithmically for the case of scalar-valued functions, i.e., only one-dimensional persistence is amenable to a computational treatment. For this, one needs to find a suitable filtration of a finite cell complex, and the results of this paper will enable its efficient construction. Due to deep results from quiver theory @gunnar, there are no finite invariants which completely characterize multi-dimensional persistent homology. Nevertheless, there are many groups working on providing partial invariants for multi-dimensional persistent homology that can be used in practice. The algorithms presented in this paper for the case of functions $f : D \subset \mathbb{R}^n \rightarrow \mathbb{R}^m$ provide discretizations of $f$ with rigorous error bounds. These discretizations can immediately be used in the computation of one-dimensional persistent homology, i.e., in the scalar-valued case $m=1$. We would like to point out, however, that the approximations can potentially also be used in the context of recently developed algorithms which compute partial invariants of multi-dimensional persistent homology. In order to specifically accommodate the computation of persistent homology, we consider specific approximations in which, in addition to the rectangular decomposition of the domain $D$, we also keep track of all the intersections of the rectangles in the decomposition. This is achieved by constructing a weighted cell complex which will later be used to compute persistent homology or some invariants of multi-dimensional persistent homology. Approximating continuous functions is a part of the classical simplicial approximation theorem @introToAT. However, we are not aware of any attempts to create lower semi-continuous approximations of continuous functions using rigorous computer arithmetic. In the context of differentiable functions, the work @miro comes close in spirit to the present paper. The authors use a generalization of quad-trees and oct-trees to compute compatible cellular decompositions for level sets of a given differentiable function. Then, after computing the generators of the associated homology groups at each level of the filtration, together with their inclusions, they obtain the persistent homology of a differentiable function. It is worth mentioning that through the computation of the persistence of inclusions between two fixed level sets, the authors of @miro obtain an exact persistence result for the chosen levels. Similar idea to compute standard persistent homology was used in @mw10. This, however, requires the successful termination of their algorithm. Unfortunately, even in the examples presented in their paper, their algorithm cannot validate a significant number of levels, which is due to grid alignment issues which were first pointed out in @cochran:etal:13a. They arise naturally in the setting of @miro, since the authors have to use binary subdivisions for the persistence computations, and since varying the threshold level ensures that the level curves will frequently come close to the binary subdivision lines. In the context of one fixed level set, this effect has been one of the shortcomings of the method in @day:etal:09a, but it could be removed through randomized subdivisions in @cochran:etal:13a. Unfortunately, the simple randomization trick cannot be applied in the setting of @miro. Moreover, the total computational cost of the method in @miro may in some cases be higher than the one of our method presented below. This is due to the fact that in @miro the authors need to exactly verify every intermediate level set, and then perform independent homology computations at each filtration level. Other approaches to approximating the persistence of functions, which also take errors into account, were presented in @Edels2 and @Edels1. In the former paper, the authors employ oct-trees to approximate the persistence of a digital image as accurately as possible for a fixed number of simplification steps. In fact, one of our algorithms, the one presented in Section \[sec:greedyApproximation\], is directly inspired by this approach. Finally, the paper @Edels1 is concerned with persistent homology computations in the presence of non-uniform error models. The remainder of this paper is organized as follows. In Section \[sec:PersistentHomology\] we give a short introduction to rectangular CW-complexes, homology and (multi-dimensional) persistent homology, and we survey necessary results on the stability of persistent homology. Section \[sec:cubapprox\] contains the main results of the paper. After collecting some basic results from interval arithmetic in Section \[sec:intervalArithmetic\], we then turn our attention to the main algorithms. In Section \[sec:approximationContFunctions\] we begin with a method for computing a piecewise constant approximation of a continuous function $f : D \subset \mathbb{R}^n \rightarrow \mathbb{R}^m$, and discuss termination criteria as well as complexity issues for a large class of functions $f$. This is followed in Section \[sec:SubdivAlgorithm\] by a rectangle subdivision algorithm which, during the subdivision process, keeps track of all boundary elements, and which establishes a lower semi-continuous approximation. In the end, this method allows us to construct a cell complex which is suitable for the computation of persistence. This will be outlined in detail in Section \[sec:cubicalApproximationPersistence\], where we use the subdivision algorithm to first construct a filtered complex, and then its (multi-dimensional) persistent homology. It will be shown that the resulting persistence diagram is close to the persistent homology of the underlying function $f$. A second approximation algorithm, which is motivated by the approach in @Edels2, is the subject of Section \[sec:greedyApproximation\]. This time, we aim to approximate the persistent homology of $f$ as effectively as possible using a limited number of subdivisions. Finally, Section \[sec:experiments\] contains a number of numerical case studies. Persistent Homology {#sec:PersistentHomology} =================== In this section we provide a brief introduction to persistent homology, in order to keep the present paper as self-contained and accessible as possible. For a more-detailed introduction to standard algebraic topology we refer the reader to @massey, an extensive introduction to applied and computational topology can be found in @herbert. Rectangular CW-Complexes {#sec:PersistentHomology1} ------------------------ In the following, the term *interval* is always used for a compact interval $I = [a,b] \subset \mathbb{R}$ with $a \leq b$. We say that the interval $I$ is *degenerate* if $a = b$, otherwise it is called *nondegenerate*. In order to describe the algebraic boundary of intervals, we say that a degenerate interval has no faces, while the nondegenerate interval $I = [a,b]$ has the two faces $[a] := [a,a]$ and $[b] := [b,b]$. Intervals as defined above are the building blocks of higher-dimensional sets in the following sense. A *rectangle* in $\mathbb{R}^d$ is a product $Q = Q_1 \times Q_2 \times \ldots \times Q_d$ of $d$ intervals $Q_1, Q_2, \ldots, Q_d$. The dimension of $Q$, abbreviated as $\dim{Q}$, is the number of nondegenerate intervals among $Q_1, Q_2, \ldots, Q_d$. Consider now two rectangles $Q = Q_1 \times \ldots \times Q_d$ and $P = P_1 \times \ldots \times P_d$. Then the rectangle $P$ is called a *primary face* of $Q$ if $P \subset Q$, the dimensions satisfy $\dim{P} = \dim{Q} - 1$, and if there exists an index $j$ such that $P_j$ is a face of $Q_j$, in the sense defined above for intervals. Notice that in this case, the index $j$ is uniquely determined, and we have $\dim P_i = \dim Q_i$ for all $i \neq j$. We would like to point out, however, that it is not required that the identity $P_i = Q_i$ holds for any of these indices — only the inclusions $P_i \subset Q_i$ are necessary. Finally, the rectangle $P$ is called a *face* of $Q$, if either there is a descending sequence of primary faces joining $Q$ to $P$, or if $P$ is the empty set. We now turn to the definition of the boundary of a rectangle. For an interval $I = [a,b]$, its *boundary* is defined as ${bdr\ I} = \{a,b\}$ if $a \neq b$, and as ${bdr\ I} = \emptyset$ if $a > b$. The boundary of a higher-dimensional rectangle $Q = Q_1 \times \ldots \times Q_d$ is defined as the union $${bdr\ Q} = \bigcup_{i=1}^d Q_1 \times \ldots \times {bdr\ Q_i} \times \ldots \times Q_d \; .$$ One can easily see that the boundary ${bdr\ Q}$ corresponds to boundary of the $\dim{Q}$-dimensional manifold $Q$. The above-defined rectangles are the building blocks for more general structured sets. For the purposes of this paper, we consider a *rectangular CW-complex*, which can be defined as follows. A <span>*rectangular structure*</span> is a finite collection $\mathcal{Q}$ of rectangles in $\mathbb{R}^d$ such that for any $P, Q \in \mathcal{Q}$ we either have $P \cap Q = \emptyset$, or $P \cap Q$ is a common face of both $P$ and $Q$ which in addition belongs to $\mathcal{Q}$. Furthermore, we assume that for any rectangle $Q \in \mathcal{Q}$, its boundary satisfies $${bdr\ Q} = \bigcup \left\{ P \in \mathcal{Q} \; : \; P \mbox{ is a primary face of } Q \right\} \; .$$ Finally, a <span>*rectangular CW-complex*</span> $|\mathcal{Q}|$ is given by the union of some rectangular structure $\mathcal{Q}$, i.e., it is the subset of Euclidean space which is occupied by the rectangles in $\mathcal{Q}$. Any $0$-dimensional rectangle in $\mathcal{Q}$ is called a <span>*vertex*</span>, and if $Q \in \mathcal{Q}$ is an $n$-dimensional rectangle, then the set $Q \setminus {bdr\ Q}$ is called an <span>*$n$-cell*</span>. In order to illustrate this definition further, we note that the rectangles in a rectangular structure $\mathcal{Q}$ satisfy the following two properties. - Let $\mathcal{Q}^{(k)}$ denote the rectangles in $\mathcal{Q}$ of dimension $k$. Then for $k \in \mathbb{N}_0$ and rectangles $P,Q \in \mathcal{Q}^{(k)}$ we either have $P \cap Q = \emptyset$, or the intersection $P \cap Q$ is a face of both $P$ and $Q$. - For $k \in \mathbb{N}$ and $P \in \mathcal{Q}^{(k)}$, the union of all rectangles in $\mathcal{Q}^{(k-1)}$ which are primary faces of $P$ equals the boundary ${bdr\ P}$. ![An example of a rectangular CW-complex. The first image shows the initial collection $\mathcal{Q}^{(0)}$ of $46$ zero-dimensional rectangles, the middle image depicts the $70$ one-dimensional rectangles contained in $\mathcal{Q}^{(1)}$, and the last image shows the $25$ two-dimensional rectangles in $\mathcal{Q}^{(2)}$ which fill in the holes. The final rectangular CW-complex is a square.<span data-label="fig:rectCWcomplex"></span>](rectCWcomplex.pdf){width="15.5cm"} Notice that the above description can be used to give an algorithmic description of building $\mathcal{Q}$. Initially, one starts with a collection of zero-dimensional rectangles, i.e., points, in ${{\mathbb{R}}}^d$. Then one adds one-dimensional rectangles connecting some of the points, adds two-dimensional rectangles filling holes, etc. For an example of a rectangular CW-complex, see Figure \[fig:rectCWcomplex\]. The depicted CW-complex decomposes a square into smaller rectangles through selected dyadic subdivisions. In the remainder of this paper, we will only consider rectangular CW-complexes of this type, even though the above definition is more general. This is due to the fact that the algorithms presented below avoid the use of derivatives, which would allow for different adaptive decompositions. Persistent Homology of Rectangular CW-Complexes {#sec:PersistentHomology2} ----------------------------------------------- We now turn our attention to the definition of homology. It was shown in @cw [Theorem 3.9] that every rectangular CW-complex is a CW-complex in the classical sense, see for example @massey. This implies that if a rectangular CW-complex defines a polyhedron, then its homology is isomorphic to its singular homology. In order to further define and then efficiently compute the homology of such a rectangular CW-complex, we make use of the notion of *incidence coefficients* or *incidence numbers*. In the simplest case of homology with coefficients in $\mathbb{Z}_2$, the incidence number of two rectangles $Q,P \in \mathcal{Q}$ satisfies $\kappa(Q,P) = 1$ if and only if $P$ is a primary face of $Q$, and we define $\kappa(Q,P) = 0$ in all other cases. Even for the more involved case of homology with coefficients in a field with at least three elements, the incidence numbers of a rectangular CW-complex can still be computed efficiently, for more details see @cw [Theorem 3.10]. Suppose now that $X \subset \mathbb{R}^d$ denotes a rectangular CW-complex with rectangular structure $\mathcal{Q}$. In order to rigorously define the *homology* of $X$ or $\mathcal{Q}$, we begin by establishing the notions of chains, cycles, and boundaries. Let $\mathbb{F}$ denote an arbitrary coefficient field. Then a *$k$-chain* $c$ is a formal sum of the form $$c = \sum_{A \in \mathcal{Q}^{(k)}} \alpha_A \, A \; , \quad\mbox{ where }\quad \alpha_A \in \mathbb{F} \quad\mbox{ and }\quad \mathcal{Q}^{(k)} = \left\{ Q \in \mathcal{Q} \; : \; \dim Q = k \right\} \; .$$ The set of all $k$-chains forms an additive group, which is called the *$k$-th chain group* and denoted by $C_k(\mathcal{Q})$. For a rectangle $Q \in \mathcal{Q}^{(k)}$, the *boundary* $\partial Q$ of $Q$ is the $(k-1)$-chain given by $$\partial Q = \sum_{P \in \mathcal{Q}^{(k-1)}} \kappa(Q,P) P \; ,$$ which in view of the above discussion of the incidence numbers $\kappa(Q,P)$ is in fact only a sum over the primary faces of $Q$, see also @cw [Section 3.1]. Through linear extension, this defines a homomorphism $\partial : C_k(\mathcal{Q}) \to C_{k-1}(\mathcal{Q})$, which is called the *boundary operator*. One can show that the boundary operator satisfies $$\partial^2 = \partial \circ \partial = 0 \; : \; C_k(\mathcal{Q}) \to C_{k-2}(\mathcal{Q}) \; .$$ A chain $c \in C_k(\mathcal{Q})$ is called a *$k$-cycle*, if $\partial c = 0$. The set of all $k$-dimensional cycles forms an additive group which is denoted by $Z_k(\mathcal{Q})$. A $k$-cycle $d$ is called a *$k$-boundary*, if there exists a chain $e \in C_{k+1}(\mathcal{Q})$ such that $\partial e = d$ holds. The set of all $k$-boundaries is abbreviated by $B_k(\mathcal{Q})$, and one can easily see that it is a subgroup of $Z_k(\mathcal{Q})$. Finally, the *homology group* of $\mathcal{Q}$ in dimension $k$ is then the quotient group $H_k(\mathcal{Q}) = Z_k(\mathcal{Q})/B_k(\mathcal{Q})$. From a geometric point of view, the $k$-th homology group $H_k(\mathcal{Q})$ measures the number of $k$-dimensional holes in $\mathcal{Q}$, and we refer the reader to @herbert [@massey] for more details. As our last concept of this section, we now consider persistent homology. While we keep our discussion brief, a more extensive introduction can be found in @dwphysicad. Consider a rectangular CW-complex given by the rectangular structure $\mathcal{Q}$. Then a subcollection $\mathcal{Q}_0$ of $\mathcal{Q}$ is called a *subcomplex* of $\mathcal{Q}$, if the set $\mathcal{Q}_0$ defines a rectangular structure in its own right. In addition, a sequence of subcomplexes $\emptyset \subset \mathcal{Q}_0 \subset \ldots \subset \mathcal{Q}_{n-1} \subset \mathcal{Q}_n = \mathcal{Q}$ is called a *filtration* of the rectangular CW-complex given by $\mathcal{Q}$. Filtrations lie at the heart of persistent homology, which basically tracks topological changes in the CW-complexes of the filtration as the index increases. While filtrations of CW-complexes can arise in a number of ways, the following situation will be central for the present paper. Consider a function $f : \mathcal{Q} \rightarrow \mathbb{R}$ which assigns a real value to every rectangle in $\mathcal{Q}$. Moreover, assume that $f$ is increasing in the sense that $f(P) \leq f(Q)$ whenever $P \in \mathcal{Q}$ is a face of $Q \in \mathcal{Q}$. One can easily see that if $a_0 \le a_1 \le \ldots \le a_n$ are the finitely many real numbers in the range of $f$, then the sets $$\mathcal{Q}_k = \left\{ Q \in \mathcal{Q} \; : \; f(Q) \le a_k \right\}$$ are rectangular structures, and therefore $\mathcal{Q}_0 \subset \ldots \subset \mathcal{Q}_{n-1} \subset \mathcal{Q}_n = \mathcal{Q}$ is a filtration of the rectangular CW-complex given by $\mathcal{Q}$. We refer to this setting as a *filtered rectangular CW-complex* $|\mathcal{Q}|$ given by $(\mathcal{Q},f)$. Consider now an arbitrary filtration $\mathcal{Q}_0 \subset \ldots \subset \mathcal{Q}_{n-1} \subset \mathcal{Q}_n$ of rectangular CW-complexes. Then for $0 \le a \le b \le n$, we have $\mathcal{Q}_a \subset \mathcal{Q}_b$, which in turn implies $C_k(\mathcal{Q}_a) \subset C_k(\mathcal{Q}_b)$ for all $k \in \mathbb{N}_0$. This inclusion of the chain groups can be used to define homomorphisms of the associated homology groups. More precisely, we define the mapping $\iota^k_{a,b} : H_k(\mathcal{Q}_a) \rightarrow H_k(\mathcal{Q}_b)$ by mapping any representative $k$-chain $c$ of a homology class in $H_k(\mathcal{Q}_a)$ to the homology class generated by $c$ in $H_k(\mathcal{Q}_b)$. One can show that this is well-defined, and that the mappings $\iota^k_{a,b}$ are group homomorphisms. Then the *$k$-th persistent homology groups* are defined as $$H^{a,b}_k(\mathcal{Q}) = \operatorname{Im}\iota^k_{a,b} \; ,$$ i.e., as the images of the homomorphisms $\iota^k_{a,b}$. As mentioned above, persistent homology tracks topological changes through the filtration, and this leads to the following notions for homology classes. We say that a homology class $\gamma \in H_k(\mathcal{Q}_\ell)$ is *born* in $H_k(\mathcal{Q}_\ell)$, if $\gamma \not \in \operatorname{Im}\iota^k_{\ell-1,\ell}$. The homology class $\gamma$ *dies* entering $H_k(\mathcal{Q}_m)$, if either it became trivial, or if it merges with an older class in $\mathcal{Q}_m$. In this context, a class is called *older*, if it was born earlier than the homology class $\gamma$. The index values $\ell$ and $m$ are called the *birth time* and *death time* of the homology class $\gamma$, respectively. We refer the reader to @herbert for more details. ![Sample persistence diagrams in dimension zero for piecewise constant approximations of the non-differentiable function $f(x) = |\sin(6 \pi x)| / (1 + x^2) + 3 \cos(2 \pi x) / 10$. The function $f$, together with its approximation $\Box f$ for ${\varepsilon}= 0.18$, is shown in the upper left image, while the upper right image contains the persistence diagram for $\Box f$. The two lower panels show the persistence diagrams for $\Box f$ if we use instead ${\varepsilon}= 0.06$ (left) or ${\varepsilon}= 0.02$ (right).<span data-label="fig:cornerex"></span>](cornerex1a.pdf){height="6cm"} ![Sample persistence diagrams in dimension zero for piecewise constant approximations of the non-differentiable function $f(x) = |\sin(6 \pi x)| / (1 + x^2) + 3 \cos(2 \pi x) / 10$. The function $f$, together with its approximation $\Box f$ for ${\varepsilon}= 0.18$, is shown in the upper left image, while the upper right image contains the persistence diagram for $\Box f$. The two lower panels show the persistence diagrams for $\Box f$ if we use instead ${\varepsilon}= 0.06$ (left) or ${\varepsilon}= 0.02$ (right).<span data-label="fig:cornerex"></span>](cornerex1b.pdf "fig:"){height="6cm"}\ ![Sample persistence diagrams in dimension zero for piecewise constant approximations of the non-differentiable function $f(x) = |\sin(6 \pi x)| / (1 + x^2) + 3 \cos(2 \pi x) / 10$. The function $f$, together with its approximation $\Box f$ for ${\varepsilon}= 0.18$, is shown in the upper left image, while the upper right image contains the persistence diagram for $\Box f$. The two lower panels show the persistence diagrams for $\Box f$ if we use instead ${\varepsilon}= 0.06$ (left) or ${\varepsilon}= 0.02$ (right).<span data-label="fig:cornerex"></span>](cornerex1c.pdf "fig:"){height="6cm"} ![Sample persistence diagrams in dimension zero for piecewise constant approximations of the non-differentiable function $f(x) = |\sin(6 \pi x)| / (1 + x^2) + 3 \cos(2 \pi x) / 10$. The function $f$, together with its approximation $\Box f$ for ${\varepsilon}= 0.18$, is shown in the upper left image, while the upper right image contains the persistence diagram for $\Box f$. The two lower panels show the persistence diagrams for $\Box f$ if we use instead ${\varepsilon}= 0.06$ (left) or ${\varepsilon}= 0.02$ (right).<span data-label="fig:cornerex"></span>](cornerex1d.pdf){height="6cm"} The collection of all persistent homology groups is usually referred to as the *persistence module*. Despite its abstract nature, it can be completely encoded via the notions of birth and death of homology classes. For every homology class $\gamma$, we record its birth time and its death time as an ordered pair, where the death time is set to $\infty$ if the class $\gamma$ is nontrivial in $\mathcal{Q}_n$. In this way, a multiset of pairs of numbers $\{(a_i,b_i)\}_{i \in I}$ is created, where $-\infty < a_i \leq b_i \le \infty$. This multiset of points can naturally be drawn in the first quadrant of the Euclidean plane, and in fact it lies above the line $b = a$. Such a representation of the persistence module is called a *persistence diagram*. If the persistence module is for a filtered rectangular CW-complex $X = |\mathcal{Q}|$ given by $(\mathcal{Q},f)$, then we denote the persistence diagram by $D(f,X)$, or shorter by $D(f)$ if the underlying space $X$ is clear from context. Examples of persistence diagrams can be found in the Figure \[fig:cornerex\]. In the top left image, a continuous function $f$ is shown together with its piecewise constant approximation $\Box f$. Now let $\mathcal{Q}^{(0)}$ denote the endpoints of the interval $[0,1]$, together with the collection of all points of discontinuities of $\Box f$. If we denote the points in the set $\mathcal{Q}^{(0)}$ by $0 = x_0 < \ldots < x_N = 1$ and let $\mathcal{Q}^{(1)} = \{ [x_{k-1}, x_k] : k = 1,\ldots,N \}$, then $\mathcal{Q} = \mathcal{Q}^{(0)} \cup \mathcal{Q}^{(1)}$ is a rectangular structure, which renders the interval $X = [0,1]$ a filtered rectangular CW-complex given by $(\mathcal{Q},\Box f)$. The associated persistence diagram is shown in the upper right panel. The two panels below show persistence diagrams for two more approximations of $f$, which will be discussed more later. Stability of Persistent Homology {#sec:PersistentHomology3} -------------------------------- One of the prominent features of persistent homology is the fact that the collection of persistence diagrams can be turned into a metric space in various ways, and we will present two of those below. In order to set the stage, we have to slightly modify the notion of persistence diagram. So far, a persistence diagram is a finite multiset of points $(a,b)$ with $a < b$, which represent birth/death-time pairs for homology generators. For reasons that will become clearer momentarily, we now add infinitely many of copies of all points $(a,a)$ for $a \in \mathbb{R}$ to every persistence diagram, i.e., in addition to the birth/death pairs every persistence diagram contains infinitely many copies of the diagonal $b = a$. This modification ensures that any two persistence diagrams $A$ and $B$ have the same infinite cardinality, and there always are bijections $\eta : A \rightarrow B$. Notice that without the addition of the diagonal, such bijections would generally not exist. Now we can define the two central notions of distance between $A$ and $B$. - The *bottleneck* distance between two persistence diagrams $A$ and $B$ is defined as $$W_{\infty}(A,B) = \inf\left\{ \sup_{p \in A} {\ensuremath{\left\|p-\eta(p)\right\|}}_{\infty} \; : \; \eta : A \rightarrow B \mbox{ is a bijection } \right\} \; .$$ - The *degree-$q$ Wasserstein distance* between two persistence diagrams $A$ and $B$ is defined as $$W_q(A,B) = \inf \left\{ \left( \sum_{p \in A} {\ensuremath{\left\|p-\eta(p)\right\|}}_{\infty}^q \right)^{1/q} \; : \; \eta : A \rightarrow B \mbox{ is a bijection } \right\} \; .$$ ![Sample persistence diagram matching. The left two images show persistence diagrams with seven and four birth/death pairs, respectively. The third diagram shows a sample transport plan $\eta$ between the two persistence diagrams.<span data-label="fig:bottelneckDistance"></span>](bottelneckDistance1.pdf){width="4cm"} ![Sample persistence diagram matching. The left two images show persistence diagrams with seven and four birth/death pairs, respectively. The third diagram shows a sample transport plan $\eta$ between the two persistence diagrams.<span data-label="fig:bottelneckDistance"></span>](bottelneckDistance2.pdf){width="4cm"} ![Sample persistence diagram matching. The left two images show persistence diagrams with seven and four birth/death pairs, respectively. The third diagram shows a sample transport plan $\eta$ between the two persistence diagrams.<span data-label="fig:bottelneckDistance"></span>](bottelneckDistance3.pdf){width="4cm"} In other words, both distances try to identify a *transport plan* $\eta : A \rightarrow B$ which transforms the persistence diagram $A$ into the persistence diagram $B$, with in some sense minimal movement of the points in the diagrams. While the bottleneck distance only considers the largest displacement, the Wasserstein distance takes an average over all displacements. See also Figure \[fig:bottelneckDistance\]. Now that we are able to measure changes in persistence diagrams, one can try to assess how changes in a filtration function $f$ affect the associated persistence diagrams. In fact, it is possible to establish a wide-ranging stability property for persistent homology in this context, which is one of the central reasons for its usefulness in the applied sciences. Consider a function $f : X \rightarrow \mathbb{R}$ which is defined on a triangulable topological space $X$. One can define persistent homology for the infinite filtration created by sublevel sets of $f$, as long as the function $f$ satisfies an additional property. To describe this in slightly more detail, let $X_a = f^{-1}(-\infty,a]$ for all $a \in \mathbb{R}$. Then we clearly have the inclusion $X_a \subset X_b$ whenever $a \le b$. As before, one would like to define the persistent homology groups as images of the maps on homology induced by the inclusions $X_a \hookrightarrow X_b$. Since we are faced with a filtration with infinite index set, certain finiteness assumptions have to be made. For this, one calls a number $a \in \mathbb{R}$ a *homological critical value*, if there is no value ${\varepsilon}> 0$ such that the inclusion $X_{a-{\varepsilon}} \hookrightarrow X_{a+{\varepsilon}}$ induces only isomorphisms on the homology level. In other words, at a homological critical value the homology groups change. We then call the function $f$ *tame*, if it only has finitely many homological critical values, and if all homology groups of all sublevel sets $X_a$ have finite rank. For tame functions, it is possible to define persistence diagrams similar to the procedure described above, see for example @herbert [pp. 182f]. Moreover, the following stability result was established by Cohen-Steiner, Edelsbrunner, and Harer @cohensteiner:etal:07a. \[th:stabilityTheoremOrig\] Let $X$ be a triangulable space, and let $f,g : X \rightarrow \mathbb{R}$ denote two continuous tame functions. Then the persistence diagrams $D(f)$ and $D(g)$ of $f$ and $g$, respectively, satisfy $$W_{\infty}(D(f),D(g)) \leq {\ensuremath{\left\|f-g\right\|}}_{\infty} \; .$$ While the above theorem was a milestone for the applicability of persistent homology, it did suffer from a serious drawback. In its original formulation, the functions $f$ and $g$ have to be at least continuous. This of course would preclude our idea of approximating a continuous functions via a piecewise constant one. Fortunately, this continuity restriction has been removed in the work by Chazal et al. @chazal:etal:09a [@chazal:etal:12a], which is based on interleavings of persistence modules. As a consequence, we have the following result. \[th:stabilityTheorem\] Let $X$ be a rectangular CW-complex, and let $f,g : X \rightarrow \mathbb{R}$ denote two functions, each of which is either continuous and tame, or piecewise constant on the rectangles of the rectangular structure associated with $X$ and lower semi-continuous. Then the persistence diagrams $D(f)$ and $D(g)$ of $f$ and $g$, respectively, satisfy $$W_{\infty}(D(f),D(g)) \leq {\ensuremath{\left\|f-g\right\|}}_{\infty} \; .$$ In other words, small perturbations in the function $f$ only lead to small perturbations of the persistence diagram $D(f)$ with respect to the bottleneck distance. One of the crucial properties of persistent homology is its inherent computability and a number of software packages have been developed for this, for example <span>dionysus</span> @dionysus, <span>PHAT</span> @phat, <span>Perseus</span> @perseus and <span>Gudhi</span> @gudhi. While two of these are based on standard matrix reductions @phat [@dionysus], one is based on discrete Morse theory @perseus, see also @MichMorse. All of the packages are designed to compute the persistence of a finite cell complex and are therefore not capable of solving the problem of computing persistence of a continuous function of a compact set to within a pre-specified error bound. This gap in the literature is filled by the present paper. Persistent homology can also be defined for vector-valued filtering functions $f : X \rightarrow \mathbb{R}^n$, where $X$ is a rectangular CW-complex or a triangulable space, and this leads to the concept of *multi-dimensional persistence*. However, for multi-dimensional persistence one can show that there is no finite and complete invariant @gunnar which is similar to the persistence intervals in the one-dimensional case $f : X \rightarrow \mathbb{R}$. Needless to say, this implies that there is no hope for an algorithm which computes multi-dimensional persistence. To address this issue, a number of research groups have tried to find some descriptors of multi-dimensional persistence, which — though incomplete – can still prove to be useful in practice and which are computable. It seems likely that in order to compute such invariants it is necessary to construct a finite cell complex. In fact, our algorithms presented below will work for any continuous vector-valued function which is defined on a rectangular domain, and they produce a piecewise constant lower semi-continuous approximation of the function. Given such an approximation, one can use various stability results for multi-dimensional persistence to show that the multi-dimensional persistence information of the approximation is close to the multi-dimensional persistence of the given continuous function. To close this section, we present one such stability result for multi-dimensional persistence which is taken from the paper @stabilityPersistentBettiNumbers. Their construction is based on finding a matching distance between rank invariants of multi-dimensional persistent homology. For this, the following concepts are introduced in @stabilityPersistentBettiNumbers. Let $u, v \in \mathbb{R}^n$ be given, and write $u = (u_1,\ldots,u_n)$ and $v = (v_1,\ldots,v_n)$. We say that $u \preceq v$ if for every $i \in \{1,\ldots,n\}$ we have $u_i \leq v_i$. Define the set $\delta^{+} = \{ (u,v) \in \mathbb{R}^n \times \mathbb{R}^n \; : \; u \preceq v \}$, and consider the usual maximum norm $\| \cdot \|_\infty$ on $\mathbb{R}^n$. For a fixed triangulable space $X$ and a function $f : X \rightarrow \mathbb{R}^n$, define the sublevel set $X(f,u) = \{ x \in X \; : \; f(x) \preceq u \}$. Now consider two vectors $u \preceq v$, and let $\pi_k^{u,v} : H_k(X(f,u)) \rightarrow H_k(X(f,v))$ denote the homomorphism induced by inclusion. Then the image of $\pi_k^{u,v}$ is called the *multi-dimensional $k$-th persistent homology group* of $(X,f)$ at $(u,v)$, where the authors of @stabilityPersistentBettiNumbers use *Čech homology* over a field, see @massey for more details. Additionally, the *$k$-th rank invariant* of a pair $(X,f)$ over a fixed coefficient field $K$ is defined as the function $\rho(X,f,k) : \delta^{+} \rightarrow \mathbb{N} \cup \{ \infty \}$ given by $\rho(X,f,k)(u,v) = {\rm rank} \, \pi_k^{(u,v)}$. For the so-defined rank invariant, the following stability theorem was established in @stabilityPersistentBettiNumbers [Theorem 4.4]. \[th:foliationPaper\] Let $X$ be a triangulable space, let $f,g : X \rightarrow \mathbb{R}^n$ be continuous, and let $k \in \mathbb{Z}$ be arbitrary. Then there exists a distance function $D_{match}$ on the collection of all possible rank invariant functions such that $$D_{match}\left( \rho(X,f,k), \rho(X,g,k) \right) \; \le \; \max_{x \in X}\|f(x)-g(x)\|_{\infty} \; .$$ As before, Theorem \[th:foliationPaper\] provides a bound on the change of the rank invariant of multi-dimensional persistent homology in terms of the change of the underlying function $f$ measured in the maximum norm. We would like to point out that the above results is just one example of a number of similar results. In the same paper @stabilityPersistentBettiNumbers, the authors derive a similar stability result for *persistent Betti numbers*, and in @hausdofrrStability the case of *multi-dimensional persistence spaces* was considered. In all of these examples, the right-hand side of the estimate is of the form presented in Theorem \[th:foliationPaper\]. It is therefore clear that bottleneck-type stability can be observed in multi-dimensional persistence, and the discretization process presented below may be useful for computations of some of the above invariants. Verified Cubical Approximation of Continuous Functions {#sec:cubapprox} ====================================================== In this section, we present the main algorithms for approximating continuous functions by piecewise constant lower semi-continuous functions. Our approach makes use of rigorous computations via interval arithmetic, and will allow for the approximation of the persistent homology of a function with rigorous error bounds. Rigorous Numerics and Interval Arithmetic {#sec:intervalArithmetic} ----------------------------------------- We begin by collecting a few definitions and results from interval arithmetic, which are necessary for our approach. In what follows, we will use interval arithmetic to obtain rigorous mathematical statements about approximations of continuous functions. We would like to point out, however, that alternative rigorous computer arithmetic methods could be used just as well, see for example @affineArithmetic [@generalizedIntervalArithmetic]. For a comprehensive introduction to interval arithmetic we refer the reader to @moore. Throughout this paper our computations work with a fixed set $\mathcal{R}$ of real numbers which are representable in a computer, called the *representable numbers* $\mathcal{R}$. In order to account for rounding errors, rather than working with numbers we make use of intervals. This leads to the concept of *interval arithmetic*, which represents every real number in $\mathbb{R}$ as an interval with endpoints in $\mathcal{R}$. More precisely, if $x \in \mathbb{R}$ is a representable number, it is represented by the degenerate interval $[x,x]$, while any number $x \in \mathbb{R} \setminus \mathcal{R}$ is represented as $[\underline{x}, \overline{x}]$ with $\underline{x}$ being the largest representable number which is smaller than $x$, and similarly for $\overline{x}$. In order to work with functions, one has to define arithmetic operations on intervals. This has to be done in such a way that any potential rounding errors are taken into account. To describe this in more detail, let $\mathcal{I}(\mathcal{R})$ denote the set of all intervals with both endpoints in the set of representable numbers. Given two intervals $a, b \in \mathcal{I}(\mathcal{R})$ with $a = [a_1,a_2]$ and $b = [b_1,b_2]$, and denoting any of the four basic arithmetic operations by $\diamond$, the analogous interval operation $a \diamond b$ has to be defined in such a way that $$\left\{ x \diamond y \; : \; x,y \in \mathbb{R} \text{ and } x \in a, \; y \in b \right\} \; \subset \; a \diamond b \; \in \; \mathcal{I}(\mathcal{R}) \; .$$ In practice, this is achieved in computer implementations of interval arithmetic by outward rounding to the next representable numbers. In this way, the resulting interval $a \diamond b$ always contains all possible outcomes of the actual operation. In addition to the four basic arithmetic operations, implementations of interval arithmetic also have to provide interval versions of the standard elementary functions. This is usually accomplished via Taylor series expansions, where the resulting interval answer will also include any potential truncation errors. For a more comprehensive treatment of these issues we refer the read to @neumaier. Common to all practical computer implementations of interval arithmetic is that they provide a collection of predefined continuous functions, which usually at least contains functions in $\Phi = \{ {\rm abs}, \; {\rm sqrt}, \; {\rm sqr}, \; {\rm exp}, \; {\rm ln}, \; {\rm sin}, \; {\rm cos}, \; {\rm arctan} \}$. For bounds on the complexity of our algorithms, we need to assume later on that the functions of interest are at least Lipschitz continuous. Recall that a function $f : D \subset \mathbb{R}^n \rightarrow \mathbb{R}^m$ is called *Lipschitz continuous* on the domain $D_0 \subset D$ if there exists a constant $L \ge 0$ such that $$\|f(x_1) - f(x_2)\|_{\infty} \leq L \|x_1 - x_2\|_{\infty} \quad\mbox{ for all }\quad x_1,x_2 \in D_0 \; .$$ Clearly, every elementary function from the set $\Phi$ is Lipschitz continuous, at least on compact rectangles over which the function is differentiable. In fact, the same statement is true for any *arithmetical expression* which is formed using functions from $\Phi$, the four basic arithmetic operations, and composition of functions. For a more formal definition, see @neumaier [Section 1.4]. Despite the fact that arithmetical expressions usually lead to Lipschitz continuous functions, this does not immediately carry over to our machine computations. In order for our results below to hold, we need to make sure that if $f$ is a Lipschitz continuous function, then its actual interval implementation $\hat{f}$ as a function from a subset of $\mathcal{R}^n$ into $\mathcal{R}^m$ is Lipschitz continuous as well. This is the subject of the following result from @neumaier [Theorem 2.1.1]. \[Arithmetical Expressions Inherit Lipschitz Continuity\] \[th:neumaier\] Let $f$ denote an arithmetical expression in $n$ variables, which takes $m$-dimensional values, i.e., suppose $f : D \subset \mathbb{R}^n \rightarrow \mathbb{R}^m$, and suppose that $f$ is Lipschitz continuous on $D_0 \subset D$ with constant $L$. Furthermore, let $\hat{f}$ denote its interval implementation as described above, and let $\mathcal{D}_0$ denote the interval vectors in $\mathcal{I}(\mathcal{R})^n$ which represent the points in $D_0$. Then $\hat{f}$ is Lipschitz continuous on $\mathcal{D}_0$. More precisely, we have $$\left\| \hat{f}(x_1) - \hat{f}(x_2) \right\|_{\infty} \leq \alpha(L) \left\| x_1 - x_2 \right\|_{\infty} \quad\mbox{ for all }\quad x_1, x_2 \in \mathcal{D}_0 \; ,$$ where the constant $\alpha(L)$ depends on the arithmetical expression for $f$, and can be computed explicitly using @neumaier [Table 2.1]. The above Theorem \[th:neumaier\] implies that interval evaluations of a Lipschitz continuous function determine again a Lipschitz continuous function. Of course, one would expect that the Lipschitz constants of the new function $\hat{f}$ would increase in size, as the implementation deals with intervals. But as shown in @neumaier [Table 2.1], this effect is minor. Piecewise Constant Approximations {#sec:approximationContFunctions} --------------------------------- In this section we show how a continuous function $f : R \rightarrow \mathbb{R}^m$, where $R \subset \mathbb{R}^n$ is a rectangular domain, can be approximated by a piecewise constant function. The approximation will be constructed as a collection of compact rectangles whose union is $R$, where each of the rectangles in the decomposition is carrying the following information: - Each rectangle is described by an $n$-vector of pairs of representable numbers $\{(b_i,e_i)\}_{i=1}^{n}$ which satisfy the inequalities $b_i \leq e_i$, and which are the projections of the rectangle onto the coordinate axes $x_1,\ldots,x_n$. - Each rectangle has an associated *value*, which is an $m$-dimensional vector of representable numbers. For a rectangle $Q$ in the final decomposition of $R$, its value is denoted by $val(R)$. The algorithm which leads to the desired decomposition of $R$ is motivated by the classical simplicial approximation theorem. In its original form, this theorem states that every continuous function between triangulable spaces can be approximated by a simplicial map. In order to obtain this simplicial map, one has to subdivide the simplices, possibly many times. As far as we are aware, there is no criterion that allows to check if the approximation of a desired accuracy have been achieved. Saying so, the simplicial approximation theorem is non constructive. The constructive algorithm presented below uses a similar idea. By employing rigorous arithmetic, for example interval arithmetic as discussed in the previous section, we can ensure that the final subdivision of the rectangular domain $R$ is such that the value $val(Q)$ of every rectangle $Q$ in the final subdivision of $R$ satisfies the estimate $$\left\| f(x) - val(Q) \right\|_\infty \; \leq \; {\varepsilon}\quad\mbox{ for all }\quad x \in Q \; .$$ To achieve this property, we repeatedly subdivide $R$ until the above estimate holds for every rectangle in the subdivision. \[tb\] Compact rectangle $R \subset \mathbb{R}^n$, continuous function $f : R \rightarrow \mathbb{R}^m$, error bound ${\varepsilon}> 0$. Rectangular partition of $R$ which gives an ${\varepsilon}$-approximation of $f$ on $R$. Queue $\mathcal{Q}$; $\mathcal{Q} \leftarrow R$; Rectangle $Q \leftarrow pop(\mathcal{Q})$; $v = midpt(\hat{f}(Q))$; $val(Q) = v$; Subdivide $Q$ in all directions. Put all resulting rectangles in $\mathcal{Q}$; To describe the algorithm in more detail, we need to introduce some notation. Consider a rectangle $R \subset \mathbb{R}^n$. Then we say that the rectangles $R_1,\ldots,R_k$ form a *partition* of the rectangle $R$ if we have $R = R_1 \cup \ldots \cup R_k$, and if for arbitrary $i,j \in \{1,\ldots,k\}$ the $n$-dimensional measure of the intersection $R_i \cap R_j$ is zero. The intersection $R_i \cap R_j$ can either be empty, or a rectangle of dimension smaller than $n$. A partition $R_1,\ldots,R_k$ is an *${\varepsilon}$-approximation of a function $f : R \subset \mathbb{R}^n \rightarrow \mathbb{R}^m$*, if we have $$\left\| f(x) - val(R_i) \right\|_\infty \; \leq \; {\varepsilon}\quad\mbox{ for all }\quad x \in R_i \quad\mbox{ and }\quad i = 1,\ldots,k \; .$$ With each ${\varepsilon}$-approximation of $f$, we can associate a lower semi-continuous function $\Box f$ which is defined via $\Box f(x) = val(R_i)$ for all $x$ in the interior of $R_i$, and for any point $x$ which lies in the boundary of at least one of the partition rectangles we define $\Box f(x) = \min\{ val(R_{i_1}), \ldots, val(R_{i_\ell}) \}$, where $x$ is contained in the rectangles $R_{i_1}, \ldots, R_{i_\ell}$. Finally, for a rectangle $R = [a_1,b_1] \times \ldots \times [a_n,b_n]$ its *midpoint* is given by $midpt(R) = ((a_1+b_1)/2, \ldots, (a_n+b_n)/2)$, and its geometric realization, i.e., the set of points belonging to the rectangle, is denoted by $|R|$. In terms of the given function $f$, we assume that it is of a form suitable for evaluation over rectangles using the rigorous computer arithmetic. With these definitions, the algorithm for determining a piecewise constant approximation of a continuous function is given by Algorithm \[alg:partiallyConstantApproximationOfAFunction\]. In the algorithm, the rigorous arithmetic implementation of $f$ is denoted by $\hat{f}$. The properties of rigorous computer arithmetic discussed in the previous section readily imply that if Algorithm \[alg:partiallyConstantApproximationOfAFunction\] terminates, then the constructed partition is an ${\varepsilon}$-approximation of $f$. Of course, there are instances where the algorithm does not terminate. To see this, suppose we are computing on a machine whose smallest strictly positive representable number is $\rho_{\min} > 0$. Choose $\delta > 0$ such that $$\label{deltachoice} \delta \left( \rho_{\min} + \delta \right) < \frac{\rho_{\min}}{2 \pi} \; ,$$ and consider the function $f : R \to \mathbb{R}$ defined via $$\label{terminateex} f(x) = \sin\frac{1}{x + \delta} \qquad\mbox{ for all }\qquad x \in R = [0,1] \; .$$ Any partition of $[0,1]$ into compact intervals whose endpoints are representable numbers has to contain an interval $[0,a]$ with $\rho_{\min} \le a \le 1$. One can easily see that (\[deltachoice\]) is equivalent to $$\frac{1}{0 + \delta} - \frac{1}{a + \delta} \; \ge \; \frac{1}{0 + \delta} - \frac{1}{\rho_{\min} + \delta} \; > \; 2 \pi \; ,$$ and therefore the range of $f$ over the interval $[0,a]$ is the interval $[-1,1]$. This immediately implies that any evaluation using rigorous computer arithmetic yields $\hat{f}([0,a]) \supset [-1,1]$, and the algorithm cannot terminate if we set ${\varepsilon}< 1$. The above example illustrates that even for simple analytic real-valued functions on a compact one-dimensional domain the presented algorithm may not terminate. Therefore, in order to avoid infinite loops one has to set a maximal number of subdivisions that the algorithm is allowed to perform. If this number is exceeded, the algorithm terminate with the answer "*cannot decide*," i.e., the algorithm is a *partial algorithm*. For clarity of presentation, this simple modification is not part of the pseudo-code of Algorithm \[alg:partiallyConstantApproximationOfAFunction\]. Nevertheless, on a purely theoretical level, the algorithm has the potential to terminate for every continuous function $f : R \to \mathbb{R}^m$ defined on a compact rectangle $R \subset \mathbb{R}^n$. This is a direct consequence of the resulting uniform continuity of $f$ on $R$. In fact, if we assume more regularity of $f$, and that the computer implementation has infinite precision, then it is even possible to give an upper bound on the number of rectangles in an ${\varepsilon}$-approximation of $f$. This is the subject of the following result. \[Algorithm Complexity for Lipschitz Functions\] \[thm:complexity\] Let $R \subset \mathbb{R}^n$ denote a compact rectangle, and assume that the function $f : R \rightarrow \mathbb{R}^m$ is Lipschitz continuous with Lipschitz constant $L$. Suppose further that Algorithm \[alg:partiallyConstantApproximationOfAFunction\] was successfully executed for an arithmetical expression of $f$, for the algorithm parameter ${\varepsilon}> 0$, and that the algorithm was run on a computer with infinite precision. Then the algorithm creates a subdivision of the rectangle $R$ with $$\mbox{at most }\quad \left( \frac{\alpha(L) diam(R)}{2{\varepsilon}} \right)^n \quad\mbox{ rectangles,}$$ where the constant $\alpha(L)$ is taken from Theorem \[th:neumaier\], and $diam(R)$ denotes the diameter of $R$ with respect to the maximum norm. In infinite precision, the <span>if</span>-condition in Algorithm \[alg:partiallyConstantApproximationOfAFunction\] is satisfied as soon as we have $$max(\hat{f}(R)) - min(\hat{f}(R)) \; \le \; 2 {\varepsilon}\; ,$$ where $\hat{f}$ denotes the interval implementation of $f$. In other words, the algorithm terminates on a rectangle $A \subset R$, as soon as the evaluation of $\hat{f}$ has diameter at most $2{\varepsilon}$. Moreover, Theorem \[th:neumaier\] implies that the interval representation has the Lipschitz constant $\alpha(L)$. Thus, for $diam(A) \leq \frac{2{\varepsilon}}{\alpha(L)}$ the rigorous evaluation of $f$ on $A$ has diameter smaller at most $2{\varepsilon}$. In the worst case, this means that the rectangle $R$ has to be subdivided $(\alpha(L) diam(R)) / (2{\varepsilon})$ times in each coordinate direction, and this will lead to at most $((\alpha(L) diam(R)) / (2{\varepsilon}))^n$ rectangles in the final subdivision. The above result was formulated for infinite precision in order to exclude examples such as (\[terminateex\]). In actual computer implementations, the number of rectangles in the final subdivision of the rectangle is usually very close to the bound in the theorem, but it might be slightly larger. This indicates that the techniques which will be presented below can be expected to
{'source': 'arXiv_out/1610'}