Probabilistic Analysis of Carlitz Compositions

Using generating functions and limit theorems, we obtain a stochastic description of Carlitz compositions of large integer n (i.e. compositions two successive parts of which are different). We analyze: the number M of parts, the number of compositions T(m,n) with m parts, the distribution of the last part size, the correlation between two successive parts, leading to a Markov chain. We describe also the associated processes and the limiting trajectories, the width and thickness of a composition. We finally present a typical simulation. The limiting processes are characterized by Brownian Motion and some discrete distributions.


Introduction
A Carlitz composition of n is a composition two successive parts of which are different (see Carlitz [6]).T (m, n) will denote the number of Carlitz compositions of n with m parts.All T (•, n) compositions will be considered as equiprobable.We call M the random variable (R.V.): number of parts.In [18], Knopfmacher and Prodinger found asymptotic values for: T (•, n), the mean number of parts E[M], the number of general compositions with exactly m equal adjacent parts, the mean of equal adjacent parts number, the mean of the largest part.They also analyze Carlitz composition with zeros and with some restrictions.Carlitz compositions can also be studied using Smirnov words; see [10] and [18].
In [19], [20], and [21], Louchard analyzes some polyominoes (or animals) such as: directed columnconvex animals, column-convex animals and directed diagonally convex animals.He obtained asymptotic distributions for M and for the size of columns.He also derived limiting processes for typical trajectories and shapes.Related material can be found in [3].
In the present paper, we consider Carlitz compositions as particular polyominoes and obtain a stochastic description of their behaviour for large n.We analyze the number M of parts, the number of composition T (m, n) with m parts, the distribution of the last part size, the correlation between two successive parts, leading to a Markov chain.We consider also the associated processes and the limiting trajectories and shapes (which show a "filament silhouette"), the width and the thickness (part size) of a composition.We present an algorithm for efficient large Carlitz composition simulation.
We use such tools as asymptotic analysis of generating functions (based on their singularities) leading to central limit, local limit and large deviation theorems.The limiting processes are characterized by Brownian Motion, the extreme value-distribution and some discrete distributions.
Our results can be summarized as follows: the number M of parts and T (m, n) are analyzed in Theorems 2.1, 2.2, 2.3.The distribution of the last part size is given in Theorem 2.4.The distribution of intermediate part size and the correlation between two successive parts are considered in Theorems 2.5, 2.6 (including the Markov chain description).The associated processes are discussed in Theorems 2.7, 2.8, 2.9.The simulation algorithm is given in Sec.3.1 and the thickness is considered in Theorem 3.1, 3.2, and 3.3.
The paper is organized as follows: Section 2 gives the probabilistic analysis of Carlitz compositions, Section 3 analyzes the simulation algorithm and the composition thickness, Section 4 concludes the paper.An Appendix provides some identities we need in the paper.Several notations will appear in the sequel.Let us summarize some of them: • " D ∼" means "convergence in distribution." • N (µ,V ) is the Normal (or Gaussian) random variable with mean µ and variance V .
• T (m, n) is the number of Carlitz compositions of n with m parts.
• "Vertical distribution" means "Expression for T (m, n) for given number of parts m." • "Horizontal distribution" means "distribution of the number of parts M for given n." • ⇒ n→∞ : weak convergence of random functions in the space of all right continuous functions having left limits with values in R 2 and endowed with the Skorohod metric d 0 (see Billingsley [4] Chap.III).

Probabilistic analysis of Carlitz Compositions
In this section, we first analyze the number M of parts.Then we obtain the distribution of the last part size (LP).Next we compute the correlation between two successive intermediate parts, leading to a Markov chain.Finally, we consider the associated processes and limiting trajectories.

