Chapter 1

Backgrounds

In this introductory section we review theoretical concepts about the Riordan group that will be useful in subsequent chapters; additionally, we provide a very short introduction to symbolic computation using the sympy module implemented using the Python programming language, giving a taste of our programming style.

1.1Riordan Arrays, formally

A Riordan array is an infinite lower triangular array (dn,k)n,k∈ℕ(d_{n,k})_{n,k \in \mathbb{N}}, defined by a pair of formal power series (d(t),h(t))(d(t),h(t)) such that d(0)≠0d(0)\neq 0, h(0)=0h(0)=0 and h′(0)≠0h^\prime(0)\neq 0; furthermore, each element

dn,k=[tn]d(t)h(t)k,n,k≥0, d_{n,k}=[t^n]d(t)h(t)^k, \qquad n,k \geq 0,

is the coefficient of monomial tnt^{n} in the series expansion of d(t)h(t)kd(t)h(t)^{k} and the bivariate generating function

R(t,w)=∑n,k∈ℕdn,ktnwk=d(t)1−wh(t) R(t,w) = \sum_{n,k \in\mathbb{N}}{d_{n,k} t^n w^k} = {d(t) \over 1-wh(t)} (1.1)

enumerates the sequence (dn,k)n,k∈ℕ(d_{n,k})_{n,k \in\mathbb{N}}.

These arrays were introduced inL. W. Shapiro, S. G., W.-J. Woan, and L. C. Woodson. The Riordan group. Discrete Applied Mathematics, 34(1):229–239, 1991. ISSN 0166-218X. doi: 10.1016/0166-218X(91)90088-E. URL http://www.sciencedirect.com/science/article/pii/0166218X9190088E with the aim of defining a class of infinite, lower triangular arrays and since then they have attracted, and continue to attract, a lot of attention in the literature and recent applications can be found inA. Luzon, D. Merlini, M. A. Moron, and R. Sprugnoli. Complementary Riordan arrays. Discrete Applied Mathematics, 172:75–87, 2014. ISSN 0166-218X. doi: 10.1016/j.dam.2014.03.005. URL http://www.sciencedirect.com/science/article/pii/S0166218X14001280.

Example 1.1. The most simple Riordan matrix could be the Pascal triangle

ℛ(11−t,t1−t)wheredn,k=(nk); \mathcal{R}\left(\frac{1}{1-t}, \frac{t}{1-t}\right)\quad\text{where}\quad d_{n,k}={n\choose k};

moreover, another remarkable matrix is the Catalan triangle

ℛ(1−1−4 t2 t,1−1−4 t2 t) \mathcal{R}\left(\frac{1-\sqrt{1-4\,t}}{2\,t}, \frac{1-\sqrt{1-4\,t}}{2\,t}\right)

where dn,k=(2n−kn−k)−(2n−kn−k−1)\displaystyle d_{n,k}={{2n-k}\choose{n-k}} - {{2n-k}\choose{n-k-1}}.

An important property of Riordan arrays concerns the computation of combinatorial sums; precisely, it is encoded by the identity

∑k=0ndn,kfk=[tn]d(t)f(h(t)) \sum_{k=0}^n d_{n,k}f_k=[t^n]d(t)f(h(t)) (1.2)

and it is extensively commented inA. Luzon, D. Merlini, M. A. Moron, and R. Sprugnoli. Identities induced by Riordan arrays. Linear Algebra and its Applications, 436(3):631–647, 2012. ISSN 0024-3795. doi: 10.1016/j.laa.2011.08.007. URL http://www.sciencedirect.com/science/article/pii/S0024379511005805; D. Merlini, R. Sprugnoli, and M. C. Verri. Combinatorial Sums and Implicit Riordan Arrays. Discrete Math., 309(2):475–486, Elsevier Science Publishers B. V., Amsterdam, The Netherlands, The Netherlands, January 2009. ISSN 0012-365X. doi: 10.1016/j.disc.2007.12.039. URL http://dx.doi.org/10.1016/j.disc.2007.12.039; and R. Sprugnoli. Riordan arrays and combinatorial sums. Discrete Mathematics, 132(1):267–290, 1994. ISSN 0012-365X. doi: 10.1016/0012-365X(92)00570-H. URL http://www.sciencedirect.com/science/article/pii/0012365X9200570H It states that every combinatorial sum involving a Riordan array can be computed by extracting the coefficient of tnt^n from the series expansion of d(t)f(h(t))d(t)f(h(t)), where f(t)=𝒢(fk)=∑k≥0fktkf(t)=\mathcal{G}(f_k)=\sum_{k\geq 0}f_kt^k denotes the generating function of the sequence (fk)k∈ℕ(f_k)_{k \in\mathbb{N}} and the symbol 𝒢\mathcal{G} denotes the generating function operator. Due to its importance, relation (1.2) is commonly known as the fundamental rule of Riordan arrays. For short and when no confusion arises, the notation (fk)k(f_k)_{k} will be used as an abbreviation of (fk)k∈ℕ(f_k)_{k\in\mathbb{N}}.

