Abstract
We extend the notion of bargraphs as first quadrant, semi-perimeter defined lattice paths to that of a bargraph prefix where we relax the bargraph defining parameters and allow the bargraph to extend into negative territory. A bargraph prefix is any initial section of a bargraph. Generating functions for the prefixes which separately track the number of up, down and horizontal steps are found. The asymptotics for the average height of the last prefix step in the different bargraph extensions is given.
Similar content being viewed by others
Avoid common mistakes on your manuscript.
1 Introduction
By definition, a bargraph is a non-intersecting lattice path in \(\mathbb {N}_0^2\) with three allowable steps: up (0, 1), down \((0,-1)\) and horizontal (1, 0). An up step may not immediately follow a down step nor vice versa. A bargraph starts at the origin with an up step and terminates immediately upon return to the x-axis. We consider bargraphs defined by semi-perimeter. The well-known generating function B(x, y) for these is given by
where y tracks the number of up steps and x tracks the number of horizontal steps. See for example [2, 4]. Replacing both x and y by z in this generating function results in z then tracking the semi-perimeter. The focus, however, of this paper is to provide generating functions for the prefixes of such bargraphs and their various extensions. A bargraph prefix follows all rules for bargraphs except that it is allowed to terminate at any height before the path reaches height 0. Prefix generating functions for various types of lattice paths have been recently studied in various papers by Prodinger and other authors, for example, see [1, 9,10,11,12,13]. As originally defined, bargraphs only end on a first return (with a down step) to the x-axis. Prefixes, however may end at any height and with any of the possible steps. So our first bargraph extension is Sect. 2, which studies prefixes that end in any of the three allowed steps according to semi-perimeter as defined for the original bargraphs. We refine this in Sect. 4 where we track all the up, down and horizontal steps separately in the generating functions. In the original bargraph definition the number of up steps is the same as the number of down steps but this is no longer true for prefixes. The final natural extension is studied in Sect. 5, where the bargraph definition is extended to allow bargraphs to go into negative territory. Asymptotics (as the lengths of the paths tend to infinity), for the number of paths as well as the average end height are studied in Sects. 3, 4.1 and 5.1.
2 Bargraph prefixes that end in each of the three allowed steps
Let the generating function for bargraph prefixes that end at height i and where the last step is respectively an up, horizontal or down step be given respectively by \(f_i\), \(h_i\) and \(g_i\). Each of these generating functions track the number of up and horizontal steps in the prefix by z. In line with the definition of semi-perimeter, the number of down steps is not tracked in this section. To begin we write down a system of equations that expresses each of \(f_i\), \(h_i\) and \(g_i\) in terms of these same functions but where the latter are expressed in terms of the second last step. According to the definition of a bargraph an up step followed by a down step or vice-versa is disallowed. Therefore our equations for \(f_i\) and \(g_i\) do not depend in the last step on a different level version of each other. Hence we obtain for \(i\ge 1\):
And for \(i\ge 1\)
And for \(i\ge 0\)
Note that \(h_0(z)=0\), since horizontal steps on the x-axis are forbidden.
Next, we define bivariate generating functions:
in which u tracks the height of the endpoint of the final step.
Summing the recursions for \(i\ge 0\), we obtain
So
and
Solving these equations simultaneously, we obtain the following solutions:
and
Factorizing these denominators we obtain
where
Cross multiplying Eq. (6) by the denominator on the right hand side and then setting \(u=u_0\), we can then solve for G(z, 0) to obtain
This is the generating function for bargraphs of semi perimeter n since a path ends with a down step at height zero only at the end of a complete bargraph path.
Next, we eliminate G(z, 0) from Eqs. (5), (6) and (7) by substituting Eq. (9) into these. Putting \(X=1-4 z+2 z^2+z^4\) we obtain:
Following the kernel method as explained by Prodinger in [8], we see that the “bad” factor \((u-u_0)\rightarrow 0\) in the denominator as \(z, u\rightarrow 0\). But the full expansions in Eqs. (10), (11) and (12) must converge and have a series expansion around \((z,u)=(0,0)\). This is the essence of the kernel method and implies that the bad factor is an exact factor of the numerator (i.e., divides into the numerator without remainder). So, we divide the bad factor from the numerator to obtain
and
Now adding together Eqs. (13), (14) and (15) we obtain the prefix generating function \(S(z,u):=F(z,u)+G(z,u)+H(z,u)\) given by
We can also extract the coefficient of \(u^j\) in S(z, u)
which gives the number of bargraph prefixes ending at height j. From this we find, for example, that
and
where X is as before.
If we do not specify the end of the paths, in other words we sum over all \(j\ge 0\), then at the level of generating functions this is very easy, since we only have to set \(u:= 1\) in S(u). We find
This has the series expansion
For example, the bold term represents the seven possible paths, each with a total of 3 up or horizontal steps:
where \(\text {u}\), \(\text {h}\) and \(\text {d}\) respectively represent up, horizontal and down steps. As stated at the outset of this section, the length of the path is the number of up and horizontal steps only. The above series is not in OEIS, [14].
3 Asymptotics for average end height of bargraph prefixes
From Eq. (1), the generating function that counts all bargraphs is given by
where z counts the number of up and horizontal steps, i.e., the semi-perimeter, (see, for example, [6, 7]).
The asymptotics of the coefficient of \(z^n\) in B(z, z) was considered in [3], and in order to compute it, the dominant singularity \(\rho \) is the positive root of \(1-4z+2z^2+z^4=0\). By singularity analysis (for example, see Chapter 6 in [5]), we have
with
Similarly, we have
Next, we do the asymptotics for the sum of the end heights of bargraph prefixes. This is given by
Now
Dividing Eqs. (23) by (21) we obtain
Theorem 1
The average end height of a bargraph prefix tends to
as \(n \rightarrow \infty \).
4 Tracking horizontal and down steps in bargraph prefixes
Unlike bargraphs, which must end on the x-axis, prefixes may end at any positive height and this implies that the numbers of up and down steps are not equal. Hence we want to track these variables separately. We use an approach similar to that in Sect. 2 where now variable y tracks the number of up steps, v tracks the number of horizontal steps and w tracks the number of down steps. Later we will set \(y=v=w=z\) and thus measure prefixes by the total length, unlike in Sect. 2.
As before we let \(f_i:=f_i(y,v,w)\), \(h_i:=h_i(y,v,w)\) and \(g_i:=g_i(y,v,w)\) be the generating functions for prefixes ending at height i with the last step being respectively an up, horizontal or down step. Also, as before the bargraph definition requires that it begins at the origin with an up step. We obtain the following generating functions: For \(i\ge 1\)
And for \(i\ge 1\)
And for \(i\ge 0\)
Next, we define multivariate generating functions:
in which u tracks the height of the endpoint of the final step. Note that for brevity we have suppressed the variables y, v, w when we use any of F(u), G(u) and H(u).
Summing the recursions for \(i\ge 0\), we obtain
So
and
Solving these equations simultaneously, we obtain the following solutions:
and
Factorizing these denominators we obtain
where
Cross multiplying Eq. (28) by the denominator on the right hand side and then setting \(u=u_0\), we can then solve for G(0) to obtain
Putting \(w=1\) and \(v=y=z\) we obtain the semi-perimeter generating function in Eq. (18) as expected.
Next, we eliminate G(0) from Eqs. (27), (28) and (29) by substituting Eq. (31) into these. Putting \(X=-4 w y+(1+w y+v (-1+w y))^2\) we obtain:
and
We define \(S(u):=F(u)+G(u)+H(u)\) and obtain
Using the kernel method on S(u), the “bad factor” \(u-u_0\) in the denominator divides exactly into the numerator (i.e., without remainder) to give:
We now extract the coefficient \(s_j:=[u^j]S(u)\):
which gives the number of bargraph prefixes ending at height j. From this we find, for example, that
and
where \(X=-4 w y+(1+w y+v (-1+w y))^2\) as before.
Next, we set y, w and v equal to z and thus obtain the generating function for bargraph prefixes ending at heights 0, 1 and 2 where we track the total length by z:
with series beginning
which is sequence A004149 in [14]. Also by removing the last down step in the path which ends at height 0, we see that \(s_0=1-z^2+z s_1\) and therefore
Next,
The coefficient sequence for \(s_2\) is not in OEIS [14].
If we do not specify the end of the paths, in other words we sum over all \(j\ge 0\), then at the level of generating functions, we only have to set \(u:= 1\) in Eq. (36), (as well as \(y=w=v=z\)). We find
This has the series expansion
For example, the bold term represents the ten possible paths, each with a total of 4 allowed steps of types up, horizontal and down:
The sequence is not in OEIS [14].
4.1 Asymptotics for \(s_0\) and S(1)
We note that \(-1+\sqrt{2}\) is the dominant singularity in Eqs. (38) and (39). From the generating function for \(s_0\) given in (38), we find using singularity analysis (see [5]) that
and from the generating function for S(1) in Eq. (39), we find that
as \(n\rightarrow \infty .\)
Next, we repeat the asymptotics for the sum of the end heights of bargraph prefixes, this time counting down steps as part of the path length. This is given by the derivative of Eq. (36) evaluated at \(u=1\):
Now
Dividing Eqs. (42) by (40) we obtain
Theorem 2
The average end height of a bargraph prefix (measured by total length) is asymptotic to
as \(n \rightarrow \infty \).
5 Bargraphs that can go into negative territory
These are non-intersecting lattice paths which consist of up (0, 1), down \((0,-1)\) or horizontal (1, 0) steps which end on the x-axis with any of these steps and which may begin at the origin with any of these steps. Let the generating function for such bargraph prefixes that end at height i and where the last step is respectively an up, horizontal or down step be given respectively by \(f_i\), \(h_i\) and \(g_i\). Each of these generating functions track the number of up, horizontal and down steps in the prefix by z. From these definitions we deduce the following equations:
For all integers i
and
where the Iverson brackets above represent the required initial conditions ensuring that the prefixes can start at the origin with any of the three allowed steps.
Note that by symmetry if \(i\ge 0\),
For this reason, we only consider the bivariate generating functions defined below for non-negative ending heights i.
Multiplying the f, g, h equations by \(u^i\) and summing for \(i\ge 0\), we obtain
and
By symmetry, \(f_0(z)=g_0(z)\). Also note that \(F(z,0)=f_0(z); \ G(z,0)=g_0(z); \ H(z,0)=h_0(z). \) Henceforth, we will use the following abbreviations \(F(0)=F(z,0); \ G(0)=G(z,0); \ H(0)=H(z,0). \)
Simultaneously solving Eqs. (46), (47) and (48), we obtain
and
The kernel or denominator of these equations factorises as
where
and
Using the kernel method, the “bad factor” \(u-r_1\) in the denominator divides exactly into the numerator (i.e., without remainder) to give:
and
Now we may substitute \(u=0\) into Eqs. (55) and (57) to obtain
and
Solving these simultaneously gives
and
Note that by definition H(0) is the generating function for the lattice paths under consideration which end on the x-axis with a horizontal step. Removing this end step means that we have a generating function for such lattice paths that end on the x-axis with any of the allowed steps, i.e., the generating function \(F(0)+ G(0)+H(0)-1\). The term \(-1\) arises here, because the initial conditions reflected by the Iverson brackets in Eqs. (43) and (45) enables us to start with either an up or a down step but we don’t wish this to be duplicated in the combined generating function. Thus we have
The series obtained from this is A136029 in OEIS [14] and is described equivalently as the number of one-sided n-step prudent walks, starting from (0,0) and ending on the y-axis, with east, west and north steps.
Next we obtain the generating functions F(z, u), G(z, u) and H(z, u) for all such lattice paths that may end at any positive height, tracked by the variable u. We do this by substituting Eqs. (58) and (61) into Eqs. (55), (56) and (57). We obtain
where
For the rest of this section, Y will be used as this abbreviation. Also
and
Eventually, from \(S(z,u):=F(z,u)+G(z,u)+H(z,u)-1\) we obtain the bivariate prefix generating function for all such lattice paths ending at non-negative height tracked by u. This is
Now setting \(u=1\), we obtain the univariate prefix generating function abbreviated as \(S(1):=S(z,1)\) for all such lattice paths ending at non-negative height. We call these paths generalised bargraph prefixes. The generating function for these is:
The series expansion for this begins as
By symmetry the generating function for paths ending at any positive or negative height is \(2S(1)-S(0)\). This gives the generating function
which is A001333 in [14] and has an equivalent description as the number of n step non-self-intersecting paths starting at (0, 0) with steps of types (1, 0), \((-1, 0)\) or (0, 1).
We can also extract the coefficient of \(u^j\) for \(j\ge 1\) in S(z, u):
which gives the number of such lattice path prefixes ending at height j. From this we find, for example, that
which has a series which begins as
Also
which has a series which begins as
The series expansions of Eqs. (67), (71) and (72) which are explicitly given above are not currently found in [14].
5.1 Asymptotics for S(0), S(1) and G(z)
Once again \(-1+\sqrt{2}\) is the dominant singularity from Eqs. (62), (67) and (69). By singularity analysis, from the generating function for \(S(0)-1\) given in (62), we find that as \(n \rightarrow \infty \),
Similarly from Eqs. (67) and (69), we obtain
as \(n \rightarrow \infty \).
By symmetry, the expected end height for paths counted by G(z) is zero. It remains to determine the average end height of non-negative paths as counted by S(1) in Eq. (67).
For the total end height we require the derivative of Eq. (66) evaluated at \(u=1\):
Again by singularity analysis,
Dividing Eq. (76) by half of the right hand side of Eq. (74) we obtain
Theorem 3
The average end height of generalised bargraph prefixes (measured by total length) is asymptotic to
as \(n \rightarrow \infty \).
Data Availability Statement
The authors allow any data contained in this file to be freely available.
References
Baril, J.L., Ramirez, J. L., Simbaqueba, L.: Counting prefixes of skew Dyck paths, J. Integer Sequ., 24, Article 21.9 (2021)
Blecher, A., Brennan, C., Knopfmacher, A.: Combinatorial parameters in bargraphs. Quaest. Math. 39, 619–635 (2016)
Bousquet-Mélou, M., Rechnitzer, A.: The site perimeter of bargraphs. Adv. Appl. Math. 31, 86–112 (2003)
Deutsch, E., Elizalde, S.: Statistics on bargraphs viewed as cornerless Motzkin paths. Discret. Appl. Math. 221, 54–66 (2017)
Flajolet, P., Sedgewick, R.: Analytic Combinatorics. Cambridge University Press, Cambridge (2009)
Owczarek, A., Prellberg, T.: Exact solution of the discrete (1+1)-dimensional SOS model with field and surface interactions. J. Stat. Phys. 70(5/6), 1175–1194 (1993)
Prellberg, T., Brak, R.: Critical exponents from nonlinear functional equations for partially directed cluster models. J. Stat. Phys. 78, 701–730 (1995)
Prodinger, H.: The Kernel Method: A Collection of Examples, S’eminaire Lotharingien de Combinatoire, 50, 19 pp (2004)
Prodinger, H.: Skew Dyck paths having no peak at level 1. J. Integer Seq., 25, Article 22.1.6 (2022)
Prodinger, H.: Skew Dyck paths with catastrophes. Discrete Math. Lett. 10, 9–13 (2022)
Prodinger, H.: Partial Dyck paths with air pockets. Integers, A94 (2022)
Prodinger, H.: Partial Skew Motzkin Paths. Preprint (2022)
Prodinger, H.: Partial skew Dyck paths—a kernel method approach. Graphs Combin. 38, 135 (2022)
Sloane, N.: The On-line Encyclopedia of Integer Sequences
Funding
Open access funding provided by University of the Witwatersrand. The authors declare that no funds, grants, or other support were received during the preparation of this manuscript.
Author information
Authors and Affiliations
Contributions
Blecher and Knopfmacher wrote the main manuscript text. Both authors reviewed the manuscript.
Corresponding author
Ethics declarations
Conflict of interest
The authors have no relevant financial or non-financial interests to disclose.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Blecher, A., Knopfmacher, A. Prefixes of bargraph paths. Aequat. Math. (2023). https://doi.org/10.1007/s00010-023-01002-8
Received:
Revised:
Accepted:
Published:
DOI: https://doi.org/10.1007/s00010-023-01002-8