On the unconventional Hug integrator Christophe Andrieu, J.M. Sanz-Serna Abstract Hug is a recently proposed iterative mapping used to design efficient updates in Markov chain Monte Carlo (MCMC) methods. Hug generates proposals that remain very close to hypersurfaces (level sets) of constant probabilty density. We analyse a generalization of Hug from hypersurfaces to manifolds of arbitrary dimensions, not necessarily arising in a sampling context. The analysis is based on interpreting, in a nonstandard way, Hug as a consistent discretization of a system of differential equations with a rather complicated structure. The proof of convergence of this discretization includes a number of unusual features we explore fully, in particular a supraconvergence property is established, whereby second order of convergence is attained with consistency of the first order. We uncover and discuss an unexpected property of the solutions of the underlying dynamical system that manifest itself by the existence of Hug trajectories that fail to cover the manifold of interest. 1 Introduction Hug and Hop are the building blocks of a Markov chain Monte Carlo (MCMC) method suggested in [ 13 ] to sample from complex probability distributions [ 6 ] . The method may be viewed as an alternative to the well-known HMC (Hybrid/Hamiltonian Monte Carlo) algorithm [ 4 ] ; as HMC, it turns local information about the target density of interest, available in the form of gradients, into an efficient mapping adapted to the geometry of the problem at hand. The algorithm in [ 13 ] has the attractive feature that an update involves moving along contours of the probability density of interest itself, which should be contrasted with the corresponding, sometimes unintuitive, HMC trajectories arising from solutions of Hamilton’s equations. The Hug update of [ 13 ] is based on the repeated composition of a “bounce” mapping (proposed by [ 15 ] but also appearing in [ 14 ] and exploited in [ 3 ] , [ 19 , 18 ] and [ 16 , 17 ] ) in both the continuous and discrete time Markov chain contexts). The bouncing mechanism makes it possible for the proposals generated by Hug to remain very close to (hug) a manifold of interest, which is remarkable since the algorithm is fully explicit, i.e. it does not require solving the algebraic equations defining the manifold, in contrast with exact methods e.g. [ 20 ] . This combination of favourable properties makes Hug potentially relevant to problems beyond sampling and calls for a better understanding of its properties. The aim of this paper is to provide a theoretical analysis of Hug. We clarify from the outset that comparing the practical performance of Hug with alternative techniques, both in sampling and nonsampling contexts, is beyond the scope of our study. Rather our aim is to develop tools that may be useful to understand the properties of algorithms based on Hug. More specifically we establish that Hug may be viewed as a consistent discretization of an underpinning dynamical system, which we identify. In the HMC algorithm context, where the Leapfrog integrator arises from Hamilton’s equations, consistency of the discretisation plays an essential role in developing the scaling limits arguments that have led to the practical implementational rules on how to optimally tune the parameters of the algorithm [ 1 ] . The contents and contributions of this manuscript are as follows. Section 2 focuses on discrete-time algorithms. In Subsection 2.1 we present the Hug update in its original MCMC context where the aim is to maintain a single constraint while updating the state of the Markov chain. In Subsection 2.2 we present a generalisation of Hug’s discrete dynamics [ 5 ] suitable for the exploration of manifolds resulting from multiple constraints; the need to define dynamical systems that remain on a manifold arises in contexts beyond the sampling context (see Example 1 ) [ 12 , Chapter 7] . A number of properties of the algorithm are presented in Subsection 2.3 . In Section 3 we identify the (rather unusual) underpinning continuous-time dynamical system and explain the nonstandard way in which Hug provides a convergent discretization of that system. In Subsection 3.1 we review results on linear projector differentials. Then, in Subsection 3.2 we present the continuous-time dynamical system and establish a number of properties that mirror those of the discrete time algorithm studied previously in Subsection 2.3 . The convergence of Hug as a discretization of the continuous-time dynamical system is elucidated in Subsection 3.3 . The analysis presents a number of nonstandard features; of particular interest from the numerical analysis point of view is that a supraconvergence phenomenon [ 7 ] takes place, whereby second-order convergence is obtained with first order consistency. In Subsection 3.4 we fully analyse a model system, showing that, unexpectedly, the trajectories generated by both the differential equations and Hug may fold back on themselves, thus precluding, in some conditions, good exploration of the manifold of interest. This unwelcome phenomenon depends on the initial condition and we obtain a full characterisation of the initial states for which the phenomenon occurs. In Section 4 we present simple numerical experiments suggesting that the phenomenon analysed in the model problem persists in more complex scenarios. We also comment briefly on how to suppress or mitigate the folding-back phenomenon. Technical proofs are given in Section 5 ; these make extensive use of the results by Golub and Pereyra [ 8 ] on differentiation of projections. 2 Hug algorithm 2.1 The algorithm In this subsection we describe the Hug algorithm suggested in [ 13 ] . In the description we will make use of some properties that will be proved in Proposition 1 below. Hug is a Markov Chain Monte Carlo method to obtain samples from a target unnormalized probability distribution \pi in \mathbb{R}^{n} , n>1 , assumed to have a density \exp(\ell(x)) with respect to the Lebesgue measure. Hug introduces an auxiliary variable v\in\mathbb{R}^{n} with a density q(v|x) such that q(v|x)=q(-v|x) (1) and generates a Markov Chain with invariant distribution \pi(x)q(v|x) . The marginal on x of this Markov chain has therefore \pi(x) as an invariant distribution; one step of this marginal chain is described in Algorithm 1 . A salient feature of the algorithm is the use of velocity reflections. For x\in\mathbb{R}^{n} with \nabla\ell(x)\neq 0 , the n\times n matrix R(x) used in the reflections is R(x)=I-\frac{2}{\|\nabla\ell(x)\|^{2}}\nabla\ell(x)\nabla\ell(x)^{\top}, (2) so that, if w is a vector, R(x)w is the result of reflecting w on the vector subspace of \mathbb{R}^{n} tangent at x to the level hypersurface \{y:\ell(y)=\ell(x)\} . Here and elsewhere \|\cdot\| denotes the standard Euclidean norm. Figure 1 illustrates the computation of the iterate x_{2} when \delta=0.1 , x_{0}=[1,0]^{\top} , v_{0}=[1,2]^{\top} and the target is a bivariate Gaussian distribution with \ell=-x_{(1)}^{2}-4x_{(2)}^{2} ( x_{(1)} and x_{(2)} denote the scalar components of x ). The figure suggests that the iterates x_{k} may be expected to be close to (or “hug”) the level set \{y:\ell(y)=\ell(x_{0})\} ; this explains the name of the algorithm. The halfway points x_{k+1/2} will not be too close to \{y:\ell(y)=\ell(x_{0})\} , but this does not matter as they are just intermediate auxiliary values (like the internal stages of a Runge-Kutta integrator). Algorithm 1 Hug Number of timesteps K ; stepsize \delta>0 ; current state x of the Markov chain; v -marginal density q(\cdot|x) . Initialize k=0 , x_{0}\leftarrow x , draw velocity v_{0}\sim q(\cdot|,x_{0}) . Timestepping: for k=0,\dots,K-1, do Move to x_{k+1/2}=x_{k}+(\delta/2)v_{k} . Reflect: v_{k+1}=R(x_{k+1/2})v_{k} . Move to x_{k+1}=x_{k+1/2}+(\delta/2)v_{k+1} . end for Compute \log(r)=\ell(x_{K})-\ell(x_{0})+\log q(v_{K}|x_{K})-\log q(v_{0}|x_{0}) . With a probability \alpha=1\wedge r , x\leftarrow x_{K} ; else x\leftarrow x . The typical choice of q(v|x) satisfying ( 1 ) is given by an x -independent isotropic normal v\sim{\mathcal{N}}(0,\sigma^{2}I) . Since the reflection matrix ( 2 ) is orthogonal, all iterates v_{0} , …, v_{K} share a common Euclidean length, and therefore, for this simple choice of q , in the expression for the acceptance probability r the term \log q(v_{K}|x_{K})-\log q(v_{0}|x_{0})=-\sigma^{-2}\big(\|v_{K}\|^{2}-\|v_{0}\|^{2}\big) vanishes. Furthermore, due to the “hugging” property, \ell(x_{K})-\ell(x_{0}) will typically be small so that the value of the acceptance probability r will be close to 1 . At the same time, it could be expected that, once \delta has been chosen, by taking the number K of timesteps sufficiently high, x_{K} will be far away from x_{0} . In conclusion, Hug may offer the possibility of generating proposals that are away from the current state of the chain and, at the same time, have high probability of being accepted. The x -moves in Hug will not change much the value of \ell and in order to efficiently explore the whole state space, the reference [ 13 ] suggested to interleave steps of Hug with steps of a second Markov kernel, called Hop, that causes the state of the Markov chain to jump between different level sets of \ell . Figure 1: Computation of the iterate x_{2} for a bivariate Gaussian. The plot depicts the plane of the variable x=(x_{(1)},x_{(2)})\in\mathbb{R}^{2} . The solid curve is the contour \{y:\ell(y)=\ell(x_{0})\} . The dashed curve is (part of) the contour \{y:\ell(y)=\ell(x_{1/2})\} . The segments [x_{0},x_{1/2}] , [x_{1/2},x_{1}] , [x_{1},x_{3/2}] , [x_{3/2},x_{2}] share a common Euclidean length (\delta/2)\|v_{0}\| . 2.2 A generalization of the Hug timestepping mechanism In what remains of the paper, we will consider that in the Hug time-stepping formulas ( x_{0}\in\mathbb{R}^{n} , v_{0}\in\mathbb{R}^{n} , n\geq 2 ) \displaystyle x_{k+1/2} \displaystyle= \displaystyle x_{k}+(\delta/2)v_{k} (3) \displaystyle v_{k+1} \displaystyle= \displaystyle R(x_{k+1/2})v_{k}, (4) \displaystyle x_{k+1} \displaystyle= \displaystyle x_{k+1/2}+(\delta/2)v_{k+1}, (5) the reflection in ( 4 ) is taken with respect to the vector subspace of \mathbb{R}^{n} tangent at x_{k+1/2} to the level manifold \{y:f(y)=f(x_{k+1/2})\} of a smooth function f:\mathbb{R}^{n}\rightarrow\mathbb{R}^{m} , 01 case to a problem not related to sampling is outlined in Example 1 . We now present the expression for R(x) that replaces ( 2 ) in the generalized scenario. For each x\in\mathbb{R}^{n} , J(x) will denote the m\times n Jacobian matrix of f evaluated at x . In order not to clutter the exposition with unwelcome details, we will assume throughout that, for each x , J(x) has full rank. (However this hypothesis may easily be weakened: for instance one might demand that J(x) be full rank except at some isolated points or, more generally, that J(x) be full rank for x in an open subdomain of \mathbb{R}^{n} .) The implicit function theorem shows that, for each x , {\mathcal{M}}(f(x)) is a smooth n-m submanifold of \mathbb{R}^{n} . The vector space tangent at x to this manifold is given by {\mathcal{T}}(x)=\{v\in\mathbb{R}^{n}:J(x)v=0\}. (6) We shall denote by {\mathcal{N}}(x)\subset\mathbb{R}^{n} the corresponding normal space, i.e. the m -dimensional vector subspace of \mathbb{R}^{n} orthogonal to {\mathcal{T}}(x) . For each x , J(x)J(x)^{\top} is invertible and J(x)^{+}=J(x)^{\top}(J(x)J(x)^{\top})^{-1} (7) is the Moore-Penrose inverse of J(x) (size n\times m ). The n\times n symmetric matrix N(x)=J(x)^{+}J(x)=J(x)^{\top}(J(x)J(x)^{\top})^{-1}J(x) (8) represents the orthogonal projection of \mathbb{R}^{n} onto {\mathcal{N}}(x) as N^{2}(x)=N(x) and J(x)v=0 implies N(x)v=0 . Then we define T(x)=I-N(x) (9) the complementary projection onto {\mathcal{T}}(x) , as T^{2}(x)=T(x) and N(x)T(x)=0 . In what follows we will use repeatedly the fact that, for any given x , each vector w may be decomposed as T(x)w+N(x)w into a tangential component and a normal component. After these preparations, we see that the expression for R(x) to be used in ( 4 ) is R(x)=I-2N(x) . For given x and w , there are different ways of computing N(x)w . One that suggests itself uses the decomposition J(x)^{\top}=QR , where Q is n\times m with orthonormal columns and R is m\times m upper triangular with positive diagonal entries. The columns of Q are an orthonormal basis of {\mathcal{N}}(x) and therefore N(x)w=QQ^{\top}w . In the particular case m=1 , f=\ell , this amounts to finding the normalized gradient (1/\|\nabla\ell(x)\|)\nabla\ell(x) as in ( 2 ). 2.3 Properties of the timestepping mechanism Proposition 1 below summarizes some properties of ( 3 )–( 5 ). It requires some notation. We denote by \Psi_{\delta}:\mathbb{R}^{n}\times\mathbb{R}^{n}\rightarrow\mathbb{R}^{n}\times\mathbb{R}^{n} the map that carries out a single step of ( 3 )–( 5 ), i.e. \Psi_{\delta}(x,v)=(x^{\prime},v^{\prime}) if v^{\prime}=R(x+(\delta/2)v)v , x^{\prime}=x+(\delta/2)v+(\delta/2)v^{\prime} . The symbol H(x) will denote the second derivative of f evaluated at x ; this is the symmetric bilinear map \mathbb{R}^{n}\times\mathbb{R}^{n}\rightarrow\mathbb{R}^{m} such that f(x+w)=f(x)+J(x)w+\frac{1}{2}H(x)[w,w]+o(\|w\|^{2}),\qquad w\rightarrow 0. Concretely with f:=(f_{1},f_{2},\ldots,f_{m}) then \big[H(x)[u,w]\big]_{i}=u^{\top}\nabla^{2}f_{i}(x)w for i=1,\ldots,n where \nabla^{2}f_{i}(x) is the Hessian of f_{i} at x . For a symmetric bilinear map S:\mathbb{R}^{n}\times\mathbb{R}^{n}\rightarrow\mathbb{R}^{m} , the operator norm is defined as \|S\|=\sup\{\|S[w_{1},w_{2}]\|:\|w_{1}\|\leq 1,\|w_{2}\|\leq 1\}. With this notation in place we have: one can establish the following properties. Properties 1-5 are fairly straightforward to establish but Property 6 requires more care. Proposition 1 . The following properties hold: 1. The map \Psi_{\delta} is volume preserving. 2. The map \Psi_{\delta} is time-reversible, i.e. for each x and v , \Psi_{\delta}(x,v)=(x^{\prime},v^{\prime}) if and only if \Psi_{\delta}(x^{\prime},-v^{\prime})=(x,-v) . Furthemore, let ( 3 )–( 5 ) hold for k=0,\dots,K-1 . Then: 3. For each k=0,\dots,K-1 , T(x_{k+1/2})v_{k+1}=T(x_{k+1/2})v_{k},\quad N(x_{k+1/2})v_{k+1}=-N(x_{k+1/2})v_{k} and v_{k}+v_{k+1}=2T(x_{k+1/2})v_{k}. 4. The vectors v_{0} ,…, v_{K} share a common Euclidean length \|v_{0}\| . 5. The vectors x_{k+1/2}-x_{k} , k=0,\dots,K-1 , and x_{k+1}-x_{k+1/2} , k=0,\dots,K-1 , share a common Euclidean length (\delta/2)\|v_{0}\| . The vectors x_{k+3/2}-x_{k+1/2} , k=0,\dots,K-2 share a common Euclidean length \delta\|v_{0}\| . 6. If, as x ranges in \mathbb{R}^{n} , \|H(x)\| is upper bounded by \beta and H(x) is \gamma -Lipschitz continuous, i.e. for each x,y\in\mathbb{R}^{n} , \|H(x)-H(y)\|\leq\gamma\|x-y\|, we have \big\|f(x_{K})-f(x_{0})\big\|\leq\frac{\delta^{2}}{12}\|v_{0}\|^{2}\big(3\beta+\gamma(K-1)\delta\|v_{0}\|\big). 7. If H(x) is of the form H(x)[w,w]=\|w\|^{2}\nu , \nu\in\mathbb{R}^{m} , then f(x_{k})=f(x_{0}) , k=0,\dots,K . To prove Property 1., note that (x,v)\mapsto\Psi_{\delta}(x,v)=(x^{\prime},v^{\prime}) is the composition of three volume preserving maps, (x,v)\mapsto(x+(\delta/2)v,v) , (x,v)\mapsto(x,R(x)v),(x,v)\mapsto(x+(\delta/2)v,v) . Checking Property 2. is a trivial computation. Property 3. just restates ( 4 ). Property 4. follows from Property 3. Property 5. is a consequence of ( 3 ), ( 5 ) and Property 4. The proofs of the last two properties are detailed in Subsection 5.1 Even though \Psi_{\delta} is volume-preserving (Property 1.), a straightforward computation shows that it is not symplectic (the condition in e.g. [ 9 , Definition VI, 2.1] is not satisfied). For the particular case f=\ell , Properties 1. and 2. in tandem with standard results on Markov Chain Monte Carlo methods ensure that Algorithm 1 preserves the distribution with density \propto\exp(\ell(x)) . In Property 6 note that when \beta=0 the manifold {\mathcal{M}}(f(x_{0})) is flat (an affine subspace); thus \beta is a measure of the curvature of that manifold. The bound in Property 6 shows that, for the deviation \|f(x_{1})-f(x_{0})\| to be small, \delta should be chosen in such a way that \delta\|v_{0}\|=2\|x_{1/2}-x_{0}\| is small relative to the curvature of the manifold: a very intuitive result (see Fig. 1 ). It is conceivable that by replacing the first-order, Euler-like substeps ( 3 )–( 5 ) by more sophisticated approximations, as suggested by a reviewer, it would be possible to improve the \mathcal{O}(\delta^{2}) bound in Property 6 to become \mathcal{O}(\delta^{k}) , k>2 . Property 7. holds in particular if in the context of Algorithm 1 the target is an isotropic Gaussian. In that situation, if q(v|x) is also an isotropic Gaussian, Algorithm 1 accepts all the proposals. It would be possible to formulate a localized version of Property 6., where rather than demanding that H is bounded by \beta and \gamma -Lipschitz globally, those hypotheses are only demanded in a domain that contains the iterates x_{k} . Property 6. appears, in a slightly different form, in [ 13 ] (for the case f=\ell ) and in [ 5 ] (for the general case). It shows that indeed ( 3 )–( 5 ) produces points x_{k} that, for \delta small, remain close to the manifold {\mathcal{M}}(f(x_{0})) . It is remarkable that for an explicit timestepping algorithm where no implicit equations are solved, the deviation f(x_{K})-f(x_{0}) grows at most linearly with K\delta , the accumulated time after taking K steps of length \delta (typically integration errors accumulate exponentially). For this reason Hug could be used in any situation not related to sampling where it is of interest to obtain points close to the manifold {\mathcal{M}}(\eta) ; an example, out of many possible, follows. Example 1 . The paper [ 2 ] is devoted to the construction of high accuracy splitting methods tailored to the integration of the Solar System. The most accurate method in [ 2 ] , labelled AB1064, is found by considering a family of integrators depending on ten parameters a_{j} , b_{j} , j=1,\dots,5 , and imposing nine relations on the parameters, f(x)=0 , f:\mathbb{R}^{10}\rightarrow\mathbb{R}^{9} , x=(a_{1},\dots,b_{5}) , that annihilate relevant terms in the expansion of the local error in powers of the stepsize \delta and a small parameter \epsilon of physical origin. In this way, attention is restricted to a manifold of codimension one (curve) \mathcal{M} in the \mathbb{R}^{10} space of the parameters. AB1064 is then defined by the point on \mathcal{M} of minimum squared Euclidean length L^{2}=|a_{1}|^{2}+\cdots+|b_{5}|^{2} . Finding the optimal parameter value is far from trivial and the authors of [ 2 ] resort to a sophisticated technique. As an alternative, since an initial point x_{0} on \mathcal{M} is readily available, we may use Hug to get an approximate description of \mathcal{M} by points x_{0} , …, x_{K} . The point x_{k} of minimum L^{2} , while not exactly on \mathcal{M} , provides a good starting location to solve, by means of a Newton iteration, the 10\times 10 system f=0 , \nabla L^{2}=0 satisfied by the coefficients we seek. It is perhaps of interest to point out that applications of Hug similar to the one we have just sketched only require the knowledge of the mapping f that describes the constraints. This should be compared with situations where one knows a system of ODEs in \mathbb{R}^{n} whose solutions stay on a manifold f=0 and the system is integrated with an (invariably implicit) algorithm devised to generate points on the manifold [ 9 , IV] . A well-known example is provided by the integrators SHAKE and RATTLE used in molecular dynamics [ 9 , VII.1.4] . 3 The ODE Formulas ( 3 )–( 5 ) are clearly reminiscent of a discretization of a system of ODEs. In this section we shall prove that, in fact, ( 3 )–( 5 ) provide an integrator for a system that we will identify. The original reference [ 13 ] did not discuss the connection between Hug and differential equations. 3.1 The derivative N^{\prime}(x) The expression for the system of ODEs approximated by ( 3 )–( 5 ) includes the derivative N^{\prime}(x) of the projector N(x) defined in ( 8 ). This derivative is studied next. For fixed x\in\mathbb{R}^{n} , N^{\prime}(x) maps linearly each vector w\in\mathbb{R}^{n} into an n\times n matrix, that we will denote by N^{\prime}(x)[w] , in such a way that N(x+w)=N(x)+N^{\prime}(x)[w]+o(\|w\|) as w\rightarrow 0 . If z\in\mathbb{R}^{n} , the notation N^{\prime}(x)[w]z will be used, as expected, to refer to the n -vector obtained by multiplying the matrix N^{\prime}(x)[w] and z . It is important to note that for each fixed x , N^{\prime}(x)[w]z depends bilinearly on w and z . According to [ 8 ] , for fixed x and w , N^{\prime}(x)[w]=N^{\prime}_{\perp}(x)[w]+N^{\prime}_{\|}(x)[w], (10) where, the n\times n matrices N^{\prime}_{\perp}(x)[w] , N^{\prime}_{\|}(x)[w] are given by \displaystyle N^{\prime}_{\perp}(x)[w] \displaystyle= \displaystyle J(x)^{+}H(x)[w,\cdot]T(x), (11) \displaystyle N^{\prime}_{\|}(x)[w] \displaystyle= \displaystyle\big(N^{\prime}_{\perp}(x)[w]\big)^{\top}=T(x)\big(H(x)[w,\cdot]\big)^{\top}\big(J(x)^{+}\big)^{\top}. (12) Here, J(x)^{+} and T(x) were defined in ( 7 ) and ( 9 ) respectively and H(x)[w,\cdot] is the m\times n matrix that corresponds to the linear operator z\in\mathbb{R}^{n}\mapsto H(x)[w,z]\in\mathbb{R}^{m} resulting from freezing at w the first argument of the bilinear operator H(x)[\cdot,\cdot] . In this way, the right hand-side of ( 11 ) is the product of an n\times m matrix, an m\times n matrix and n\times n matrix. The following result, that explains the subscripts \perp and \| , gives properties of the matrices N^{\prime}_{\perp}(x)[w] , N^{\prime}_{\|}(x)[w] that we will use repeatedly in the proofs of the results. Lemma 2 . For each x and w : 1. The image subspace of N^{\prime}_{\perp}(x)[w] is contained in {\mathcal{N}}(x) . 2. The kernel of N^{\prime}_{\perp}(x)[w] contains {\mathcal{N}}(x) . 3. The image subspace of N^{\prime}_{\|}(x)[w] is contained in {\mathcal{T}}(x) . 4. The kernel of N^{\prime}_{\|}(x)[w] contains {\mathcal{T}}(x) . It is useful to present an illustration: Example 2 . For the case n=2 , m=1 , f(x)=-ax_{(1)}^{2}-bx_{(2)}^{2} , a,b>0 (corresponding to a bivariate Gaussian in Algorithm 1 ), if w=[w_{(1)},w_{(2)}]^{\top} , one finds N^{\prime}_{\perp}(x)[w]=ab\frac{w_{(2)}x_{(1)}-w_{(1)}x_{(2)}}{(a^{2}x_{(1)}^{2}+b^{2}x_{(2)}^{2})^{2}}\begin{bmatrix}ax_{(1)}\\ bx_{(2)}\end{bmatrix}\begin{bmatrix}-bx_{(2)}&ax_{(1)}\end{bmatrix}. This is a rank one, 2\times 2 matrix with image spanned by the vector [ax_{(1)},bx_{(2)}]^{\top} , whose direction coincides with that of \nabla f(x) (normal to the contour of f that contains x ). The kernel is also spanned by \nabla f . Note that the dependence on w is linear. The matrix N^{\prime}_{\|}(x)[w] is obtained by transposition. Its image and kernel are orthogonal to \nabla f(x) . 3.2 The ODE being approximated Algorithm ( 3 )–( 5 ) will be shown to approximate, in a sense to be specified later, the following system of ODEs in \mathbb{R}^{n}\times\mathbb{R}^{n} : 1 1 1 The —rather unexpected— expression for this system was derived by assuming the ansatz ( 20 ), where x and v=v_{\|}+v_{\perp} are solutions of a system of ODEs to be determined, substituting the ansatz in ( 21 )–( 22 ) and imposing \sigma_{k}=\mathcal{O}(\delta^{2}) and \tau_{k}=\mathcal{O}(\delta^{2}) (cf. the proof of Theorem 5 ). \displaystyle\frac{d}{dt}x \displaystyle= \displaystyle T(x)v, (13) \displaystyle\frac{d}{dt}v \displaystyle= \displaystyle\Big(N^{\prime}_{\|}(x)\big[(T(x)-N(x))v\big]-N^{\prime}_{\perp}(x)\big[(T(x)-N(x))v\big]\Big)v. (14) In order to shorten the notation, we will introduce the symbols v_{\|}=T(x)v,\qquad v_{\perp}=N(x)v for the tangential and normal components of the velocity v . With this notation and taking into account the properties of the kernels of the matrices N^{\prime}_{\|}[v_{\|}-v_{\perp}] and N^{\prime}_{\perp}[v_{\|}-v_{\perp}] in Lemma 2 , ( 14 ) may be written as \frac{d}{dt}v=N^{\prime}_{\|}(x)[v_{\|}-v_{\perp}]v_{\perp}-N^{\prime}_{\perp}(x)[v_{\|}-v_{\perp}]v_{\|}. (15) Some properties of ( 13 )–( 14 ) are contained in the following result. Clearly 1., 2. and 3. here are exact counterparts of Items 1., 2. and 4. in Proposition 1 . In addition Item 6. in that proposition is an approximate version of Item 4. below. Theorem 3 . The system ( 13 )–( 14 ) has the following properties: 1. It preserves volume in \mathbb{R}^{n}\times\mathbb{R}^{n} . 2. It is time-reversible, i.e. it remains invariant after changing t into -t and v into -v . 3. It conserves the Euclidean length of v(t) : (d/dt)\|v(t)\|^{2}=0 . 4. x(t) remains on {\mathcal{M}}(f(x(0)) : (d/dt)f(x(t))=0 The next result gives expressions for (d/d)v_{\|} and (d/dt)v_{\perp} . Note that Lemma 2 implies that in ( 16 ) the terms -N^{\prime}_{\|}(x)[v_{\perp}]v_{\perp} and -N^{\prime}_{\perp}(x)[v_{\|}]v_{\|} are respectively the tangential and normal components of (d/dt)v_{\|} . Similarly the tangential and normal components of (d/dt)v_{\perp} are N^{\prime}_{\|}(x)[v_{\|}]v_{\perp} and N^{\prime}_{\perp}(x)[v_{\perp}]v_{\|} . Proposition 4 . If (x(t),v(t)) is a solution of ( 13 )–( 14 ), then: \displaystyle\frac{d}{dt}v_{\|} \displaystyle= \displaystyle-N^{\prime}_{\|}(x)[v_{\perp}]v_{\perp}-N^{\prime}_{\perp}(x)[v_{\|}]v_{\|}, (16) \displaystyle\frac{d}{dt}v_{\perp} \displaystyle= \displaystyle N^{\prime}_{\|}(x)[v_{\|}]v_{\perp}+N^{\prime}_{\perp}(x)[v_{\perp}]v_{\|}. (17) 3.3 Relating the Algorithm and the ODE Let us now study the relation between the Algorithm ( 3 )–( 5 ) and the system ( 13 )–( 14 ). Before we do that, it is convenient to rewrite the algorithm after elimination of the auxiliary halfway points x_{k+1/2} : \displaystyle x_{k+1} \displaystyle= \displaystyle x_{k}+\delta T(x_{k}+(\delta/2)v_{k})v_{k}, (18) \displaystyle v_{k+1} \displaystyle= \displaystyle\big(I-2N(x_{k}+(\delta/2)v_{k})\big)v_{k}. (19) The situation is much complicated by the way the algorithm treats the normal component of the velocities v_{k} . According to ( 19 ), in the limit \delta\rightarrow 0 with fixed x_{0} , N(x_{0})v_{1}=-N(x_{0})v_{0} ; therefore the v_{k} ’s cannot be seen as approximations to the values of a differentiable function at the step points k\delta . We will show presently that the values x_{k} , v_{k} generated by the algorithm approximate the values, k=0,\dots,K X_{k}=x(k\delta),\qquad V_{k}=v_{\|}(k\delta)+(-1)^{k}v_{\perp}(k\delta), (20) where (x(t),v(t)) is a suitable solution of ( 13 )–( 14 ). The factor (-1)^{k} makes it possible for the V_{k} ’s to mimic the reflections in the normal components of the v_{k} ’s. The first step in the analysis is to show consistency , i.e. that when X_{k} , V_{k} are substituted into the equations ( 18 )–( 19 ), they originate small residuals \displaystyle\sigma_{k+1} \displaystyle:=X_{k+1}-X_{k}-\delta T(X_{k}+(\delta/2)V_{k})V_{k}, (21) \displaystyle\tau_{k+1} \displaystyle:=V_{k+1}-\big(I-2N(X_{k}+(\delta/2)V_{k})\big)V_{k}. (22) As with any other explicit timestepping algorithm, these residuals may be seen as truncation errors (also referred to as local errors), i.e. as the error of the algorithm at t=(k+1)\delta if started from the exact values at t=k\delta . More precisely, if for some k , x_{k} and v_{k} happened to coincide with x(k\delta) and v_{\|}(k\delta)+(-1)^{k}v_{\perp}(k\delta) respectively, then the algorithm would deliver, after one step, values x_{k+1}=X_{k+1}-\sigma_{k+1},\qquad v_{k+1}=V_{k+1}-\tau_{k+1}. The following result shows consistency of order one: Theorem 5 . (First-order consistency.) As \delta\rightarrow 0 and k\rightarrow\infty with k\delta\rightarrow t , the truncation errors \sigma_{k} , \tau_{k} are \mathcal{O}(\delta^{2}) . Consistency is the key step to proving the next convergence result. It is remarkable that, with first order consistency, the algorithm is convergent of the second order . This phenomenon, known as supraconvergence is discussed in e.g. [ 7 ] , where additional references are also supplied. Supraconvergence happens here because there is substantial cancellation between the truncation errors at consecutive steps. A numerical illutration of this cancellation is provided in Table 1 , where f is as in Figure 1 , x_{0}=[\cos(1),(1/2)\sin(1)]^{\top} , v_{0}=[0,1]^{\top} . We see that the errors after a single step (i.e. the truncation errors) decrease as \mathcal{O}(\delta^{2}) in agreement with Theorem 5 . However when a second step is taken with the same value of \delta , the error decreases substantially. Errors after two steps exhibit a \mathcal{O}(\delta^{3}) behaviour. These issues are discussed in detail in Section 5 . For the time being we emphasize that this cancellation of the local error in consecutive steps is not the zig-zagging of the midway approximation x_{k+1/2} that may be seen in Figure 1 . \delta \|x_{1}-x(\delta)\| \|x_{2}-x(2\delta)\| 1/16 4.23\times 10^{-4} 4.87\times 10^{-5} 1/32 1.15\times 10^{-4} 6.56\times 10^{-6} 1/64 3.00\times 10^{-4} 8.50\times 10^{-7} 1/128 7.62\times 10^{-6} 1.08\times 10^{-7} 1/256 1.93\times 10^{-6} 1.36\times 10^{-8} Table 1: Errors in the x variable vs. \delta after one or two timesteps. Theorem 6 . (Second-order convergence.) Fix x_{0} , v_{0} and a time interval [0,T] and consider the solution (x(t),v(t)) of ( 13 )–( 14 ) with x(0)=x_{0} , v(0)=v_{0} and the iterates (x_{k},v_{k}) generated by ( 3 )–( 5 ). Then, as \delta\rightarrow 0 , \max_{k\delta\leq T}\|x_{k}-x(k\delta)\|=\mathcal{O}(\delta^{2}), and \max_{k\delta\leq T}\|v_{k}-\big(v_{\|}(k\delta)+(-1)^{k}v_{\perp}(k\delta)\big)\|=\mathcal{O}(\delta^{2}). The constants implicit in the \mathcal{O} notation in the theorem vary with f , x_{0} , v_{0} and T only. Since the ODE preserves the value of f (Theorem 3 , Property 4.), the \mathcal{O}(\delta^{2}) deviations in the value of f for the x_{k} , proved in Property 6. of Proposition 1 , match the second order convergence stated in Theorem 6 . 3.4 Dynamics The appearence of the system ( 13 )–( 14 ) is certainly unfriendly and it is not easy to guess the behaviour of its solutions. To get some insight, we illustrate its dynamics in the case of two examples. Assume first that initially v(0) is tangent , i.e. v_{\perp}(0)=0 . Then ( 17 ) shows that, for all t , v_{\perp}(t)=0 and therefore v(t)=v_{\|}(t) . According to ( 16 ), the system reduces to: \displaystyle\frac{d}{dt}x \displaystyle= \displaystyle v_{\|}, \displaystyle\frac{d}{dt}v_{\|} \displaystyle= \displaystyle-N^{\prime}_{\perp}(x)[v_{\|}]v_{\|}. These are the equations of motion for a particle that is constrained to remain on the manifold {\mathcal{M}}(f(x(0))) when there are no external forces (other than the normal force -N^{\prime}_{\perp}(x)[v_{\|}]v_{\|} exerted by the constraint) [ 12 , Chapter 7] . The preservation of \|v_{\|}(t)\|^{2} is just the preservation of kinetic energy that takes place due to the absence of working forces. As a second example we look at the case where n=2 , m=1 and f(x)=-ax_{(1)}^{2}-bx_{(2)}^{2} , a,b>0 , as in Example 2 . As pointed out there this would arise when sampling from a bivariate, anisotropic Gaussian target distribution. (Recall that for isotropic Gaussians all proposals are accepted.) There are four scalar equations in ( 13 )–( 14 ) and, using the first integrals f(x) and \|v\|^{2} , the system is reducible to a two-dimensional one. For simplicity we restrict the attention to solutions where f(x(0))=-1 (the general case may be retrieved from this by rescaling a and b ). We may then parameterize the level set (ellipse) {\mathcal{M}}(f(x(0))) in terms of an angular variable \phi as follows: x_{(1)}=a^{-1/2}\cos\phi,\qquad x_{(2)}=b^{-1/2}\sin\phi. The unit vector tangent to the ellipse is {\bf t}(\phi)=\mu^{-1/2}[-b^{1/2}\sin\phi,a^{1/2}\cos\phi]^{\top}, where \mu=a\cos^{2}\phi+b\sin^{2}\phi, (23) and the corresponding unit normal vector is {\bf n}(\phi)=\mu^{-1/2}[a^{1/2}\cos\phi,-b^{1/2}\sin\phi]^{\top}. We may parameterize v_{\|} and v_{\perp} in terms of scalars p and n : v_{\|}=p{\bf t},\qquad v_{\perp}=n{\bf n}. In addition p and n are linked by the first integral p^{2}+n^{2}=p(0)^{2}+n(0)^{2} established in Part 3 of Theorem 3 . Substitution of these expressions into ( 13 ), ( 15 ), leads, using the expressions for N^{\prime}_{\|} and N^{\prime}_{\perp} given in Example 2 and after considerable algebra, to the system \displaystyle\frac{d}{dt}\phi \displaystyle= \displaystyle(ab)^{1/2}\mu^{-1/2}p, (24) \displaystyle\frac{d}{dt}p \displaystyle= \displaystyle\frac{1}{2}(ab)^{1/2}(a-b)\mu^{-3/2}\sin(2\phi)(c^{2}-p^{2}), (25) where \mu is the function of \phi in ( 23 ) and c^{2}=p(0)^{2}+n(0)^{2} is \|v(0)\|^{2} , c\geq 0 . The system has to be considered only in the strip |p|\leq c because n(0) is real. The lines p=\pm c that bound the strip are invariant. Figure 2: Phase plane of the system ( 24 )–( 25 ), when a=1 , b=4 , c=\sqrt{2} . The portrait is 2\pi -periodic in \phi . The thicker lines correspond to the heteroclinic connections between saddle points. Outside the heteroclinic connections trajectories rotate; inside they librate. In the isotropic case a=b , where the ellipses are circles, \mu does not vary with \phi , p(t) remains constant and \phi(t) varies linearly with t . In the anisotropic case a\neq b , it may be assumed that b>a , as the other case is reduced to this by interchanging the roles of the components x_{(1)} and x_{(2)} of x . The system has equilibria at p=0 , \phi=j\pi/2 , j integer. One may easily prove that for j even the equilibria are centers and otherwise they are saddles. A sketch of the phase portrait may be seen in Figure 2 , where we note the similarity with the phase portrait of the standard pendulum equation. The saddle at \phi=j\pi/2 , p=0 ( j odd) is connected to the neighbouring saddles at \phi=(j\pm 2)\pi/2 , p=0 via heteroclinic trajectories; these are the image in the (\phi,p) -plane of solutions (\phi(t),p(t)) with \lim_{t\rightarrow-\infty}(\phi(t),p(t))=(j\pi/2,0),\qquad\lim_{t\rightarrow\infty}(\phi(t),p(t))=((j+2)\pi/2,0) or \lim_{t\rightarrow-\infty}(\phi(t),p(t))=(j\pi/2,0),\qquad\lim_{t\rightarrow\infty}(\phi(t),p(t))=((j-2)\pi/2,0). In the terminology of classical mechanics, trajectories at the top or the bottom of the figure (i.e. ‘outside’ the heteroclinic connections) rotate : in them p does not change sign as t varies and the angle \phi increases monotonically (if p>0 ) or decreases monotonically (if p<0 ). The centers \phi=j\pi/2 , p=0 ( j even) are surrounded by trajectories that librate : in them \phi varies periodically around j\pi/2 between two values, say \phi_{\max},\phi_{\min} , and p varies periodically around 0 . In terms of the original system ( 13 )–( 14 ), in rotating trajectories, as t\rightarrow\infty , the point x(t) describes again and again the ellipse {\mathcal{M}}(f(x(0))) either clockwise (if p(t)<0) or anticlockwise (if p(t)>0) . For librating trajectories, the solution x(t) describes the arc of the ellipse parameterized by \phi\in[\phi_{\max},\phi_{\min}] ; when \phi(t) has increased to \phi_{\max} it starts decreasing and the trajectory in the x plane folds back on itself, see Figure 3 . When \phi(t) has decreased to \phi_{\min} it starts increasing, causing the trajectory in the x plane to fold back on itself again. The process is repeated periodically. The figure also depicts the time-discrete solution provided by Hug, which is seen to mimic the behaviour of the ODE solution (this has to be the case, if \delta is sufficiently small, due to the convergence of the algorithm). Needless to say, this folding back phenomenon is not welcome in the context of Algorithm 1 , where one had the hope that, for suitable choices of K , the x_{k} would wholly explore {\mathcal{M}}(f(x_{0})) . Figure 3: The continuous arc is the solution of the system ( 13 )–( 14 ) when f(x)=-x_{(1)}^{2}-4x_{(2)}^{2} , x(0)=[1,0] , and v(0)=[\sqrt{7/4},1/2]^{\top} depicted in the x plane for 0\leq t\leq 1.4 . (This corresponds to system ( 24 )–( 25 ) with \phi(0)=0 , p(0)=1/2 , c=\sqrt{2} .) The solution x(t) first moves anticlockwise starting from x(0) but then folds back on itself, moves clockwise and folds back once more. At the final time, x(14) happens to be close to the initial location x(0) . Also depicted is the approximation provided by Algorithm ( 3 )–( 5 ), when \delta=0.1 and K=14 . The numerical solution mimics the behaviour of the ODE; the numbers 0-14 identify the stepnumber k of the iterates x_{k} . Note from Figure 2 that, generally speaking, the (desirable) rotating trajectories correspond to cases where |p(0)| is large or, equivalently, |n(0)|=\sqrt{c^{2}-p(0)^{2}} is small relative to c=\|v(0)\| . This could have been expected because for n(0)=0 the system just describes the inertial motion of a particle around the whole ellipse. In the scenario of Algorithm 1 , v(0) is a random variable with distribution q(\cdot|x(0)) . For the standard choice where q is an x(0) -independent isotropic normal, |n(0)| will not, on average, be small relative to \|v(0)\| with the result that, if the numerical trajectories are long, i.e. K is large, many may fold back on themselves. For Algorithm 1 , this suggests (i) using distributions q(v|x) where at each x vectors with larger tangential components are given more weight and (ii) not using very large values of K . We however expect this phenomenon to vanish as dimension increases, as discussed in the next section. 4 Numerical experiments and future work As discussed in the introduction, this work was initially motivated by recent developments in the context of MCMC methods where the dynamics studied in the present paper underpins the design of updates of Markov chains aiming to explore, approximately, the contours of a probability density, or more generally a manifold. Analysis and observations in earlier sections point to potentially unappealing features of this dynamics. In the simple scenario of a two-dimensional ellipse we have provided a precise analysis of the dynamic, in particular characterising initial velocities leading to either rotation or libration. However the two dimensional scenario is particular in that trajectories that fail to describe the full ellipse turn back on themselves exactly, resulting in a periodic behaviour. Natural questions are therefore what form this phenomenon takes in higher dimensions and whether it is even noticeable when used in the (random) proposal mechanism of an MCMC algorithm. Indeed, it is for example known that for a random vector v\sim\mathcal{U}(\mathbb{S}^{n}) (where \mathbb{S}^{n} is the unit hypersphere) and any fixed unit vector u\in\mathbb{R}^{n} then u^{\top}v tends to be statistically small in the sense that for h\in[0,1] \mathbb{P}(|u^{\top}v|\geq h)=\frac{\int_{h}^{1}[1-w^{2}]^{(n-2)/2}{\rm d}w}{\int_{0}^{1}[1-w^{2}]^{(n-2)/2}{\rm d}w}\,, confirming concentration on smaller values as n increases. This suggests that the negative phenomenon outlined earlier may perhaps naturally vanish in high dimensional scenarios. A full, and relevant, analytical investigation of these issues is beyond the scope of the present manuscript and instead we present here a simple numerical study providing some insight into this phenomenon in the multivariate scenario. (a) \|v_{\perp}(0)\|=0.2023 (b) \|v_{\perp}(0)\|=0.5673 (c) \|v_{\perp}(0)\|=0.6647 (d) \|v_{\perp}(0)\|=0.7357 Figure 4: K=10000 integration steps of the dynamics constrained to a 3D ellipsoid (n=3) , for four initial unit length velocities. We first explore the behaviour of the Hug integrator in the scenario where n=3 and the constraint of interest is an ellipsoid defined by f(x)=x^{T}Ax with A:={\rm{\rm diag}}(1,4,3) . In Fig. 4 we display K=10000 steps of the integrator for \delta=0.01 and initial position x(0)=[1,0,0]^{T} (therefore defining the level set of f ) for four initial velocities v(0) such that \|v(0)\|=1 . These are representative of what we have observed for numerous draws v(0)\sim\mathcal{U}(\mathbb{S}_{n}) ; as pointed out by one of the reviewers, \|v_{\perp}(0)\|\sim\mathcal{U}(0,1) in the specific scenario where n=3 . As expected, we observe that a large orthogonal component \|v_{\perp}(0)\| results in trajectories that fail to explore a large area of the ellipsoid, due to a near oscillatory phenomenon. In fact we have found the size of the region visited to shrink for even larger values \|v_{\perp}(0)\| , but do not report the results here. For smaller values of K , more likely to be relevant in the context of Monte Carlo algorithms, we have similarly observed the influence of \|v_{\perp}(0)\| on the size of the region explored by the dynamics. (a) K=1000 (b) K=100 (c) K=10 Figure 5: Scatter plots i\mapsto\big(\|v_{\perp}^{(i)}(0)\|,d_{\rm max}\big(v_{\perp}(0)\big):=\max_{0\leq k\leq K}\|x^{(i)}(k)-x(0)\|\big) ( n=3 ) (a) K=1000 (b) K=100 (c) K=10 Figure 6: Scatter plots i\mapsto\big(\|v_{\perp}^{(i)}(0)\|,d_{\rm max}\big(v_{\perp}(0)\big):=\max_{0\leq k\leq K}\|x^{(i)}(k)-x(0)\|\big) ( n=6 ) (a) K=1000 (b) K=100 (c) K=10 Figure 7: Estimates of f\mapsto\mathbb{P}\big(d_{\rm max}\big(v_{\perp}(0)\big)\leq f\cdot\sup_{v_{\perp}}d_{\rm max}\big(v_{\perp}\big)\big) for n=3 . (a) K=1000 (b) K=100 (c) K=10 Figure 8: Estimates of f\mapsto\mathbb{P}\big(d_{\rm max}\big(v_{\perp}(0)\big)\leq f\cdot\sup_{v_{\perp}}d_{\rm max}\big(v_{\perp}\big)\big) for n=6 . In order to gain more insights into this phenomenon, we have run the following experiments. In the setup above we now consider 10000 realisations of the initial velocity v^{(i)}(0)\overset{{\rm iid}}{\sim}\mathcal{U}(\mathbb{S}_{n}) for i=1,\ldots,10000 and report the scatter plot i\mapsto\big(\|v_{\perp}^{(i)}(0)\|,d_{\rm max}\big(v_{\perp}(0)\big):=\max_{0\leq k\leq K}\|x^{(i)}(k)-x(0)\|\big) , that is explore dependence of the largest Euclidean distance reached by the dynamic on \|v_{\perp}(0)\| . The results are reported in Fig. 5 for K=10,100,1000 integration steps. This confirms our earlier observations, including the concentration of the whole dynamics around the initial position as \|v_{\perp}(0)\| increases. We repeated this experiment for n=6 , A={\rm{\rm diag}}(1,4,3,5,1,10) and x(0)=(1,0,0,0,0,0)^{T} and the results are reported in Fig. 6 with similar conclusions. However, following a reviewer’s suggestion, we present in Fig 7 and Fig 8 the Empirical Cumulative Distribution Functions (ECDF) of the maximum distance achieved for each realisations as a fraction of the maximum over all realisations, effectively approximating f\mapsto\mathbb{P}\big(d_{\rm max}\big(v_{\perp}(0)\big)\leq f\cdot\sup_{v_{\perp}}d_{\rm max}\big(v_{\perp}\big)\big) . As expected, for the reasons outlined at the beginning of the section, these ECDF functions are more skewed to higher fraction values for n=6 dimensions than for n=3 , although we have not investigated the effect of the different extreme curvatures on the results. Our work suggests that MCMC based on Hug trajectories may benefit from the use of state-dependent and non-isotropic distributions for the velocity, limiting the likelihood of using velocities with dominant v_{\perp} component; this however introduces a necessary tradeoff since the dynamics now does not leave the velocity distribution invariant, resulting in a higher rejection rate in the MH update [ 5 ] . More work is needed to understand this tradeoff. Note that, in cases where Hug is used to describe a manifold (as in Example 1 ), it is possible to avoid the fold-back phenomenon by refreshing the velocity whenever its normal component has become large. 5 Proofs This section contains the proofs of the results. 5.1 Proof of Proposition 1 We only have to establish Properties 5 and 6. With an obvious simplified notation, Taylor’s theorem around x_{k+1/2} leads to \displaystyle f_{k} \displaystyle= \displaystyle f_{k+1/2}-\frac{\delta}{2}J_{k+1/2}v_{k}+\frac{\delta^{2}}{4}H_{k}^{+}[v_{k},v_{k}], \displaystyle f_{k+1} \displaystyle= \displaystyle f_{k+1/2}+\frac{\delta}{2}J_{k+1/2}v_{k+1}+\frac{\delta^{2}}{4}H_{k+1}^{-}[v_{k+1},v_{k+1}], with \displaystyle H_{k}^{+} \displaystyle= \displaystyle\int_{0}^{1}H\big(x_{k+1/2}+\lambda(x_{k}-x_{k+1/2})\big)(1-\lambda)d\lambda, \displaystyle H_{k+1}^{-} \displaystyle= \displaystyle\int_{0}^{1}H\big(x_{k+1/2}+\lambda(x_{k+1}-x_{k+1/2})\big)(1-\lambda)d\lambda. Subtracting, taking into account that v_{k}+v_{k+1} is tangential by Property 3. and ( 6 ), f_{k+1}-f_{k}=\frac{\delta^{2}}{4}\Big(H_{k+1}^{-}[v_{k+1},v_{k+1}]-H_{k}^{+}[v_{k},v_{k}]\Big) (26) and, summing by parts, f(x_{K})-f(x_{0})=\frac{\delta^{2}}{4}\Big(H_{K}^{-}[v_{K},v_{K}]-H_{0}^{+}[v_{0},v_{0}]+\sum_{k=1}^{K-1}\big(H_{k}^{-}-H_{k}^{+}\big)[v_{k},v_{k}]\Big). By definition of the operator norm and Property 4., the norm of each of the terms H_{K}^{-}[v_{K},v_{K}] and H_{0}^{+}[v_{0},v_{0}] is bounded by \beta\int_{0}^{1}(1-\lambda)d\lambda\>\|v_{0}\|^{2}=\frac{\beta}{2}\|v_{0}\|^{2}. On the other hand, H_{k}^{-}-H_{k}^{+} equals \int_{0}^{1}\Big(H\big(x_{k-1/2}+\lambda(x_{k}-x_{k-1/2})\big)-H\big(x_{k+1/2}+\lambda(x_{k}-x_{k+1/2})\big)\Big)(1-\lambda)d\lambda, and, therefore, by the assumed Lispchitz continuity, and Property 5. \|H_{k}^{-}-H_{k}^{+}\|\leq\int_{0}^{1}\gamma(1-\lambda)^{2}\|x_{k-1/2}-x_{k+1/2}\|\>d\lambda=\frac{\gamma}{3}\delta\|v_{0}\|. After putting everything together, we get the bound in 6. With the hypothesis in 7., Property 4. shows that the right hand-side of ( 26 ) vanishes, which concludes the proof. When m=1 the manifolds {\mathcal{M}}(\eta) are concentric hyperspheres, and the property f(x_{k+1})-f(x_{k})=0 is apparent from the the geometry of the construction of x_{k+1} from x_{k} . 5.2 Proof of Lemma 2 1. From ( 11 ), the image of N^{\prime}_{\perp}(x)[w] is contained in the image of J(x)^{+} , which, according to ( 7 ) is contained in the image of J(x)^{\top} , i.e. in the orthogonal of the kernel {\mathcal{T}}(x) of J(x) (see ( 6 )), i.e. in {\mathcal{N}}(x) . 2. From ( 11 ), the kernel of N^{\prime}_{\perp}(x)[w] is contained in the kernel of T(x) , i.e. in {\mathcal{N}}(x) . The other two claims are proved similarly. 5.3 Proof of Theorem 3 For Item 1. we have to prove that the vector field in ( 13 )–( 14 ) is divergence free. We first present some facts related to the computation of divergences. If z\in\mathbb{R}^{d}\mapsto g(z)\in\mathbb{R}^{d} is a vector field, its divergence is of course the trace of the Jacobian {\rm div}_{z}(g(z))=\sum_{j}\langle e_{j},g^{\prime}(z)e_{j}\rangle, (27) here the e_{j} are the unit coordinate vectors and \langle\cdot,\cdot\rangle refers to the standard inner product. In the particular case of a linear vector field z\mapsto Az , this reduces to the trace of the matrix A : {\rm div}_{z}(Az)=\sum_{j}\langle e_{j},Ae_{j}\rangle. Since the trace is invariant by similarity, if \Omega is an arbitrary invertible matrix, {\rm div}_{z}(Az)=\sum_{j}\langle e_{j},Ae_{j}\rangle=\sum_{j}\langle e_{j},\Omega^{-1}A\Omega e_{j}\rangle. (28) For a bilinear vector field z\mapsto B(z,z) , we observe that the Jacobian is formed adding the Jacobian with respect to the first argument of B (with the second frozen) to the Jacobian with respect to the second argument (with the first frozen). Therefore the divergence may be written as {\rm div}_{z}(B(z,z))=\sum_{j}\langle e_{j},B(e_{j},z)\rangle+\sum_{j}\langle e_{j},B(z,e_{j})\rangle. (29) We are now ready to compute the divergence of the system ( 13 )–( 14 ). From ( 27 ) and ( 9 ), {\rm div}_{x}(T(x)v)=\sum_{j=1}^{n}\langle e_{j},T^{\prime}(x)[e_{j}]v\rangle=-\sum_{j=1}^{n}\langle e_{j},N^{\prime}(x)[e_{j}]v\rangle, (30) and, from ( 29 ), with a shortened notation, \displaystyle{\rm div}_{v}\Big(\Big(N^{\prime}_{\|}(x)\big[(T(x)-N(x))v\big]-N^{\prime}_{\perp}(x)\big[(T(x)-N(x))v\big]\Big)v\Big)= \displaystyle\qquad\qquad\sum_{j=1}^{n}\langle e_{j},\Big(N^{\prime}_{\|}\big[(T-N)e_{j}\big]-N^{\prime}_{\perp}\big[(T-N)e_{j}\big]\Big)v\rangle+ \displaystyle\qquad\qquad\sum_{j=1}^{n}\langle e_{j},\Big(N^{\prime}_{\|}\big[(T-N)v\big]-N^{\prime}_{\perp}\big[(T-N)v\big]\Big)e_{j}\rangle. (31) The last summation vanishes because it is the trace of the matrix N^{\prime}_{\|}\big[(T-N)v\big]-N^{\prime}_{\perp}\big[(T-N)v\big] , which is skew-symmetric due to ( 12 ). 2 2 2 In actual fact the traces of N^{\prime}_{\|}\big[(T-N)v\big] and N^{\prime}_{\perp}\big[(T-N)v\big] are both 0 . According to Lemma 2 , these matrices are nilpotent with N^{\prime}_{\|}\big[(T-N)v\big]^{2}=0 and N^{\prime}_{\perp}\big[(T-N)v\big]^{2}=0 which implies that all eigenvalues of N^{\prime}_{\|}\big[(T-N)v\big] and N^{\prime}_{\perp}\big[(T-N)v\big] vanish. The properties of the images in Lemma 2 show that the first summation in the right hand-side of ( 31 ) may be rewritten as \sum_{j=1}^{n}\langle e_{j},\Big((T-N)N^{\prime}_{\|}\big[(T-N)e_{j}\big]+(T-N)N^{\prime}_{\perp}\big[(T-N)e_{j}\big]\Big)v\rangle or, resorting to ( 10 ), \sum_{j=1}^{n}\langle e_{j},(T-N)N^{\prime}\big[(T-N)e_{j}\big]v\rangle. Since (T-N)^{-1}=T-N , the formula ( 28 ) implies that this equals \sum_{j=1}^{n}\langle e_{j},N^{\prime}[e_{j}]v\rangle, which cancels ( 30 ). In this way volumen conservation has been established. The time reversibility in Item 2. is clear: changing t into -t and v into -v reverses the sign of the left and right hand-sides of ( 13 ) and does not change the left and right hand-sides of ( 14 ) as the right hand-side is quadratic in v . For Item 3., from ( 15 ) \frac{1}{2}\frac{d}{dt}\langle v,v\rangle=\langle v,N^{\prime}_{\|}(x)[v_{\|}-v_{\perp}]v_{\perp}\rangle\>-\>\langle v,N^{\prime}_{\perp}(x)[v_{\|}-v_{\perp}]v_{\|}\rangle, or, taking into account the properties of the images of N^{\prime}_{\|}(x)[v_{\|}-v_{\perp}] and N^{\prime}_{\perp}(x)[v_{\|}-v_{\perp}] in Lemma 2 , \frac{1}{2}\frac{d}{dt}\langle v,v\rangle=\langle v_{\|},N^{\prime}_{\|}(x)[v_{\|}-v_{\perp}]v_{\perp}\rangle\>-\>\langle v_{\perp},N^{\prime}_{\perp}(x)[v_{\|}-v_{\perp}]v_{\|}\rangle. The right hand-side vanishes because the matrices involved are transposed of one another (see ( 12 )). Finally, for Item 4., ( 13 ) leads to \frac{d}{dt}f(x)=J(x)v_{\|}; the right hand-side vanishes according to ( 6 ). 5.4 Proof of of Proposition 4 By using ( 9 ), ( 15 ), ( 13 ) and ( 10 ) successively, we may write \displaystyle\frac{d}{dt}(Tv) \displaystyle= \displaystyle\Big(\frac{d}{dt}T\Big)v+T\frac{d}{dt}v \displaystyle= \displaystyle-\Big(\frac{d}{dt}N\Big)v+TN^{\prime}_{\|}[v_{\|}-v_{\perp}]v_{\perp}-TN^{\prime}_{\perp}[v_{\|}-v_{\perp}]v_{\|} \displaystyle= \displaystyle-\big(N^{\prime}_{\|}[v_{\|}]+N^{\prime}_{\perp}[v_{\|}]\big)(v_{\|}+v_{\perp}) \displaystyle\qquad\qquad+TN^{\prime}_{\|}[v_{\|}-v_{\perp}]v_{\perp}-TN^{\prime}_{\perp}[v_{\|}-v_{\perp}]v_{\|}. Simplification with the help of Lemma 2 leads to ( 16 ) Equation ( 17 ) is derived in a similar fashion. 5.5 Proof of Theorem 5 For \sigma : \sigma_{k+1}=X_{k+1}-X_{k}-\delta T(X_{k})V_{k}-\delta\big(T(X_{k}+(\delta/2)V_{k})-T(X_{k})\big)V_{k} Now, note that T(X_{k}+(\delta/2)V_{k})-T(X_{k})=\mathcal{O}(\delta), and that, in view of ( 13 ), X_{k+1}-X_{k}-\delta T(X_{k})V_{k}=x((k+1)\delta)-x(k\delta)-\delta v_{\|}(k\delta)=\mathcal{O}(\delta^{2}). We turn to \tau . We write: \displaystyle\tau_{k+1} \displaystyle= \displaystyle V_{k+1}-\big(I-2N(X_{k})\big)V_{k}+2\big(N(X_{k}+(\delta/2)V_{k})-N(X_{k})\big)V_{k} \displaystyle= \displaystyle V_{k+1}-T(X_{k})V_{k}+N(X_{k})V_{k}+2\big(N(X_{k}+(\delta/2)V_{k})-N(X_{k})\big)V_{k}, and Taylor expanding \tau_{k+1}=V_{k+1}-T(X_{k})V_{k}+N(X_{k})V_{k}+\delta N^{\prime}(X_{k})[V_{k}]V_{k}+\mathcal{O}(\delta^{2}), or, from ( 20 ) (assuming k even) and ( 10 ), simplifying slightly the notation: \displaystyle\tau_{k+1} \displaystyle= \displaystyle v_{\|}((k+1)\delta)-v_{\perp}((k+1)\delta)-v_{\|}(k\delta)+v_{\perp}(k\delta) \displaystyle+\delta N^{\prime}_{\|}[v_{\|}(k\delta)+v_{\perp}(k\delta)](v_{\|}(k\delta)+v_{\perp}(k\delta)) \displaystyle+\delta N^{\prime}_{\perp}[v_{\|}(k\delta)+v_{\perp}(k\delta)](v_{\|}(k\delta)+v_{\perp}(k\delta))+\mathcal{O}(\delta^{2}). We next recall ( 16 ) and ( 17 ) and Lemma 2 to get, simplifying further the notation: \displaystyle\tau_{k+1} \displaystyle= \displaystyle-\delta N^{\prime}_{\|}[v_{\perp}]v_{\perp}-\delta N^{\prime}_{\perp}[v_{\|}]v_{\|}-\delta N^{\prime}_{\|}[v_{\|}]v_{\perp}-\delta N^{\prime}_{\perp}[v_{\perp}]v_{\|} \displaystyle+\delta N^{\prime}_{\|}[v_{\|}+v_{\perp}]v_{\perp}+\delta N^{\prime}_{\perp}[v_{\|}+v_{\perp}]v_{\|}+\mathcal{O}(\delta^{2}) \displaystyle= \displaystyle\mathcal{O}(\delta^{2}). For k odd the technique of proof is the same. 5.6 Proof of Theorem 6 Standard textbook proofs (see e.g. [ 10 , Chapter 2.3] ), going all the way back to Henrici [ 11 ] , of the convergence of consistent one-step integrators assume that the map that advances the numerical solution over a single time-step is of the form Id+\delta\Delta , where the so-called increment function \Delta is assumed to be Lipschitz in the neighbourhood of the ODE solution being approximated. Due to the flipping of the normal component of the velocity, that assumption does not hold for ( 3 )–( 5 ). There is a second difficulty. The truncation errors ( 21 )–( 22 ) are \mathcal{O}(\delta^{2}) (first-order consistency) and the usual consistency+stability argument would lead to \mathcal{O}(\delta) global error bounds (first order convergence), while Theorem 6 claims \mathcal{O}(\delta^{2}) error bounds (second-order convergence). In order to circumvent these difficulties, we consider the numerical integrator \widehat{\mathcal{I}} such that one timestep of length 2\delta with \widehat{\mathcal{I}} is the result of taking successively two steps of length \delta with ( 3 )–( 5 ). In symbols, the one step map \widehat{\Psi} associated with \mathcal{I} satisfies \widehat{\Psi}_{2\delta}=\Psi_{\delta}\circ\Psi_{\delta} . Clearly \widehat{\Psi}_{2\delta} has the required Id+(2\delta)\widehat{\Delta} structure, where \widehat{\Delta} is differentiable, due to smoothness of f , and therefore locally Lispchitz. The consistency of ( 3 )–( 5 ) implies that the new integrator is also consistent (see [ 9 , Theorem II.4.1] ). In addition, the time-reversibility in Proposition 1 implies that its order of consistency has to be even (see e.g. [ 9 , Section II.3, Section V.1] ); simple examples (say f(x)=\|x\|^{2} ) show that the order is exactly two. (An aside: \Psi_{\delta} is consistent and time-reversible and yet is not consistent of even order. There is no contradiction, because the argument that shows even order for reversible integrators in [ 9 , Section II.3, Section V.1] requires \Psi_{\delta}=Id+\mathcal{O}(\delta) something that does not hold for ( 3 )–( 5 ).) For \widehat{\mathcal{I}} , consistency of order two entails convergence of order two following the standard argument. The even numbered points (x_{2k},v_{2k}) generated by ( 3 )– ( 5 ) may be seen as coming from \widehat{\mathcal{I}} and this proves \max_{2k\delta\leq T}\Big(\|x_{2k}-x(2k\delta)\|+\|v_{2k}-v(2k\delta)\|\Big)=\mathcal{O}(\delta^{2}),\qquad\delta\rightarrow 0. For an odd-numbered step point (2k+1)\delta , one may see the timestepping with ( 3 )–( 5 ) as being performed into two parts. First, one timesteps from t=0 to t=2k\delta and then one performs a single timestep from t=2k\delta to t=(2k+1)\delta . The first part, as shown in the last display, introduces \mathcal{O}(\delta^{2}) errors. The second part just introduces a single local error, which we know from Theorem 5 is of size \mathcal{O}(\delta^{2}) . This concludes the proof. It may be of some interest to emphasize that since ( 3 )–( 5 ) is consistent of order one and \widehat{\mathcal{I}} is consistent of order two, when timestepping with ( 3 )–( 5 ), the truncation error at the present step will almost be cancelled by the truncation error at the next step. (This is not the zig-zagging of the midway points x_{k+1/2} in Figure 1 —that zig-zagging cancels deviations of x_{k+1/2} and x_{k+3/2} normal to the level set of f .) The cancellation of truncation errors leading to supraconvergence is borne out in Table 1 , where the columns give the truncation errors in x at the initial point (x_{0},v_{0}) for ( 3 )–( 5 ) and for \widehat{\mathcal{I}} . A similar phenomenon takes place implicitly in Property 6. of Proposition 1 . In ( 26 ) we saw that the change in f over a single timestep is \mathcal{O}(\delta^{2}) (which matches the first-order consistency of ( 3 )–( 5 )). This may wrongly suggest that after K=\mathcal{O}(1/\delta) steps the change in f would be \mathcal{O}(\delta) , rather than \mathcal{O}(\delta^{2}) as proved in Proposition 1 . Note that in ( 26 ), while H_{k+1}^{-} and H_{k}^{+} differ by a \mathcal{O}(\delta) amount, the same is not true of v_{k} and v_{k+1} , which differ by a \mathcal{O}(1) amount, so that f_{k+1}-f_{k}=\mathcal{O}(\delta^{2}) but f_{k+1}-f_{k}\neq\mathcal{O}(\delta^{3}) . However, over two consecutive steps \displaystyle f_{k+2}-f_{k} \displaystyle= \displaystyle\frac{\delta^{2}}{4}\Big(H_{k+2}^{-}[v_{k+2},v_{k+2}]-H_{[k+1}^{+}[v_{k+1},v_{k+1}]\Big) \displaystyle\qquad\qquad+\frac{\delta^{2}}{4}\Big(H_{k+1}^{-}[v_{k+1},v_{k+1}]-H_{k}^{+}[v_{k},v_{k}]\Big) \displaystyle= \displaystyle\frac{\delta^{2}}{4}\Big(H_{k+2}^{-}[v_{k+2},v_{k+2}]-H_{k}^{+}[v_{k},v_{k}]\Big) \displaystyle\qquad\qquad+\frac{\delta^{2}}{4}(H_{k+1}^{-}-H_{k+1}^{+})[v_{k+1},v_{k+1}]. Here v_{k+2} and v_{k} differ an by a \mathcal{O}(\delta) amount, and the same is true for H_{k+2}^{-} and H_{k}^{+} and for H_{k+1}^{-} and H_{k+1}^{+} . Therefore f_{k+2}-f_{k}=\mathcal{O}(\delta^{3}) (which of course matches the fact that \widehat{\mathcal{I}} is consistent of order two). Acknowledgements. CA was supported in part by a Simons Fellowship while visiting the Newton Institute programme “Stochastic systems for anomalous diffusion”. JMS has been funded by Ministerio de Ciencia e Innovación (Spain), project PID2022-136585NB-C21, MCIN/AEI/10.13039/501100011033/FEDER, UE. The authors are very thankful to the Heilbronn Institute for its support.