Number of parts
Let T (m, n) be the number of Carlitz Compositions (CC) of n with m parts and let f m (i, n) be the number of CC with the same characteristics and last part of size i.We shall mark n by z, m by w and i by θ.The corresponding generating functions (GF) satisfy (The first part can be of any size.)Hence φ(w, θ, z) Iterating, this leads to where Notice that 1 where h(w, z) := 1 − A 1 (w, 1, z).This generating function was already known to Carlitz [6].
First set θ = 1.When w = 1 we get the GF of the total number this is given by D 1 (1, z).The dominant singularity of D 1 is given by the root z * (with smallest module) of h(1, z), i.e. z * = •571349793158088 . . .h(1, z) is analytic for |z| < 1.To be sure that z * is the dominant singularity, we use the principle of the argument of Henrici [11]: the number of solutions of the equation f (z) = 0 that lie inside a simple closed curve Γ, with f (z) analytic inside and on Γ, is equal to the variation of the argument of f (z) along Γ, a quantity also equal to the winding number of the transformed curve f (Γ) around the origin.The argument was used in Flajolet and Prodinger [8] in a similar situation.Figure 1 represents [ℜ(h), ℑ(h)] for z = .60exp(it), t = 0..2π, where h is converted into a series up to O(z 60 ).The winding number is 1, so that h has only one root z * for |z| < .60.

By singularity analysis, T (•, n) is asymptotically given by
with means differentiation w.r.t.z and similarly for w).Indeed A 1 (1, 1, z * ) ≡ 1.For w ∈ [0, 1], h is analytic for |z| < 1 and for w ∈ [1, ∞], h is analytic for |z| < 1/w.Let us remark that the numerical computation of h is delicate: this is an alternating series.So it is better to use (A1).This leads to The same technique has been used for A 1 (w, θ, z) and h w , h z .Let us return to our asymptotic analysis.By Bender's Theorems 1,3 and (3.2) in [2] we can get more: we obtain the asymptotic distribution of the number of parts M in CC(n), where we consider all possible T (•, n) as equiprobable.Let Setting w = 1, z = z * , we derive Then Bender's results lead to the following theorem.

Theorem 2.1 (Horizontal Distribution in CC(n)). The number M of parts in a CC(n) of large given n is asymptotically Gaussian
Also a local limit theorem holds: Remark.C 1 and µ 1 are already given in Knopfmacher and Prodinger [18].
For n = 30, Figure 2 gives the observed normalized distribution of M (observed = circle, asymptotic = line), extracted from [z 30 ]D 1 .There is an obvious bias: this will be explained later in Section 2.2.Now if we fix m and consider n as variable (there are, of course, an infinite number of CC for given m), we can obtain another asymptotic form for T (m, n): the conditioned distribution is given by we obtain the following theorem.

