<<

Discrete Versions of Stokes’ Theorem Based on Families of Weights on Hypercubes

Gilbert Labelle and Annie Lacasse

Laboratoire de Combinatoire et d’Informatique Math´ematique, UQAM CP 8888, Succ. Centre-ville, Montr´eal (QC) Canada H3C3P8 Laboratoire d’Informatique, de Robotique et de Micro´electronique de Montpellier, 161 rue Ada, 34392 Montpellier Cedex 5 - France [email protected], [email protected]

Abstract. This paper generalizes to higher dimensions some algorithms that we developed in [1,2,3] using a discrete version of Green’s theo- rem. More precisely, we present discrete versions of Stokes’ theorem and Poincar´e lemma based on families of weights on hypercubes. Our ap- proach is similar to that of Mansfield and Hydon [4] where they start with a concept of difference forms to develop their discrete version of Stokes’ theorem. Various applications are also given.

Keywords: Discrete Stokes’ theorem, Poincar´e lemma, hypercube.

1 Introduction

Typically, physical phenomenon are described by differential equations involving differential operators such as , and . Numerical approx- imation of these equations is a rich subject. Indeed, the use of simplicial or (hyper)cubical complexes is well-established in and in com- puter imagery. Such complexes often provide good approximations to geometri- cal objects occuring in diverse fields of applications (see Desbrun and al. [5] for various examples illustrating this point). In particular, discretizations of differ- ential forms occuring in the classical Green’s and Stokes’ theorems allows one to reduce the (approximate) computation of parameters associated with a geo- metrical object to computation associated with the boundary of the object (see [4,5,6,7]). In the present paper, we focus our attention on hypercubic configurations and systematically replace differential forms by weight functions on hypercubes. We extend the classical difference and operators (Δ, Σ), of the finite difference , to weight functions on hypercubic configurations in order to formulate our discrete versions of Stokes’ theorem. For example, using these operators, the total volume, coordinates of the center of gravity, moment of and other statistics of an hypercubic configuration can be computed using suitable weight functions on its boundary (see Section 4 below). Although our approach have connections with the works [4,6] on cubical com- plexes and cohomology in Zn, we think that it can bridge a gap between dif- ferential calculus and discrete geometry since no differential forms or operations

S. Brlek, C. Reutenauer, and X. Proven¸cal (Eds.): DGCI 2009, LNCS 5810, pp. 229–239, 2009. c Springer-Verlag Berlin Heidelberg 2009 230 G. Labelle and A. Lacasse of standard exterior algebra calculus are involved. Moreover, our results are easily implemented on computer algebra systems such as Maple or Mathemat- ica since families of weight functions on hypercubes, difference and summation operators are readily programmable. Finally, weight functions can take values in an arbitrary commutative ring. In particular, taking values in the boolean ring B = {0, 1, and, xor}, our results provide algorithms to decide, for example, whether a given hypercube (or pixel, in the bi-dimensional case) belongs to an hypercubic configuration (or polyomino) using a suitable weight on its boundary (see [1,2,3], for similar examples in the case of polyominoes). For completeness, in Section 2 we state the classical Stokes’ theorem and recall some elementary concepts on differential forms. Section 3 describes discrete geometrical objects such as hypercubes, hypercubic configurations together with exterior difference and summation operators on weight functions which are used to formulate our discrete versions of Stokes’ theorem. Section 4 illustrates the theory through examples. Due to the lack of space, most of the proofs (see [3]) are omitted in this extended abstract.

2 Classical Differential Forms and Stokes’ Theorem

We start our analysis with the following version of Stokes’ theorem [8] Theorem 1. Let ω be a differential (k − 1)-form and K a k-surface in Rn with positively oriented boundary ∂K.Then, dω = ω, K ∂K where d is the exterior differential . In this statement, we suppose implicitly that ω is sufficiently differentiable and K sufficiently smooth. Moreover, a differential (k − 1)-form ω can be written in the standard form ∧···∧ ω = ωj1,...,jk−1 (x1,...,xn) dxj1 dxjk−1 1≤j1<···

∂f ∂f n ··· n where df (x1,...,x )= ∂x1 dx1 + + ∂xn dx . Making use of the general formulas dxj ∧ dxi = −dxi ∧ dxj , we obtain, ∧···∧ dω = (dω)i1,...,ik (x1,...,xn) dxi1 dxik , 1≤i1<···