As it is well-known (see, e.g.,A. Luzon, D. Merlini, M. A. Moron, and R. Sprugnoli. Complementary Riordan arrays. Discrete Applied Mathematics, 172:75–87, 2014. ISSN 0166-218X. doi: 10.1016/j.dam.2014.03.005. URL http://www.sciencedirect.com/science/article/pii/S0166218X14001280; D. Merlini, D. G. Rogers, R. Sprugnoli, and M. C. Verri. On Some Alternative Characterizations of Riordan Arrays. Canadian Journal of Mathematics, 49:301–320, August 1997; and L. W. Shapiro, S. G., W.-J. Woan, and L. C. Woodson. The Riordan group. Discrete Applied Mathematics, 34(1):229–239, 1991. ISSN 0166-218X. doi: 10.1016/0166-218X(91)90088-E. URL http://www.sciencedirect.com/science/article/pii/0166218X9190088E), Riordan arrays constitute an algebraic group with respect to the usual row-by-column product between matrices; formally, the group operation ⋅\cdot applied to two Riordan arrays D1(d1(t), h1(t))D_1(d_1(t),\ h_1(t)) and D2(d2(t), h2(t))D_2(d_2(t),\ h_2(t)) is carried out as

D1⋅D2=(d1(t)d2(h1(t)), h2(h1(t))). D_1 \cdot D_2 =(d_1(t)d_2(h_1(t)),\ h_2(h_1(t))). (1.3)

Moreover, the Riordan array I=(1, t)I = (1,\ t) acts as the identity element and the inverse of D=(d(t),h(t))D =(d(t), h(t)) is the Riordan array

D−1=(1d(h̅(t)),h̅(t)) D^{-1} = \left( \frac{1}{d(\overline{h}(t))}, \overline{h}(t) \right) (1.4)

where h̅(t)\overline{h}(t) denotes the compositional inverse of h(t)h(t).

An equivalent characterization of a each matrix ℛ(d(t),h(t))\mathcal{R}(d(t), h(t)) in the Riordan group is given by two sequences of coefficients (an)n∈ℕ\left(a_{n}\right)_{n\in\mathbb{N}} and (zn)n∈ℕ\left(z_{n}\right)_{n\in\mathbb{N}} called AA-sequence and ZZ-sequence, respectively. The former one can be used to define every coefficient dn,kd_{n,k} with k>0k>0,

dn+1,k+1=a0dn,k+a1dn,k+1+a2dn,k+2+…+ajdn,k+j+… d_{n+1, k+1} = a_{0}d_{n,k} + a_{1}d_{n,k+1} + a_{2}d_{n,k+2} + \ldots + a_{j}d_{n,k+j} + \ldots

where the sum is finite because exists j∈ℕj\in\mathbb{N} such that n=k+jn=k+j; on the other hand, the latter one can be used to define every coefficient dn,0d_{n,0} lying on the first column,

dn+1,0=z0dn,0+z1dn,1+z2dn,2+…+zndn,n d_{n+1, 0} = z_{0}d_{n,0} + z_{1}d_{n,1} + z_{2}d_{n,2} + \ldots + z_{n}d_{n,n}

where the sum is finite because dn,k+j=0d_{n,k+j}=0 for j>n−kj>n-k.

Moreover, let A(t)A(t) and Z(t)Z(t) be the generating functions of the AA-sequence and ZZ-sequence respectively, then relations

h(t)=tA(h(t))andd(t)=d0,01−tZ(h(t)) h(t) = tA(h(t)) \quad\text{and}\quad d(t)=\frac{d_{0,0}}{1-tZ(h(t))}

connect them with functions d(t)d(t) and h(t)h(t), where d0,0d_{0,0} is the very first element of ℛ\mathcal{R}; for the sake of completeness,D. Merlini, D. G. Rogers, R. Sprugnoli, and M. C. Verri. On Some Alternative Characterizations of Riordan Arrays. Canadian Journal of Mathematics, 49:301–320, August 1997 collects more alternative characterizations.

1.2Symbolic computation

The main part of the symbolic computations supporting the topics discussed in this dissertation has been coded using the Python language, relying on the module sympy for what concerns mathematical stuff. Quoting from http://www.sympy.org/:

“SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible.”

The paperA. Meurer, C. P. Smith, M. Paprocki, O. Čertík, S. B. Kirpichev, M. Rocklin, A. Kumar, S. Ivanov, J. K. Moore, S. Singh, T. Rathnayake, S. Vig, B. E. Granger, R. P. Muller, F. Bonazzi, H. Gupta, S. Vats, F. Johansson, F. Pedregosa, M. J. Curry, A. R. Terrel, Š. Roučka, A. Saboo, I. Fernando, S.h Kulal, R. Cimrman, and A. Scopatz. SymPy: symbolic computing in Python. PeerJ Computer Science, 3:e103, January 2017. ISSN 2376-5992. doi: 10.7717/peerj-cs.103. URL https://doi.org/10.7717/peerj-cs.103 explains it and many other resources can be found online; for example, a comprehensive documentation isSymPy. SymPy’s documentation. URL http://docs.sympy.org/latest/index.html and a well written, understandable tutorialSymPy. SymPy’s tutorial. URL http://docs.sympy.org/latest/tutorial/index.html is provided by the original development team.

Here we avoid to duplicate the tutorial with similar examples, instead we state the methodology used while coding our definitions. Python is a very expressive language allowing programmers to use both the object-oriented and functional paradigms. It can tackle different application domains by means of modules and sympy is an example that targets the manipulation of symbolic terms. Contrary to other proprietary software like Maple and Mathematica which ship their own languages, sympy is implemented entirely in Python, allowing a transparent and easy integration in other Python programs, as we will see in later chapters.

The main point to grasp in our opinion is the difference between the meta language, which is Python, and the object language, which is the mathematical expressions denoted by sympy objects.

Example 1.2. Symbol is a fundamental class of objects that introduces arbitrary mathematical symbols.

>>> from sympy import Symbol
>>> a_sym = Symbol('a')
>>> a_sym
a

The previous snippet allows us to clarify the duality among meta and object languages; precisely, the mathematical expression aa is denoted by the Python object a_sym.

The above example is the first one found by the reader and it shows a common pattern used through this document to illustrate computations; in particular, when a line starts with (i) >>> then it is an input line holding code to be executed, (ii) ... then it is a continuation line holding an unfinished code expression, otherwise (iii) it is an output line reporting the result of the evaluation.

A second fundamental methodology that we embrace in our symbolic manipulations is equational reasoning, namely we use equations denoted by Eq objects to express identities to reason about, used both to define things and to be solved with respect to a desired symbol.

Example 1.3. Introduction of Eq, solve and symbols functions:

>>> from sympy import Eq, solve, symbols
>>> a, t = symbols('a t')
>>> a_def = Eq(a, 3)
>>> at_eq = Eq(a+5*t, 1/(1-t))
>>> a_def, at_eq
(a=3,a+5t=1−t+1) \left( a=3,\quad a + 5 t = \frac{1}{- t + 1} \right)
>>> sols = [Eq(t, s) for s in solve(at_eq, t)]
>>> sols
[t=−a10−110a2+10a+5+12,t=−a10+110a2+10a+5+12] \begin{array}{c} \left [ t = - \frac{a}{10} - \frac{1}{10} \sqrt{a^{2} + 10 a + 5} + \frac{1}{2}, \right . \\ \left. t = - \frac{a}{10} + \frac{1}{10} \sqrt{a^{2} + 10 a + 5} + \frac{1}{2}\right ] \end{array}

Due to the importance of equations in our code, we introduce two helper functions. First, define builds a definition:

def define(let, be, ctor=Eq, **kwds,):

    if 'evaluate' not in kwds:       # If `evaluate` is already given, use it # as it is,
        kwds['evaluate'] = False     # otherwise set to `False` to preevent evaluation
                                     # by `Eq`, which implicitly do simplifications;

Example 1.4. Introduction of Function objects:

>>> from sympy import Function, sqrt
>>> f = Function('f')
>>> f(3)
f(3)
>>> t = symbols('t')
>>> define(let=f(t), be=(1-sqrt(1-4*t))/(2*t), ctor=FEq)
f(t)=12t(−−4t+1+1) f{\left (t \right )} = \frac{1}{2 t} \left(- \sqrt{- 4 t + 1} + 1\right)

The keyword argument ctor=FEq asks define to promote the equation we are defining as a callable object by means of the FEq class,

    first, *rest = lst                                              # Destructure `lst` into car and cdr.
    accumulated = key(first)                                        # Init the accumulator with the first element.
    while rest:                                                     # While there is element in the cdr,
        current, *rest = rest                                       # take the next element to combine
        accumulated = f(accumulated, key(current))                  # with the accumulated value via the function `f`.

    return accumulated                                              # Finally, return the accumulated value.


class FEq(Eq):

    def __call__(self, *args, **kwds):
        with lift_to_Lambda(self, **kwds) as feq:
            applied = feq(*args)
            if isinstance(applied, Eq):
                subs = Subs(applied, self.lhs, self.rhs)
                setattr(subs, 'substitution', partial(
                    lambda inner_self, *args, **kwds: self, subs))
                return subs
            else:
                return applied

    def swap(self):
        return self.__class__(self.rhs, self.lhs)

    def __iter__(self):
        yield self.lhs, self.rhs

    def as_substitution(self):
        return dict(self)

    def __mod__(self, arg):

which provides methods that allows it to be used as a substitution too; in turn, it depends on

@contextmanager
def lift_to_Lambda(eq, return_eq=False, lhs_handler=lambda args: []):

    lhs = eq.lhs
    args = (lhs.args[1:] if isinstance(lhs, Indexed) else    # get arguments wrt the type of `lhs` object;
            lhs.args     if isinstance(lhs, Function) else   # here we handle both function and subscript
            lhs_handler(lhs))                                # notations. Finally, `Lambda` is the

Example 1.5. Introduction of IndexedBase objects:

>>> from commons import lift_to_Lambda
>>> from sympy import IndexedBase
>>> a = IndexedBase('a')
>>> aeq = Eq(a[n], n+a[n-1])
>>> aeq(n+1)
an+1=n+an+1 a_{n + 1} = n + a_{n} + 1
>>> b = Function('b')
>>> beq = Eq(b(n), n+b(n-1))
>>> beq(n+1)
b(n+1)=n+b(n)+1 b{\left (n + 1 \right )} = n + b{\left (n \right )} + 1

1.3Riordan Arrays, computationally

In this section we describe a little framework that implements parts of the concepts seen in the previous section; in particular, we provide some strategies to build Riordan arrays, to find corresponding production matrices and their group inverse elements, respectively.

First of all we introduce (i) function symbols d_fn and h_fn to denote arbitrary symbolic functions dd and hh, (ii) indexed symbols d and h to denote arbitrary symbolic and indexed coefficients

>>> d_fn, h_fn = Function('d'), Function('h')
>>> d, h = IndexedBase('d'), IndexedBase('h')

respectively. To build Riordan matrices we use Matrix objects; in particular, the expression Matrix(r, c, ctor) denotes a matrix with r rows and c columns where each coefficient dn,kd_{n,k} in the matrix is defined according to ctor which is a callableFrom the official doc at https://docs.python.org/3/library/functions.html#callable: callable(object) return True if the object argument appears callable, False if not. If this returns true, it is still possible that a call fails, but if it is false, calling object will never succeed. Note that classes are callable (calling a class returns a new instance); instances are callable if their class has a __call__ method. object consuming two arguments nn and kk, its row and column coordinates. We call it ctor as abbreviation for constructor, because it allows us to code the definition of each coefficient with a Python callable object.

Here we show how to build a pure symbolic matrix:

>>> from sympy import Matrix
>>> rows, cols = 5, 5
>>> ctor = lambda i,j: d[i,j]
>>> Matrix(rows, cols, ctor)
[d0,0d0,1d0,2d0,3d0,4d1,0d1,1d1,2d1,3d1,4d2,0d2,1d2,2d2,3d2,4d3,0d3,1d3,2d3,3d3,4d4,0d4,1d4,2d4,3d4,4] \left[\begin{matrix}d_{0,0} & d_{0,1} & d_{0,2} & d_{0,3} & d_{0,4}\\d_{1,0} & d_{1,1} & d_{1,2} & d_{1,3} & d_{1,4}\\d_{2,0} & d_{2,1} & d_{2,2} & d_{2,3} & d_{2,4}\\d_{3,0} & d_{3,1} & d_{3,2} & d_{3,3} & d_{3,4}\\d_{4,0} & d_{4,1} & d_{4,2} & d_{4,3} & d_{4,4}\end{matrix}\right]

In the following sections we show a collection of such ctors, each one of them implements one theoretical characterization used to denote Riordan arrays and corresponding examples are given.

1.3.1Convolution ctor

The following definition implements a ctor that allows us to build Riordan arrays by convolution of their dd and hh functions; here it is,

def riordan_matrix_by_convolution(dim, d, h):

    t = symbols('t')                                      # Local symbol to denote a formal variable `t`.

    with lift_to_Lambda(d, return_eq=True) as D:          # Lift equations `d` and `h` to become callables
      with lift_to_Lambda(h, return_eq=True) as H:        # objects, returning equations as well, in order
        d_eq, h_eq = D(t), H(t)                           # to let both of them depend on variable `t`.

    @lru_cache(maxsize=None)
    def column(j):                                        # Columns are memoized for the sake of efficiency.
        if not j: return d_eq                             # Base case.
        lhs = column(j-1).lhs * h_eq.lhs                  # Otherwise, use already computed column to build
        rhs = column(j-1).rhs * h_eq.rhs                  # the current `lhs` and `rhs`.
        return Eq(lhs, rhs)

    @lru_cache(maxsize=None)
    def C(j):                                             # Local function that performs Taylor expansion
        return column(j).rhs.series(t, n=dim).removeO()   # of columns, which are symbolic terms up to now.

    return lambda i, j: C(j).coeff(t, i).expand()         # Return a lambda to be plugged in a `Matrix` ctor.

Example 1.6. Symbolic Riordan array built by two polynomials with symbolic coefficients:

>>> d_series = Eq(d_fn(t), 1+sum(d[i]*t**i for i in range(1,m)))
>>> h_series = Eq(h_fn(t), t*(1+sum(h[i]*t**i for i in range(1,m-1)))).expand()
>>> d_series, h_series
(d(t)=t4d4+t3d3+t2d2+td1+1,h(t)=t4h3+t3h2+t2h1+t) \left ( d{\left (t \right )} = t^{4} d_{4} + t^{3} d_{3} + t^{2} d_{2} + t d_{1} + 1, \quad h{\left (t \right )} = t^{4} h_{3} + t^{3} h_{2} + t^{2} h_{1} + t\right )
>>> R = Matrix(m, m, riordan_matrix_by_convolution(m, d_series, h_series))
>>> R
[1d11d2d1+h11d3d1h1+d2+h2d1+2h11d4d1h2+d2h1+d3+h32d1h1+d2+h12+2h2d1+3h11] \left[\begin{matrix}1 & & & & \\d_{1} & 1 & & & \\d_{2} & d_{1} + h_{1} & 1 & & \\d_{3} & d_{1} h_{1} + d_{2} + h_{2} & d_{1} + 2 h_{1} & 1 & \\d_{4} & d_{1} h_{2} + d_{2} h_{1} + d_{3} + h_{3} & 2 d_{1} h_{1} + d_{2} + h_{1}^{2} + 2 h_{2} & d_{1} + 3 h_{1} & 1\end{matrix}\right]

Example 1.7. The Pascal triangle built using closed generating functions:

>>> d_series = Eq(d_fn(t), 1/(1-t))
>>> h_series = Eq(h_fn(t), t*d_series.rhs)
>>> d_series, h_series
(d(t)=11−t,h(t)=t1−t) \left ( d{\left (t \right )} = \frac{1}{1-t}, \quad h{\left (t \right )} = \frac{t}{1-t}\right )
>>> R = Matrix(10, 10, riordan_matrix_by_convolution(10, d_series, h_series))
>>> R
[11112113311464115101051161520156117213535217118285670562881193684126126843691] \left[\begin{matrix}1 & & & & & & & & & \\1 & 1 & & & & & & & & \\1 & 2 & 1 & & & & & & & \\1 & 3 & 3 & 1 & & & & & & \\1 & 4 & 6 & 4 & 1 & & & & & \\1 & 5 & 10 & 10 & 5 & 1 & & & & \\1 & 6 & 15 & 20 & 15 & 6 & 1 & & & \\1 & 7 & 21 & 35 & 35 & 21 & 7 & 1 & & \\1 & 8 & 28 & 56 & 70 & 56 & 28 & 8 & 1 & \\1 & 9 & 36 & 84 & 126 & 126 & 84 & 36 & 9 & 1\end{matrix}\right]

1.3.2Recurrence ctor

The following definition implements a ctor that allows us to build Riordan arrays by a recurrence relation over coefficients dn+1,k+1d_{n+1, k+1}; here it is,

def riordan_matrix_by_recurrence(dim, rec, init={(0,0):1},
                                 ctor=zeros, post=expand,
                                 lattice=None):

    if not lattice:
        lattice = [(n, k) for n in range(1, dim)   # `lattice` denotes the order in which coeffs in
                          for k in range(n+1)]     # the array will be computed; it can be plugged in.

    R = ctor(dim)                                  # Initial array as base for recursive construction.

    for cell, i in init.items(): R[cell] = i       # Set boundary values for the recurrence `rec`.

    for cell in lattice:                           # Visit cells as they appear in the order `lattice`;
        for comb_cell, v in rec(*cell).items():    # then, get dependencies with respect the each cell.

            try:
                comb = (1 if cell == comb_cell
                        else R[comb_cell])         # If it is possible to access the dependee cell,
                combined = v * comb                # then perform the combination using the given `v`.
            except IndexError:
                combined = 0                       # Otherwise, take `0` because combination fails.

            R[cell] += combined                    # Finally, accumulate the current combination.

    if callable(post): R = R.applyfunc(post)       # If some post processing is desired, do it.

    return lambda n, k: R[n, k]                    # Return a lambda that uses the computed `R`.

Example 1.8. Symbolic Riordan Array built according to the recurrence:

dn+1,0=b¯ dn,0+c dn,1,n∈ℕdn+1,k+1=a dn,k+b dn,k+c dn,k+1,n,k∈ℕ \begin{aligned} d_{n+1, 0} &= \bar{b}\,d_{n, 0} + c\,d_{n,1}, \quad n \in\mathbb{N} \\ d_{n+1, k+1} &= a\,d_{n, k} + b\,d_{n, k} + c\,d_{n,k+1}, \quad n,k \in\mathbb{N} \end{aligned}
>>> dim = 5
>>> a, b, b_bar, c = symbols(r'a b \bar{b} c')
>>> M = Matrix(dim, dim,
...            riordan_matrix_by_recurrence(
...               dim, lambda n, k: {(n-1, k-1):a,
...                                  (n-1, k): b if k else b_bar,
...                                  (n-1, k+1):c}))
>>> M
[1b¯ab¯2+acb¯a+aba2b¯3+2b¯ac+abcb¯2a+b¯ab+2a2c+ab2b¯a2+2a2ba3b¯4+3b¯2ac+2b¯abc+2a2c2+ab2cb¯3a+b¯2ab+3b¯a2c+b¯ab2+5a2bc+ab3b¯2a2+2b¯a2b+3a3c+3a2b2b¯a3+3a3ba4] \footnotesize \left[\begin{matrix}1 & & & & \\\bar{b} & a & & & \\\bar{b}^{2} + a c & \bar{b} a + a b & a^{2} & & \\\bar{b}^{3} + 2 \bar{b} a c + a b c & \bar{b}^{2} a + \bar{b} a b + 2 a^{2} c + a b^{2} & \bar{b} a^{2} + 2 a^{2} b & a^{3} & \\\bar{b}^{4} + 3 \bar{b}^{2} a c + 2 \bar{b} a b c + 2 a^{2} c^{2} + a b^{2} c & \bar{b}^{3} a + \bar{b}^{2} a b + 3 \bar{b} a^{2} c + \bar{b} a b^{2} + 5 a^{2} b c + a b^{3} & \bar{b}^{2} a^{2} + 2 \bar{b} a^{2} b + 3 a^{3} c + 3 a^{2} b^{2} & \bar{b} a^{3} + 3 a^{3} b & a^{4}\end{matrix}\right]
>>> production_matrix(M)
[b¯acbacbacb] \left[\begin{matrix}\bar{b} & a & & \\c & b & a & \\ & c & b & a\\ & & c & b\end{matrix}\right]

Forcing a=1a=1 and b¯=b\bar{b} = b yield the easier matrix Msubs

>>> Msubs = M.subs({a:1, b_bar:b})
>>> Msubs, production_matrix(Msubs)
([1b1b2+c2b1b3+3bc3b2+2c3b1b4+6b2c+2c24b3+8bc6b2+3c4b1],[b1cb1cb1cb]) \left ( \left[\begin{matrix}1 & & & & \\b & 1 & & & \\b^{2} + c & 2 b & 1 & & \\b^{3} + 3 b c & 3 b^{2} + 2 c & 3 b & 1 & \\b^{4} + 6 b^{2} c + 2 c^{2} & 4 b^{3} + 8 b c & 6 b^{2} + 3 c & 4 b & 1\end{matrix}\right], \quad \left[\begin{matrix}b & 1 & & \\c & b & 1 & \\ & c & b & 1\\ & & c & b\end{matrix}\right]\right )

and the correspoding production matrix checks the substitution.

Previous examples uses the function production_matrix to compute the production matrixE. Deutsch, L. Ferrari, and S. Rinaldi. Production matrices. Advances in Applied Mathematics, 34(1):101–122, 2005. ISSN 0196-8858. doi: 10.1016/j.aam.2004.05.002. URL http://www.sciencedirect.com/science/article/pii/S0196885804000673; and E. Deutsch, L. Ferrari, and S. Rinaldi. Production Matrices and Riordan Arrays. Annals of Combinatorics, 13(1):65–85, July 2009. ISSN 0219-3094. doi: 10.1007/s00026-009-0013-1. URL https://doi.org/10.1007/s00026-009-0013-1 of a Riordan array, here is its definition with two helper ctors:

def columns_symmetry(M):
    return lambda i, j: M[i, i-j]

def rows_shift_matrix(by):
    return lambda i, j: 1 if i + by == j else 0

def diagonal_func_matrix(f):
    return lambda i, j: f(i) if i == j else 0

def production_matrix(M, exp=False):

    f = factorial if exp else one
    U = Matrix(M.rows, M.cols, rows_shift_matrix(by=1))
    F = Matrix(M.rows, M.cols, diagonal_func_matrix(f))
    F_inv = F**(-1)
    V = F_inv * U * F
    O = F_inv * M * F
    O_inv = O**(-1)
    PM = F * O_inv * V * O * F_inv
    PM = F_inv * PM * F if exp else PM
    PM = PM[:-1, :-1]
    return PM.applyfunc(simplify)

implemented according toP. Barry. Riordan Arrays: A Primer. Lulu.com, 2017. ISBN 9781326855239. URL https://books.google.it/books?id=7fGBDgAAQBAJ, p. 215.

1.3.3AA and ZZ sequences ctor

The following definition implements a ctor that allows us to build Riordan arrays by their ZZ and AA sequences; here it is,

def riordan_matrix_by_AZ_sequences(dim, seqs, init={(0,0):1},
                                   ctor=zeros, post=expand,
                                   lattice=None):

    if not lattice: lattice = [(n, k) for n in range(1, dim)
                                      for k in range(n+1)]

    Zseq, Aseq = seqs
    t = symbols('t')

    with lift_to_Lambda(Zseq) as Z, lift_to_Lambda(Aseq) as A:
        Z_series = Z(t).series(t, n=dim).removeO()
        A_series = A(t).series(t, n=dim).removeO()

    R = ctor(dim)

    for cell, i in init.items(): R[cell] = i

    for n, k in lattice:

        if k:
            v = sum(R[n-1, j] * A_series.coeff(t, n=i)
                    for i, j in enumerate(range(k-1, dim)))
        else:
            v = sum(R[n-1, j] * Z_series.coeff(t, n=j)
                    for j in range(dim))

        R[n, k] = v

    if callable(post): R = R.applyfunc(post)

    return lambda n, k: R[n, k]

in words, (i) it deconstructs seqs into objs denoting Z and A seqs, promoting both of them as callables, (ii) it introduces the formal variable t, (iii) it performs two Taylor expansions with respect to t. In order to build the resulting matrix, it visits each cell according to the order given by lattice then if the cell lies not on the first column, it combines using A_series coefficients up to the cell in position (k-1, dim-1); otherwise, it combine using Z_series coefficients up to the cell in position (k-1, dim-1). Finally, it stores the combination and if some post processing is desired, it does so; at last, it returns a lambda that uses the computed matrix R.

Example 1.9. Again the Pascal triangle built using AA and ZZ sequences

>>> A, Z = Function('A'), Function('Z')
>>> A_eq = Eq(A(t), 1 + t)
>>> Z_eq = Eq(Z(t),1)
>>> A_eq, Z_eq
(A(t)=t+1,Z(t)=1) \left ( A{\left (t \right )} = t + 1, \quad Z{\left (t \right )} = 1\right )
>>> R = Matrix(10, 10, riordan_matrix_by_AZ_sequences(10, (Z_eq, A_eq)))
>>> R, production_matrix(R)
([11112113311464115101051161520156117213535217118285670562881193684126126843691],[11111111111111111]) \left ( \left[\begin{matrix}1 & & & & & & & & & \\1 & 1 & & & & & & & & \\1 & 2 & 1 & & & & & & & \\1 & 3 & 3 & 1 & & & & & & \\1 & 4 & 6 & 4 & 1 & & & & & \\1 & 5 & 10 & 10 & 5 & 1 & & & & \\1 & 6 & 15 & 20 & 15 & 6 & 1 & & & \\1 & 7 & 21 & 35 & 35 & 21 & 7 & 1 & & \\1 & 8 & 28 & 56 & 70 & 56 & 28 & 8 & 1 & \\1 & 9 & 36 & 84 & 126 & 126 & 84 & 36 & 9 & 1\end{matrix}\right], \quad \left[\begin{matrix}1 & 1 & & & & & & & \\ & 1 & 1 & & & & & & \\ & & 1 & 1 & & & & & \\ & & & 1 & 1 & & & & \\ & & & & 1 & 1 & & & \\ & & & & & 1 & 1 & & \\ & & & & & & 1 & 1 & \\ & & & & & & & 1 & 1\\ & & & & & & & & 1\end{matrix}\right]\right )

Example 1.10. Catalan triangle built using AA and ZZ sequences,

>>> A_ones = Eq(A(t), 1/(1-t)) # A is defined as in the previous example
>>> R = Matrix(10, 10, riordan_matrix_by_AZ_sequences(10, (A_ones, A_ones)))
>>> R, production_matrix(R)
([111221553114149414242281451132132904820614294292971657527711430143010015722751103581486248623432200210014291544491],[11111111111111111111111111111111111111111111111111111]) \left ( \left[\begin{matrix}1 & & & & & & & & & \\1 & 1 & & & & & & & & \\2 & 2 & 1 & & & & & & & \\5 & 5 & 3 & 1 & & & & & & \\14 & 14 & 9 & 4 & 1 & & & & & \\42 & 42 & 28 & 14 & 5 & 1 & & & & \\132 & 132 & 90 & 48 & 20 & 6 & 1 & & & \\429 & 429 & 297 & 165 & 75 & 27 & 7 & 1 & & \\1430 & 1430 & 1001 & 572 & 275 & 110 & 35 & 8 & 1 & \\4862 & 4862 & 3432 & 2002 & 1001 & 429 & 154 & 44 & 9 & 1\end{matrix}\right], \quad \left[\begin{matrix}1 & 1 & & & & & & & \\1 & 1 & 1 & & & & & & \\1 & 1 & 1 & 1 & & & & & \\1 & 1 & 1 & 1 & 1 & & & & \\1 & 1 & 1 & 1 & 1 & 1 & & & \\1 & 1 & 1 & 1 & 1 & 1 & 1 & & \\1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & \\1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\end{matrix}\right]\right )

Example 1.11. Symbolic Riordan arrays built using AA and ZZ sequences,

>>> dim = 5
>>> a = IndexedBase('a')
>>> A_gen = Eq(A(t), sum((a[j] if j else 1)*t**j for j in range(dim)))
>>> R = Matrix(dim, dim, riordan_matrix_by_AZ_sequences(dim, (A_gen, A_gen)))
>>> R
[111a1+1a1+11a12+2a1+a2+1a12+2a1+a2+12a1+11a13+3a12+3a1a2+3a1+2a2+a3+1a13+3a12+3a1a2+3a1+2a2+a3+13a12+3a1+2a2+13a1+11] \footnotesize \left[\begin{matrix}1 & & & & \\1 & 1 & & & \\a_{1} + 1 & a_{1} + 1 & 1 & & \\a_{1}^{2} + 2 a_{1} + a_{2} + 1 & a_{1}^{2} + 2 a_{1} + a_{2} + 1 & 2 a_{1} + 1 & 1 & \\a_{1}^{3} + 3 a_{1}^{2} + 3 a_{1} a_{2} + 3 a_{1} + 2 a_{2} + a_{3} + 1 & a_{1}^{3} + 3 a_{1}^{2} + 3 a_{1} a_{2} + 3 a_{1} + 2 a_{2} + a_{3} + 1 & 3 a_{1}^{2} + 3 a_{1} + 2 a_{2} + 1 & 3 a_{1} + 1 & 1\end{matrix}\right]
>>> z = IndexedBase('z')
>>> A_gen = Eq(A(t), sum((a[j] if j else 1)*t**j for j in range(dim)))
>>> Z_gen = Eq(Z(t), sum((z[j] if j else 1)*t**j for j in range(dim)))
>>> Raz = Matrix(dim, dim, riordan_matrix_by_AZ_sequences(dim, (Z_gen, A_gen)))
>>> Raz
[111z1+1a1+11a1z1+2z1+z2+1a12+a1+a2+z1+12a1+11(a12z1+2a1z1+2a1z2+a2z1+z12+3z1+2z2+z3+1)a13+a12+3a1a2+2a1z1+a1+a2+a3+2z1+z2+13a12+2a1+2a2+z1+13a1+11] \footnotesize \left[\begin{matrix}1 & & & & \\1 & 1 & & & \\z_{1} + 1 & a_{1} + 1 & 1 & & \\a_{1} z_{1} + 2 z_{1} + z_{2} + 1 & a_{1}^{2} + a_{1} + a_{2} + z_{1} + 1 & 2 a_{1} + 1 & 1 & \\ \left(\begin{aligned} a_{1}^{2} z_{1} &+ 2 a_{1} z_{1} + 2 a_{1} z_{2} + a_{2} z_{1} +\\ z_{1}^{2} &+ 3 z_{1} + 2 z_{2} + z_{3} + 1\end{aligned}\right) & a_{1}^{3} + a_{1}^{2} + 3 a_{1} a_{2} + 2 a_{1} z_{1} + a_{1} + a_{2} + a_{3} + 2 z_{1} + z_{2} + 1 & 3 a_{1}^{2} + 2 a_{1} + 2 a_{2} + z_{1} + 1 & 3 a_{1} + 1 & 1\end{matrix}\right]
>>> production_matrix(R), production_matrix(Raz)
([11a1a11a2a2a11a3a3a2a1],[11z1a11z2a2a11z3a3a2a1]) \left ( \left[\begin{matrix}1 & 1 & & \\a_{1} & a_{1} & 1 & \\a_{2} & a_{2} & a_{1} & 1\\a_{3} & a_{3} & a_{2} & a_{1}\end{matrix}\right], \quad \left[\begin{matrix}1 & 1 & & \\z_{1} & a_{1} & 1 & \\z_{2} & a_{2} & a_{1} & 1\\z_{3} & a_{3} & a_{2} & a_{1}\end{matrix}\right]\right )

1.3.4Exponential ctor

The following definition implements a ctor that allows us to build an exponential Riordan array; here it is,

def riordan_matrix_exponential(RA):
    return lambda i,j: factorial(i)*RA(i,j)/factorial(j)

Example 1.12. Build the triangle of Stirling numbers of the II kind:

>>> d_series = Eq(d_fn(t), 1)
>>> h_series = Eq(h_fn(t), exp(t)-1)
>>> d_series, h_series
(d(t)=1,h(t)=et−1) \left ( d{\left (t \right )} = 1, \quad h{\left (t \right )} = e^{t} - 1\right )
>>> R = matrix(10, 10, riordan_matrix_exponential(
...                     riordan_matrix_by_convolution(
...                       10, d_series, h_series)))
>>> R
[1111131176111525101131906515116330135014021111279661701105026628112553025777069512646462361] \left[\begin{matrix}1 & & & & & & & & & \\ & 1 & & & & & & & & \\ & 1 & 1 & & & & & & & \\ & 1 & 3 & 1 & & & & & & \\ & 1 & 7 & 6 & 1 & & & & & \\ & 1 & 15 & 25 & 10 & 1 & & & & \\ & 1 & 31 & 90 & 65 & 15 & 1 & & & \\ & 1 & 63 & 301 & 350 & 140 & 21 & 1 & & \\ & 1 & 127 & 966 & 1701 & 1050 & 266 & 28 & 1 & \\ & 1 & 255 & 3025 & 7770 & 6951 & 2646 & 462 & 36 & 1\end{matrix}\right]
>>> production_matrix(R), production_matrix(R, exp=True)
([01112131415161718],[01122334455667788]) \left ( \left[\begin{matrix}0 & 1 & & & & & & & \\ & 1 & 1 & & & & & & \\ & & 2 & 1 & & & & & \\ & & & 3 & 1 & & & & \\ & & & & 4 & 1 & & & \\ & & & & & 5 & 1 & & \\ & & & & & & 6 & 1 & \\ & & & & & & & 7 & 1\\ & & & & & & & & 8\end{matrix}\right], \quad \left[\begin{matrix}0 & 1 & & & & & & & \\ & 1 & 2 & & & & & & \\ & & 2 & 3 & & & & & \\ & & & 3 & 4 & & & & \\ & & & & 4 & 5 & & & \\ & & & & & 5 & 6 & & \\ & & & & & & 6 & 7 & \\ & & & & & & & 7 & 8\\ & & & & & & & & 8\end{matrix}\right]\right )
>>> inspect(R)
nature(is_ordinary=False, is_exponential=True)

In the above example we introduced another function inspect that studies the type of array it consumes. Before reporting its definition we remark that the matrix on the left is an usual production matrix (which tells us that d6,4=d5,3+4d5,4=25+4⋅10=65d_{6,4} = d_{5,3} + 4d_{5,4} = 25 + 4\cdot 10 = 65, for example); on the other hand, the matrix on right helps to decide if the array is an exponential one by proving that each diagonal is an arithmetic progression, for more on this seeP. Barry. Riordan Arrays: A Primer. Lulu.com, 2017. ISBN 9781326855239. URL https://books.google.it/books?id=7fGBDgAAQBAJ.

def inspect(M):

    P = production_matrix(M, exp=False)                    # Ordinary production matrix.
    C = production_matrix(M, exp=True)                     # "Exponential" production matrix.

    is_ord = all(P[:1-i, 1] == P[i-1:, i]                  # A RA is ordinary if columns of its PM
                 for i in range(2, P.cols))                # are shifted but equals.

    diagonals = {d: [C[j+d,j] for j in range(1,C.rows-d)]  # Fetch matrix diagonals for the
                 for d in range(C.rows-3) }                # exponential case.

    is_exp = all(map(is_arithmetic_progression,            # A Riordan array is exponential if `diagonals`
                     diagonals.values()))                  # are arithmetic progressions, all of them.

    return nature(is_ord, is_exp)


def is_arithmetic_progression(prog):

    steps = len(prog)-1
    for _ in range(steps):
        prog = [(b-a).simplify()                   # Reduce the list by consecutive differences,
                for a, b in zip(prog, prog[1:])]   # till a single object survives.

    assert len(prog) == 1                          # Consistency check of the last comment.

    return prog.pop() == 0                         # Finally, the reduced object has to vanish.

Example 1.13. In this example we explore an exponential Riordan array starting from the generating functions of the Pascal triangle. Surprisingly the array we get back is known in the OEIS (https://oeis.org/A021009) and looking for some comments we quote the observation

“the generalized Riordan array (ex,x)(e^x, x) with respect to the sequence n!n! is Pascal’s triangle A007318”

>>> d_series, h_series = Eq(d_fn(t), 1/(1-t)), Eq(h_fn(t), t/(1-t))
>>> d_series, h_series
(d(t)=11−t,h(t)=t1−t) \left ( d{\left (t \right )} = \frac{1}{1-t}, \quad h{\left (t \right )} = \frac{t}{1-t}\right )
>>> R = matrix(10, 10, riordan_matrix_exponential(
...                     riordan_matrix_by_convolution(
...                       10, d_series, h_series)))
>>> R
[1112416189124967216112060060020025172043205400240045036150403528052920294007350882491403203225605644803763201176001881615686413628803265920653184050803201905120381024423362592811] \left[\begin{matrix}1 & & & & & & & & & \\1 & 1 & & & & & & & & \\2 & 4 & 1 & & & & & & & \\6 & 18 & 9 & 1 & & & & & & \\24 & 96 & 72 & 16 & 1 & & & & & \\120 & 600 & 600 & 200 & 25 & 1 & & & & \\720 & 4320 & 5400 & 2400 & 450 & 36 & 1 & & & \\5040 & 35280 & 52920 & 29400 & 7350 & 882 & 49 & 1 & & \\40320 & 322560 & 564480 & 376320 & 117600 & 18816 & 1568 & 64 & 1 & \\362880 & 3265920 & 6531840 & 5080320 & 1905120 & 381024 & 42336 & 2592 & 81 & 1\end{matrix}\right]
>>> production_matrix(R), production_matrix(R, exp=True)
([1113145197116912511136131491516417],[11132253374495511661377158817]) \left ( \left[\begin{matrix}1 & 1 & & & & & & & \\1 & 3 & 1 & & & & & & \\ & 4 & 5 & 1 & & & & & \\ & & 9 & 7 & 1 & & & & \\ & & & 16 & 9 & 1 & & & \\ & & & & 25 & 11 & 1 & & \\ & & & & & 36 & 13 & 1 & \\ & & & & & & 49 & 15 & 1\\ & & & & & & & 64 & 17\end{matrix}\right], \quad \left[\begin{matrix}1 & 1 & & & & & & & \\1 & 3 & 2 & & & & & & \\ & 2 & 5 & 3 & & & & & \\ & & 3 & 7 & 4 & & & & \\ & & & 4 & 9 & 5 & & & \\ & & & & 5 & 11 & 6 & & \\ & & & & & 6 & 13 & 7 & \\ & & & & & & 7 & 15 & 8\\ & & & & & & & 8 & 17\end{matrix}\right]\right )
>>> inspect(R)
nature(is_ordinary=False, is_exponential=True)

1.3.5Group inverse elements

In this final section we show how to compute the compositional inverse of a function and then apply this procedure to find the inverse of a given Riordan array. By small steps, your task is to find the compositional inverse of Pascal array’s hh function

h(t)=t1−t, h(t)= \frac{t}{1-t},

namely you want to find a function h¯\bar{h} such that h¯(h(t))=t\bar{h}(h(t))=t. Starting from this very last identity we use the substitution notation

h¯(h(t))=t↔[h¯(y)=t ∣ y=h(t)] \bar{h}(h(t)) = t \leftrightarrow \left[ \bar{h}(y) = t\, | \, y = h(t) \right]

that allows us to reduce the original problem to solve y=h(t)y = h(t) with respect to tt; formally, using the definition of hh we rewrite

y=t1−tthat impliest=y1+y. y = \frac{t}{1-t} \quad\text{that implies}\quad t = \frac{y}{1+y}.

The latter identity can be used back in h¯(y)=t\bar{h}(y) = t as substitution for tt yielding h¯(y)=y1+y\displaystyle \bar{h}(y)= \frac{y}{1+y} as required; this procedure is promptly implemented as

def compositional_inverse(h_eq, y=symbols('y'), check=True):

    spec, body = h_eq.lhs, h_eq.rhs                   # Destructuring function $h$ denoted by `h_eq`,
    t, = spec.args                                    # let `t` be the formal var of function $h$.
                                                      # $\bar{h}(h(t)) = t \leftrightarrow \left[ \bar{h}(y) = t\, | \, y = h(t) \right]$ allows us
    sols = solve(Eq(y, body), t)                      # to solve $y = h(t)$ with respect to $t$ because
    for sol in sols:                                  # $h(t)$ is known, denoted by `body`. For each
        L = Lambda(y, sol)                            # solution `sol`, which depends on $y$, we build
        if L(0) == 0:                                 # a callable object `L`. If it vanishes in $0$ and
                                                      # $\bar{h}(h(t))=t$, then it is a compositional
            if check: assert L(body).simplify() == t  # inverse of $h$.

            h_bar = Function(r'\bar{{ {} }}'.format(  # Prepare the name for function $\bar{h}$ and
                str(spec.func)))
            eq = Eq(h_bar(y), sol.factor())           # build the corresponding equation that defines
            return eq                                 # $\bar{h}(y)$, compositional inverse of $h(t)$.

    raise ValueError                                  # If the above code fails to return, raise an error.
def group_inverse(d_eq, h_eq, post=identity, check=True):

    t, y = symbols('t y')                                   # Formal symbols for symbolic functions $f$ and $g$.
    g_fn, f_fn = Function('g'), Function('f')

    with lift_to_Lambda(d_eq, return_eq=False) as D:        # Promote equations `d` and `h` to become
      with lift_to_Lambda(h_eq, return_eq=True) as H:       # callables objects, returning equations as well.
        f_eq = compositional_inverse(H(t), y, check)        # Let function $f$ be the compositional inverse of
        with lift_to_Lambda(f_eq, return_eq=False) as F:    # function $h$, then promote it as callable and
            F_t = F(t)                                      # (i) evaluate it at $t$;
            g = post(1/D(F_t))                              # (ii) build and refine $g$, the first function of
            f = post(F_t)                                   # the new Ra; (iii) refine $f$, the snd function.

    g_eq = Eq(g_fn(t), g.simplify())                        # Build corresponding equation objects with
    f_eq = Eq(f_fn(t), f.simplify())                        # simplified expressions.

    if check:                                               # If it is required to certify the computation,
        with lift_to_Lambda(g_eq, return_eq=False) as G:    # then promote the just built equations `g` and
          with lift_to_Lambda(f_eq, return_eq=False) as F:  # `f` to perform group operation in order to
            H_rhs = H(t).rhs                                # check that, it yields the identity element,
            assert (D(t)*G(H_rhs)).simplify() == 1          # which has (i) $1$ as first component and
            assert F(H_rhs).simplify() == t                 # (ii) $t$ as second component.

    return g_eq, f_eq

Example 1.14. Compositional inverse of Catalan tringle’s hh generating function:

>>> catalan_term = (1-sqrt(1-4*t))/(2*t)
>>> d_series = Eq(d_fn(t), catalan_term)
>>> h_series = Eq(h_fn(t), t*catalan_term)
>>> h_series, compositional_inverse(h_series)
(h(t)=−12−4t+1+12,h¯(y)=−y(y−1)) \left ( h{\left (t \right )} = - \frac{1}{2} \sqrt{- 4 t + 1} + \frac{1}{2}, \quad \bar{ h }{\left (y \right )} = - y \left(y - 1\right)\right )
>>> C_inverse = group_inverse(d_series, h_series, post=radsimp)
>>> C_inverse
(g(t)=124t2−4t+1+12,f(t)=t(−t+1)) \left ( g{\left (t \right )} = \frac{1}{2} \sqrt{4 t^{2} - 4 t + 1} + \frac{1}{2}, \quad f{\left (t \right )} = t \left(- t + 1\right)\right )
>>> R = Matrix(10, 10, riordan_matrix_by_convolution(
...                     10, C_inverse[0], C_inverse[1]))
>>> R
[1−11−211−313−41−16−51−410−611−1015−715−2021−81−115−3528−91] \left[\begin{matrix}1 & & & & & & & & & \\-1 & 1 & & & & & & & & \\ & -2 & 1 & & & & & & & \\ & 1 & -3 & 1 & & & & & & \\ & & 3 & -4 & 1 & & & & & \\ & & -1 & 6 & -5 & 1 & & & & \\ & & & -4 & 10 & -6 & 1 & & & \\ & & & 1 & -10 & 15 & -7 & 1 & & \\ & & & & 5 & -20 & 21 & -8 & 1 & \\ & & & & -1 & 15 & -35 & 28 & -9 & 1\end{matrix}\right]

Conclusions

This chapter offers to the reader a concise review of the theory of Riordan Arrays by recalling definitions, characterizations and their fundamental properties; moreover, we pair these formal arguments with a set of software abstractions that allow us to mimic the theory with objects living in a computer. Coding our definitions using the Python programming language and taking advantage of the symbolic module Sympy, we provide a coherent and unified environment to experiment in.