Theorem 2.2 (Vertical Distribution in CC(n)). For large given number of parts m, T (m, n) is asymptotically given by
For further use, we have also computed C 2 ( j) based on a first part of fixed size j.We first derive (conditioning on j): where and A 1 is given by (2).
This leads to Note that, by (A1), ∑ j C 2 ( j) = C 2 , as it should.Theorem 2.3 is still valid.
Bender's theorems are based on the analysis of ϕ(w) = [ r(1) r(w) ] n where r(w) is the root of (3), seen as a z-equation, and r(1) = z * .But r(1)/r(w) is usually not a Probability GF (PGF).Indeed, we obtain 1 Similarly, we could consider t(z), the root of (3) (seen as a w-equation), with t(z * ) = 1, and analyze 1 t(z * z) .But we can't even construct a series in z.
It is possible to derive a large deviation result for the number of parts, using r(w).
Following Bender [2] Theorem 3, we first set w = e s .We have where, here, h w = h w (w, r(w)), etc. Bender leads to the following large deviation result: The following asymptotic relation holds: The range of validity of Theorem 2.3 can be established as follows.First, we must consider the contour of h(w, z) = 0.After detailed analysis, it appears that this contour h(w, z) = 0 is made of 2 parts: see Figure 3.
Part II, for w ∈ [1, w 1 ), z ∈ (1/w 1 , z * ] and w 1 is the limit of the solution of h[w, 1 w − ε] = 0, ε → 0. The computation of w 1 offers no special numerical problem and leads to (we must only be careful with the precision: 20 digits are enough in the range we use).µ(w 1 ) and σ 2 (w 1 ) are given by µ(w The function µ(w) is increasing from 0 to µ(w 1 ), σ 2 (w) goes from 0 (for w = 0) to some maximum and then decreases to σ 2 (w 1 ).So finally, the range for µ is given by (0, µ(w 1 )), z = r(w) following the contour defined above.
The verification of condition (V) of Bender's Theorem 3 (which allows to go from a central limit theorem to a local limit theorem) amounts to prove that h(e s , z) is analytic and bounded for for some ε > 0, δ > 0, where r(s) is the suitable solution of h(e s , r(s)) = 0 (i.e. with r(0) = z * ): this follows from the analyticity analysis of h in the beginning of this section.

Distribution of the last part size in CC
We want to analyze the asymptotic distribution of the size LP of the last part of a CC(n).Setting w = 1 in (1), we derive , n → ∞, uniformly for θ in some complex neighbourhood of the origin.This may be checked by the method of singularity analysis of Flajolet and Odlyzko, as used in Flajolet and Soria [9] or Hwang [13].Normalizing by the total number of CC(n) (4) this leads to the following asymptotic (n → ∞) PGF for the last part size LP: Expanding, this leads to For n = 12, we have computed the observed normalized distribution of LP corresponding to This gives the following Figure 4 (observed = circle, asymptotic = line).The agreement is quite good.
We can now obtain more information from (1).The asymptotic distribution of the last part size in CC(n) of m parts is related to [w m z n ]φ(w, θ, z) and Bender's Theorems 1 and 3 lead to the GF: , uniformly for θ in some complex neighbourhood of the origin.Again the uniformity can be checked by following Bender's analysis.Normalizing by T (m, n) (see Theorem 2.1), this gives again G(θ).So we have proved the following result: , the asymptotic distribution of the size LP of the last part in CC(n) with m parts is given by π 1 ( j) = z * j /(1 + z * j ) for n → ∞ uniformly for all j.
Figure 5 shows that the fit is quite good near the mean, but there is a bias for the two other values of m: n is not yet large enough to yield a distribution of LP that is nearly independent of m Returning to the proof of Bender's theorem, we must compute from (1) i.e.
But it is easy to check that ϕ 1,w (1, 1) = 0 and From now on, we set 1 (n = 30).This gives Figure 6, where the fit is now nearly perfect.We have, conditioning on j,

Correlation between two successive intermediate parts
With Theorem 2.4 (vertical form) and Theorem 2.2 [Eq.7], this leads, after normalization by T (m, n), to the following distribution: and with (A1) we readily obtain the following distribution π 2 (k) for k: For further use, we compute, for ≥ k By (A2), we obtain ∑ ∞ 1 π 2 (k) = 1 and by (A3), ∑ kπ 2 (k) = µ 2 as it should.So we obtain the following theorem.
But we can get more from (8), which shows that the asymptotic joint distribution (in stationary distribution) of two successive intermediate part sizes k and j is given by Normalizing by π 2 (k), this leads to the following Markov chain related to two successive intermediate parts: The chain is irreducible, recurrent positive and reversible.Of course the stationary distribution of Π is given by π 2 (k).Therefore, we obtain the following theorem.

Theorem 2.6 The asymptotic, n → ∞, distribution of two successive intermediate parts in a CC (n) is
given by a Markov chain Π(i, j), with stationary distribution π 2 (k), and with mean µ 2 .
Let us now analyze the asymptotic behaviour of Π(i, j).This will be used in Sec.3.2.For fixed , we obtain For further use, we set

Associated processes and limiting trajectories
Let us now turn to trajectories.Let x i be the size of part i and set X( j) := ∑ j 1 x i .We have E[X(m)] ∼ mµ 2 and we must check that VAR[X(m)] ∼ mσ 2  2 as given by (5).We first derive mσ 2 But it is easily checked that S 3 := ∑ ∞ 1 C x k can be written as With (6), this can be simplified as This leads to (we set w = 1 − ε) where φ6 := 1 So the singularity in ( 12) is removed.Similarly, we obtain and finally by (A4) as expected.
We can now apply the Functional Central Limit Theorem (for dependent R.V.) (see for instance Billingsley [4, p. 168 ff.]) and we obtain the following result, where B(t) is the standard Brownian Motion (BM).
where N := number of parts of CC(n).
Let us now condition on X(m) = n.A realization of X for fixed n is given by Theorem 2.7, where we stop at a random time m such that X(m) = n.Proceeding as in [19] it is easy to check that this amounts to fix N = n/µ 2 in Theorem 2.7 (denominator) and we obtain the following result.

Theorem 2.8 Conditioned on X
Let us now consider the oscillations of X(•) around its mean.Let us define the lower oscillation bound W − n and the range W n : where m is the number of parts in CC(n).
But now the lower bound W − n , normalized by n/µ 2 σ 2 , is asymptotically given by inf B(t).The densities of these R.V. are well known: the first one is given by the second one is given by where by Jacobi θ-relations (see e.g.Whittaker and Watson [22].This immediately leads to the following result Theorem 2.9 For large n, and with In summary, we can see the CC as a B.M. with some thickness (part size).The distribution of the thickness is characterized by Theorem 2.6.

Simulations and thickness
In this section, we present an algorithm for CC(n) simulation, then we analyze the CC thickness maximum.

Realizations
A simulated realization of a CC(n) proceeds as follows. 2 Start with a part of size j at time i = 1 given by π 1 ( j).Proceed from a part of size k at time i − 1 to a part of size j at time i by using a Markov chain defined by the probability matrix Π(k, j) given by (10).Stop the chain as soon as S := ∑ m i=1 j i > n.For n = 10.000, a typical unnormalized trajectory for X(i) is given in Figure 7, which shows a "filament silhouette."A typical normalized trajectory for N , showing the thickness (here the thickness is defined by the size of the parts) is given in Figure 8.Of course, both trajectories are asymptotically equivalent for n → ∞.A zoom on i = [1030..1050] is given in Figure 9.

Hitting times and maximum for CC thickness
Let us call thickness the part size.In this section, we derive the thickness hitting times (to high level) asymptotic distribution.This leads to a maximum asymptotic density.We consider the set x i of R.V. describing the thickness of CC.Let us define the set D := [k..∞), k >> 1.By (11), we see that the probability transition to D is O(ε),ε = z * k and by standard properties (see Keilson [16], Aldous [1]) we know that the hitting time to D is such that (we drop k for ease of notation): • We should write C 3 ( ) but we will soon check that C 3 is independent of .To compute C 3 and ψ( ), we use the classical relation: i.e.
and ϕ 3 is given by (11).Eq. ( 14) leads to (This is equivalent to a formula of Kac, see [15]).Therefore, we obtain 2 are given by ( 9)).Comparison of powers of ε in (15) leads to [I − Π]C 3 = 0, which confirms that C 3 is independent of .We derive We must have π 2 δ = 0, therefore (This is of course equivalent to (16).) We denote by M 1 the Drazin inverse of I − Π.We refer to Campbell and Meyer [5] for a detailed definition and analysis of the Drazin inverse.We have where n is the potential used in Kemeny, Snell and Knapp [17].The solution of ( 18) is given by ψ = M 1 δ + π 2 ψ.
To fix C 6 := π 2 ψ, we first derive and with (17), We can summarize our results in the following form.

Theorem 3.1 The thickness hitting time E [T
Now let M (t) := sup i∈ [1..t] x i (maximum thickness with t parts).We know that So, by standard asymptotic analysis, Set now k := j + 1 and By Theorem 2.1, we know that t = nµ 1 + O( √ n ) and µ 1 = h w /(h z z * ).
Hence, we derive the following theorem (we use now the notation M (n)).Then, with integer j and η = O(1), , Asymptotically, the distribution is a periodic function of ψ 1 (n) (with period 1), which can be written as .
We also have where f 1 (η) := G 1 (η) − G 1 (η − 1).The asymptotic moments of M (n) are also periodic functions of ψ 1 (n).They can be written as Harmonic sums which are usually analyzed with Mellin transforms: see Flajolet et al [7].The asymptotic non-periodic term in the moments of M (n) is given by the following result.

Theorem 3.3
The constant term Ē in the Fourier expansion (in ψ 1 (n)) of the moments of M (n) is asymptotically given by It is well known that the extreme-value distribution function e −e −x has mean γ and variance π 2 /6.From this, we can for instance derive The other periodic terms have very small amplitude (see Flajolet et al [7]).
For n = 10.000,we have simulated 2.000 trajectories.The observed distribution for maximum thickness is given in Figure 10.
The observed and limiting distribution function (DF) are given in Figure 11 (observed = circle, asymptotic = line).The limiting DF is given by G 1 [ j − ψ 1 (n)] and, due to the sensitivity of G 1 to the mean, we have taken ψ 1 (n) = M0 (n) −

Conclusion
Using some generating functions and limit convergence theorems, we have obtained a complete stochastic description of Carlitz compositions.The same techniques could be used for some generalizations such as Carlitz compositions with zeros and with some restrictions.In a recent paper by Hitczenko and Louchard [12], the distinctness of classical and Carlitz compositions has been fully analyzed.Identification of σ 2 2 and σ 2 X is now immediate.2