where component (dω)i1 ,...,ik is the function of (x1,...,xn), given by k ∂ω − ν−1 i1,...,iν ,...,ik (dω)i1,...,ik = ( 1) , ∂xi ν=1 ν where iν means that index iν is omitted. One of the fundamental properties of the exterior differential operator is d2 = 0, meaning that for every differential form ω,wehaved(dω) = 0. We now recall some basic notions and facts about differential forms. A differential form ω satisfying dω = 0 is said to be closed. Moreover, if there exists another form η, such that ω = dη,thenwesaythatω is exact. The following result is immediate: If ω is exact then ω is closed. Poincar´e lemma states that, under some conditions, the converse is also true. In this work, the following version of Poincar´e lemma [8] will be sufficient: Lemma 1. Let ω be a k-form with k ≥ 1.Ifω is closed and defined on a starshaped open set of Rn,thenω is exact. Hence, ω = dη ⇐⇒ dω =0. In particular, if ω is defined everywhere on Rn then the notions of closedness and exactness coincide and no cohomology issues occur.

3 Discretization of Stokes’ Theorem

A first step in our discretization is to notice that K may have corners which can be seen as limiting cases of continuously differentiable round corners.This leads to consider the case where K is a k-dimensional hypercube in Rn.Inthis context, Mansfield and Hydon [4] have replaced differential forms ∧···∧ ωi1,...,ik (x1,...,xn) dxi1 dxik , 1≤i1<···

H =Pixi ,...,i (α ,...,αn) 1 k 1 xj = αj, if j ∈{i1,...,ik} = (x1,...,xn) , αj ≤ xj ≤ αj +1, if j ∈{i1,...,ik} 232 G. Labelle and A. Lacasse

n where (α1,...,αn) ∈ Z and {i1 < ···

Definition 1. The boundary ∂H of an hypercube H =Pixi1,...,ik (α1,...,αn) is the hypercubic configuration k ν−1 i ,...,i n − i n ∂H = ∂ Pix 1 k (α1,...,α )= ( 1) Δ ν Pixi1,...,iν ,...,ik (α1,...,α ). ν=1 More generally, by linearity, the boundary of an hypercubic configuration P = j njHj,nj ∈ Z is defined by ∂P = j nj∂Hj.

For example, let n = k =2andP =Pix1,2(1, 1) + Pix1,2(2, 1) + Pix1,2(1, 2), then, after simplifications,

∂P =Pix1(1, 1) + Pix1(2, 1) + Pix2(3, 1) − Pix1(2, 2) + Pix2(2, 2)

− Pix1(1, 3) − Pix2(1, 2) − Pix2(1, 1), which corresponds to Figure 1 (a). This figure can be reinterpreted as a conven- tional oriented path as in Figure 1 (b).

_ _ +_ _ + ++

(a) (b)

Fig. 1. Boundary: (a) linear combination of segments (b) oriented path

Since every differential k-form ω gives rise to a weight function w defined on hypercubes of dimension k by w(H)= H ω, this allows us to replace by weight functions on hypercubes in the following way. Discrete Versions of Stokes’ Theorem 233

Definition 2. An arbitrary w : Hk,n −→ R is called a weight function on k- dimensional hypercubes in Rn.

Note that such a weight function is equivalent to a family (wj1,...,jk )1≤j1<···

Δw =((Δw)i1 ,...,ik+1 )1≤i1<···

Definition 4. Let w be a weight function on hypercubes. We say that w is closed if Δw =0and exact if ∃ ρ such that w = Δρ. By linearity, we can extend w and Δw to hypercubic configurations. Theorem 2. (Discrete version of Stokes’ theorem) For every k-dimensional hy- percubic configuration P in Rn and every weight function w defined on (k − 1)- dimensional hypercubic configurations in Rn, (Δw)(P)=w(∂P).

As in [1,2,3], it is more useful to write (Δw)(P)intheformW (P), where W is a given weight function and P is an arbitrary hypercubic configuration. Then, the right member w(∂P) can be described as an algorithm to compute W (P) using another weight function w, applied to the boundary ∂P. By analogy with the finite difference calculus, we can use the suggestive notation w = ΣW.Then(Δw)(P)=w(∂P) can be rewritten as, W (P)=(ΣW)(∂P). (1) Before defining the exterior summation operator Σ we need to introduce the partial summation operator Σi: for i =1,...,n, Σi applied on a function f n produces a function Σif : Z −→ R defined by ⎧ αi−1 ⎨ i n i νi=0 f(α1,...,ν ,...,α ) if α > 0, Σif(α1,...,αn)= 0 if αi =0, ⎩ −1 − i n i νi=αi f(α1,...,ν ,...,α ) if α < 0. 234 G. Labelle and A. Lacasse

Lemma 2. The operators Δi and Σi are related as follows

ΔiΣi =id and ΣiΔi =id− evali,0, where evali,0 is the evaluation operator of the i-th component at the origin, de- fined by evali,0f(α1,...,αi,...,αn)=f(α1,...,0,...,αn). Moreover, if i = j, then Δj Σi = ΣiΔj. The vector space of weight functions on k-dimensional hypercubes in Rn is de- noted by Wk,n = {w|w : Hk,n −→ R}. We are now ready to define the exterior summation operator Σ.

Definition 5. The exterior finite summation operator Σ : Wk,n −→ Wk−1,n is defined by

(ΣW)j ,...,j (α ,...,αn) 1 k−1 1 ⎛ ⎞ − k−1 ⎝ ⎠ =( 1) ΣiWj1,...,jk−1,i(α1,...,αi, 0,...,0) .

jk−1

In order to have (1), we made the assumption that W was exact. In general, this condition is difficult to check. Fortunately, in our context of everywhere defined weight functions on hypercubes, exactness is equivalent to closedness, which is a much easier condition to check. This is precisely the content of the following discrete version of Poincar´e lemma. It is noteworthy that our proof is non inductive in contrast with the corresponding proof given in [4] in the context of difference forms.

Theorem 3. Let W be a weight function defined on hypercubes. Then W is closed if and only if W is exact.

Proof. Obviously, W = Δw =⇒ ΔW = Δ2w = 0. To establish the converse, we assume that ΔW = 0 and show that W is exact. It suffices to see that ΔΣW + ΣΔW = W, since, taking w = ΣW, we will find Δw = ΔΣW = ΔΣW +0=ΔΣW + Σ0=ΔΣW + ΣΔW = W . On one hand, we have,

(ΔΣW )i ,...,i (α ,...,αn) 1 k 1 ν−1 − i n = ( 1) Δ ν (ΣW)i1,...,iν ,...,ik (α1,...,α ) ≤ν≤k 1 ν−1+k−1 − i i i = ( 1) Δ ν Σ Wi1,...,iν ,...,ik,i(α1,...,α , 0,...,0) ≤ν≤k,i

= S + Δik Σik Wi1,...,ik (α1,...,αik , 0,...,0), say

= S + Wi1,...,ik (α1,...,αik , 0,...,0). Discrete Versions of Stokes’ Theorem 235

On the other hand,

(ΣΔW)i ,...,i (α ,...,αn) 1 k 1 k+ν−1 − i i i = ( 1) Σ Δ ν Wi1,...,iν ,...,ik,i(α1,...,α , 0,...,0) i

ik

Hence, using Lemma 2,

(ΔΣW )i ,...,i (α ,...,αn)+(ΣΔW)i ,...,i (α ,...,αn) 1 k 1 1 k 1

= Wi1 ,...,ik (α1,...,αik , 0,...,0) + ΣiΔiWi1,...,ik (α1,...,αi, 0,...,0)

ik

= Wi ,...,i (α ,...,αi , 0,...,0) 1 k 1 k − + (Wi1 ,...,ik (α1,...,αi, 0,...,0) Wi1 ,...,ik (α1,...,αi−1, 0,...,0))

ik

= Wi1 ,...,ik (α1,...,αn).

We have the following useful variant of discrete Stokes’ theorem. Theorem 4. (Variant of the discrete Stokes’ theorem) If W is closed, then for every hypercubic configuration P, we have W (P)=(ΣW)(∂P).

Note that the weight ΣW is only one of an infinite number of possible weights for the right-hand side of the equality in Theorem 4.

Corollary 1. Every weight function Λ : Hk−1,n −→ R satisfying

W (P)=Λ(∂P) is of the form Λ = ΣW + Θ, where Θ is an exact weight function, that is of the form Θ = ΔΩ, where Ω : Hk−2,n −→ R.

4 Examples and Applications

Theorem 4 gives rise to many applications for the reduction of the computation of a weight function on hypercubic configurations to the computation of another weight function on the boundary of the configurations. Our discrete version of Stokes’ theorem generalizes the classical one in the particular case of hypercubic configurations. Indeed, let ω be a (k − 1)- form in n R and define the weight function w : Hk−1,n −→ R by w(H)= H ω for any 236 G. Labelle and A. Lacasse

(k−1)-dimensional hypercube H. Then, it can be checked that Δw : Hk,n −→ R satisfies (Δw)(K)= K dω. Hence, (Δw)(K)=w(∂K)isequivalenttothe classical Stokes’ theorem for hypercubes. But when a weight function is not written in the form w(H)= H ω or have values in an arbitrary commutative ring, Theorems 2 and 4 can be directly applied using no integration.

4.1 The Special Case k = n

Consider an arbitrary weight function W ∈ Wn,n. Such a weight function is al- ways closed since it reduces to a single function W1,...,n defined on n-dimensional n hypercubes in R and ΔW is an empty sum. Writing Φ = W1,...,n, then without further hypotheses on Φ, Theorem 4 reduces to the following:

Proposition 2. Let Φ : Hn,n −→ R. Then for any n-dimensional hypercubic configuration P in Rn, we have Φ(P)=(ΣΦ)(ΔP).Explicitly,

(ΣΦ)j ,...,j (α ,...,αn) 1 n−1 1 n−1 (−1) ΣnΦ(α ,...,αn) if (j ,j ,...,jn− )=(1, 2,...,n− 1), = 1 1 2 1 0 otherwise.

Take n = 3 and consider, for example, the computation of the moment of inertia, I(P), relative to the x1-axis, of a 3-dimensional cubical configuration N P = k=1 Hk, which is a union of N distinct unit cubes each having mass 1. 2 2 Taking Φ(α1,α2,α3)=I(Pix123(α1,α2,α3)) = (α2 +1/2) +(α3 +1/2) +1/6, we find, using Proposition 2, that ΣΦ : H2,3 → R is given by

2 2 (ΣΦ)12(α1,α2,α3)=Σ3Φ(α1,α2,α3)=α3(α2 + α2 +1/3α3 +1/3), (ΣΦ)13(α1,α2,α3)=0, (ΣΦ)23(α1,α2,α3)=0.

Hence I(P)=(ΣΦ)(∂P). This is often much shorter to compute since the number of squares in ∂P is generally O(N 2/3) compared to the number N of cubes in P. The moment of inertia of P relative to any axis (oblique or not) can be computed in a similar way. For the center of gravity g(P)=(¯x1, x¯2, x¯3)ofthe 3 cubical configuration P, one can take the vector-valued function Φ : H3,3 → R , defined by

Φ(α1,α2,α3)=g(Pix123(α1,α2,α3)) = (α1 +1/2,α2 +1/2,α3 +1/2).

3 In this case, ΣΦ : H2,3 → R is given by

2 (ΣΦ)12(α1,α2,α3)=((α1 +1/2)α3, (α2 +1/2)α3, 1/2α3), (ΣΦ)13(α1,α2,α3)=0, (ΣΦ)23(α1,α2,α3)=0. and we have g(P)=1/N (ΣΦ)(∂P). For the special case k = n =2,takingΦ(P)= P f(x, y) dx dy and using the graphical convention of Figure 1, Proposition 2 generalizes the vertical algorithm Discrete Versions of Stokes’ Theorem 237

(V -algo) given in [1,2,3]: for a lattice polyomino P ⊆ R2 given by its contour (x0,y0), (x1,y1),...,(xn,yn)=(x0,y0),then f(x, y) dx dy = Φr(xi,yi)+ Φu(xi,yi)+ Φl(xi,yi)+ Φd(xi,yi), P → ↑ ← ↓ where functions Φr,Φu,Φl,Φd are given by : 1 1 Φr =0,Φd = f1(x, y + t) dt, Φl =0,Φu = − f1(x, y − t) dt, 0 0 x where f1(x, y)= f(u, y) du. By Corollary 1, the general form for Λ such that P f(x, y) dx dy = Λ(∂H), is given by Λ = ΣΦ + Θ,whereΣΦ is given (in the context of [1,2,3]) by the right-hand side of the above equation and Θ = ΔΩ, with an arbitrary Ω : H0,2 −→ R,thatis,Ω : Z × Z −→ R. Therefore, writing Ω = Ω(α1,α2), then Θ : H1,2 −→ R,where

1−1 Θ1 =(ΔΩ)1 =(−1) Δ1Ω(α1,α2)=Ω(α1 +1,α2) − Ω(α1,α2), 1−1 Θ2 =(ΔΩ)2 =(−1) Δ2Ω(α1,α2)=Ω(α1,α2 +1)− Ω(α1,α2).

This corresponds to Corollary 8 of [2] using the convention of Figure 1. For an example involving weight values in the ring Z[q1,...,qn], consider the weight α1 αn function Φ = W1,...,n,whereΦ(α1,...,αn)=q1 ...qn . Then, α − n−1 α1 n−1 (ΣΦ)1,...,n−1(α1,...,αn)=( 1) q1 ...qn−1 [αn]qn ,

α−1 where [α]q =1+q + ···+ q is the q-analogue of α. This generalizes the concept of q-area introduced in [1,2,3].

4.2 The Case k

We focus now on some specific families of weights in the context of Theorem 4 for k

Wi1 ,...,ik (α1,...,αn)=ci1,...,ik , depending only on the directions i1,...,ik of the hypercubes. The condition ΔW = 0 is satisfied and after some computations − k−1 (ΣW)j1,...,jk−1 (α1,...,αn)=( 1) cj1,...,jk−1,iαi.

jk−1

For example, if ci1,...,ik =1foralli1,...,ik (= volume of an hypercube), then W (P) is the signed volume of the hypercubic configuration P.Inotherwords, m m if P = i=1 niHi then W (P)= i=1 ni. We then obtain, − k−1 ··· (ΣW)j1,...,jk−1 (α1,...,αn)=( 1) (αjk−1+1 + + αn). 238 G. Labelle and A. Lacasse

This generalizes the H-algo for the area of a polyomino given in [1,2,3]. Consider now weights of the form

Wi1,...,ik (α1,...,αn)=f(α1,...,αn) depending only on the principal corner of the hypercubes. We have two cases to consider:

(i) If 0 ≤ k ≤ n − 2, then it can be shown that ΔW =0ifandonlyif ϕ(α1 + ···+ αn)ifk odd, f(α ,...,αn)= 1 a c if k even,

where ϕ : Z → R is an arbitrary function. It turns out that

(ΣW)j ,...,j (α ,...,αn) 1 k−1 1 ··· − ··· ≤ − F (α1 + + αn) F (α1 + + αjk−1 )ifk odd n 2, = · ··· ≤ − c (αjk−1+1 + + αn)ifk even n 2, where F (x)= x ϕ(x), 1 ≤ j1 < ···

n−1 α1 f(α1,...,αn)=(I + Δ2 − Δ3 + ···+(−1) Δn) Ψ(α2,...,αn),

where Ψ : Zn−1 → R is an arbitrary polynomial.

5 Concluding Remarks

The results of this paper can be used to study many other statistics about hypercubic configurations in relation to parameters associated to their boundary. This is particularly true when the weight functions are written in the form α αn i1,...,ik 1 ··· Wi1 ,...,ik (α1,...,αn)= cp1,...,pn , p1 pn p1,...,pn≥0 α αi αi where = α(α − 1) ...(α − p +1)/p!. Since Δi = ,wehave p pi pi−1

k+1 ⇐⇒ − ν−1 j1,...,jν ,...,jk+1 ΔW =0 ( 1) cp1,...,pjν +1,...,pn =0 ν=1 αi αi for every j < ···

j1,...,jk−1  where γ0,...,0 = 0 and for (p1,...,pn) =(0,...,0), (j1,...,jk−1) k−1 (j1,...,jk−1,i) γp ,...,p =(−1) c 1 n p1,...,pν0 −1,0,...,0 jk−1

Acknowledgements. The authors wish to thank the anonymous referees for the careful reading of the paper and their valuable comments.

References

1. Brlek, S., Labelle, G., Lacasse, A.: Incremental algorithms based on discrete Green theorem. In: Nystr¨om, I., Sanniti di Baja, G., Svensson, S. (eds.) DGCI 2003. LNCS, vol. 2886, pp. 277–287. Springer, Heidelberg (2003) 2. Brlek, S., Labelle, G., Lacasse, A.: The discrete Green theorem and some applica- tions in discrete geometry. Theoret. Comput. Sci. 346(2), 200–225 (2005) 3. Lacasse, A.: Contributions `a l’analyse de figures discr`etes en dimension quelconque. PhD thesis, Universit´eduQu´ebecaMontr´ ` eal (September 2008) 4. Mansfield, E.L., Hydon, P.E.: Difference forms. Found. Comp. Math. (2007), http://personal.maths.surrey.ac.uk/st/P.Hydon/ 5. Desbrun, M., Kanso, E., Tong, Y.: Discrete differential forms for computa- tional modeling. In: Discrete differential geometry. Oberwolfach Semin, vol. 38, pp. 287–324. Birkh¨auser, Basel (2008) 6. Kaczynski, T., Mischaikow, K., Mrozek, M.: Computing homology. Homology Ho- motopy Appl 5(2), 233–256 (2003); (electronic) Algebraic topological methods in computer science (Stanford, CA, 2001) 7. Gonz´alez-D´ıaz, R., Real, P.: On the cohomology of 3D digital images. Discrete Appl. Math. 147(2-3), 245–263 (2005) 8. Spivak, M.: Calculus on manifolds. A modern approach to classical theorems of advanced calculus. W. A. Benjamin, Inc., New York (1965)