<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Mathematics on vrusso</title><link>https://vrusso.com/tags/mathematics/</link><description>Recent content in Mathematics on vrusso</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Thu, 02 Jan 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://vrusso.com/tags/mathematics/index.xml" rel="self" type="application/rss+xml"/><item><title>Hexagonal labyrinths in triangular arrays</title><link>https://vrusso.com/posts/hexagonal_labyrinths/</link><pubDate>Thu, 02 Jan 2025 00:00:00 +0000</pubDate><guid>https://vrusso.com/posts/hexagonal_labyrinths/</guid><description>I recently happened upon the textbook &amp;ldquo;Triangular Arrays with Applications&amp;rdquo; and decided to pick up a copy. I&amp;rsquo;m certainly no number theorist, but I still enjoy a good triangular arrangement of numbers as much as the next person.
My typical strategy for understanding something mathy is to write some code and to see lots and lots of examples to develop intuition. I suppose I&amp;rsquo;m one of those people who need to burn their hands on the stove multiple times to realize that doing so is a bad idea.</description><content>&lt;p>I recently happened upon the textbook &lt;a href="https://global.oup.com/academic/product/triangular-arrays-with-applications-9780199742943">&amp;ldquo;Triangular Arrays with
Applications&amp;rdquo;&lt;/a> and decided to
pick up a copy. I&amp;rsquo;m certainly no number theorist, but I still enjoy a good triangular arrangement of numbers as much as
the next person.&lt;/p>
&lt;p>My typical strategy for understanding something mathy is to write some code and to see lots and lots of examples to
develop intuition. I suppose I&amp;rsquo;m one of those people who need to burn their hands on the stove multiple times to realize
that doing so is a bad idea. Anyway, I digress.&lt;/p>
&lt;p>I realized there wasn&amp;rsquo;t much open-source software for manipulating and studying triangular
arrangements of numbers. Shocking, right? So, to make things right with the world, I spent the better part
of a weekend creating the &lt;a href="https://github.com/vprusso/triforce">&lt;code>triforce&lt;/code>&lt;/a> Python package. The
&lt;a href="https://en.wikipedia.org/wiki/Lateralus_(song)">&lt;code>triforce&lt;/code>&lt;/a> package is a suite of tools for the numerical exploration of
triangular arrays.&lt;/p>
&lt;h3 id="exploring-triangular-arrays-in-triforce">Exploring triangular arrays in triforce&lt;/h3>
&lt;p>You can invoke well-known triangular arrays (Pascal&amp;rsquo;s triangle, Bell&amp;rsquo;s triangle, etc.) from the &lt;code>triangles&lt;/code> library of
pre-defined triangular arrangements. Here is an example of the well-known &lt;a href="https://en.wikipedia.org/wiki/Pascal%27s_triangle">Pascal&amp;rsquo;s
triangle&lt;/a>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-py" data-lang="py">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> &lt;span style="color:#f92672">from&lt;/span> triforce.triangles &lt;span style="color:#f92672">import&lt;/span> PascalTriangle
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> triangle &lt;span style="color:#f92672">=&lt;/span> PascalTriangle(&lt;span style="color:#ae81ff">10&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> &lt;span style="color:#75715e"># Print the output as a triangular shape:&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> print(triangle)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">1&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">1&lt;/span> &lt;span style="color:#ae81ff">2&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">1&lt;/span> &lt;span style="color:#ae81ff">3&lt;/span> &lt;span style="color:#ae81ff">3&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">1&lt;/span> &lt;span style="color:#ae81ff">4&lt;/span> &lt;span style="color:#ae81ff">6&lt;/span> &lt;span style="color:#ae81ff">4&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">1&lt;/span> &lt;span style="color:#ae81ff">5&lt;/span> &lt;span style="color:#ae81ff">10&lt;/span> &lt;span style="color:#ae81ff">10&lt;/span> &lt;span style="color:#ae81ff">5&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">1&lt;/span> &lt;span style="color:#ae81ff">6&lt;/span> &lt;span style="color:#ae81ff">15&lt;/span> &lt;span style="color:#ae81ff">20&lt;/span> &lt;span style="color:#ae81ff">15&lt;/span> &lt;span style="color:#ae81ff">6&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">1&lt;/span> &lt;span style="color:#ae81ff">7&lt;/span> &lt;span style="color:#ae81ff">21&lt;/span> &lt;span style="color:#ae81ff">35&lt;/span> &lt;span style="color:#ae81ff">35&lt;/span> &lt;span style="color:#ae81ff">21&lt;/span> &lt;span style="color:#ae81ff">7&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">1&lt;/span> &lt;span style="color:#ae81ff">8&lt;/span> &lt;span style="color:#ae81ff">28&lt;/span> &lt;span style="color:#ae81ff">56&lt;/span> &lt;span style="color:#ae81ff">70&lt;/span> &lt;span style="color:#ae81ff">56&lt;/span> &lt;span style="color:#ae81ff">28&lt;/span> &lt;span style="color:#ae81ff">8&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">1&lt;/span> &lt;span style="color:#ae81ff">9&lt;/span> &lt;span style="color:#ae81ff">36&lt;/span> &lt;span style="color:#ae81ff">84&lt;/span> &lt;span style="color:#ae81ff">126&lt;/span> &lt;span style="color:#ae81ff">126&lt;/span> &lt;span style="color:#ae81ff">84&lt;/span> &lt;span style="color:#ae81ff">36&lt;/span> &lt;span style="color:#ae81ff">9&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The &lt;code>triangle&lt;/code> object is of type &lt;code>Triangle&lt;/code> which has a number of attributes associated with it that can be useful for
exploring various properties of certain triangular arrays. Here are just some of the properties we can explore:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-py" data-lang="py">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> &lt;span style="color:#75715e"># Extract the right-most diagonal of the triangle:&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> print(triangle&lt;span style="color:#f92672">.&lt;/span>diagonal(diagonal_index&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">0&lt;/span>, direction&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;right&amp;#34;&lt;/span>))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>[&lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">1&lt;/span>]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> &lt;span style="color:#75715e"># Extract the second-to-the-right-most diagonal of the triangle:&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> print(triangle&lt;span style="color:#f92672">.&lt;/span>diagonal(diagonal_index&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>, direction&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;right&amp;#34;&lt;/span>))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>[&lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">2&lt;/span>, &lt;span style="color:#ae81ff">3&lt;/span>, &lt;span style="color:#ae81ff">4&lt;/span>, &lt;span style="color:#ae81ff">5&lt;/span>, &lt;span style="color:#ae81ff">6&lt;/span>, &lt;span style="color:#ae81ff">7&lt;/span>, &lt;span style="color:#ae81ff">8&lt;/span>, &lt;span style="color:#ae81ff">9&lt;/span>]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> &lt;span style="color:#75715e"># Extract the center entries of the triangle:&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> print(triangle&lt;span style="color:#f92672">.&lt;/span>center())
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>[&lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">2&lt;/span>, &lt;span style="color:#ae81ff">6&lt;/span>, &lt;span style="color:#ae81ff">20&lt;/span>, &lt;span style="color:#ae81ff">70&lt;/span>]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> &lt;span style="color:#75715e"># Extract row sums:&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> print(triangle&lt;span style="color:#f92672">.&lt;/span>row_sums())
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>[&lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">2&lt;/span>, &lt;span style="color:#ae81ff">4&lt;/span>, &lt;span style="color:#ae81ff">8&lt;/span>, &lt;span style="color:#ae81ff">16&lt;/span>, &lt;span style="color:#ae81ff">32&lt;/span>, &lt;span style="color:#ae81ff">64&lt;/span>, &lt;span style="color:#ae81ff">128&lt;/span>, &lt;span style="color:#ae81ff">256&lt;/span>, &lt;span style="color:#ae81ff">512&lt;/span>]
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Additionally, the &lt;code>Triangle&lt;/code> class is extensible to allow you to define your own generating function for the rule-set. We
can override the &lt;code>generate_triangle&lt;/code> function to dictate how the triangular array is defined. As an example, here is how
we can do this to define the &lt;a href="https://en.wikipedia.org/wiki/Hosoya%27s_triangle">Hosoya Triangle&lt;/a>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-py" data-lang="py">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">from&lt;/span> trifoce.triangle &lt;span style="color:#f92672">import&lt;/span> Triangle
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">from&lt;/span> triforce.sequences &lt;span style="color:#f92672">import&lt;/span> fibonacci
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">class&lt;/span> &lt;span style="color:#a6e22e">HosoyaTriangle&lt;/span>(Triangle):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;&amp;#34;&amp;#34;Hosoya Triangle: https://en.wikipedia.org/wiki/Hosoya&lt;/span>&lt;span style="color:#e6db74">%27s&lt;/span>&lt;span style="color:#e6db74">_triangle&amp;#34;&amp;#34;&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">generate_triangle&lt;/span>(self) &lt;span style="color:#f92672">-&amp;gt;&lt;/span> list[list[int]]:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;&amp;#34;&amp;#34;Generate the Hosoya triangle up to row n.&amp;#34;&amp;#34;&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> triangle &lt;span style="color:#f92672">=&lt;/span> []
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">for&lt;/span> i &lt;span style="color:#f92672">in&lt;/span> range(self&lt;span style="color:#f92672">.&lt;/span>n):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> row &lt;span style="color:#f92672">=&lt;/span> []
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">for&lt;/span> j &lt;span style="color:#f92672">in&lt;/span> range(i &lt;span style="color:#f92672">+&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>):
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> entry &lt;span style="color:#f92672">=&lt;/span> fibonacci(j &lt;span style="color:#f92672">+&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>) &lt;span style="color:#f92672">*&lt;/span> fibonacci(i &lt;span style="color:#f92672">-&lt;/span> j &lt;span style="color:#f92672">+&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> row&lt;span style="color:#f92672">.&lt;/span>append(entry)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> triangle&lt;span style="color:#f92672">.&lt;/span>append(row)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> triangle
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>One can also visualize properties of the triangles by plotting. Here is an example of visualizing Pascal&amp;rsquo;s triangle such
that the even and odd terms are replaced by black and white pixels, respectively.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-py" data-lang="py">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">from&lt;/span> triforce.plots &lt;span style="color:#f92672">import&lt;/span> highlight_plot
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">from&lt;/span> triforce.numerics &lt;span style="color:#f92672">import&lt;/span> is_even
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>highlight_plot(PascalTriangle(n&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">510&lt;/span>), is_even)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;img alt="even-odd plot for Pascal&amp;rsquo;s triangle" src="https://vrusso.com/blog/pascal_parity_plot.png">&lt;/p>
&lt;p>One could (and indeed should!) go to town in adding additional exploratory functionality. I encourage anyone
who is reading this and interested in either forking the project or making a PR to &lt;code>triforce&lt;/code> for enhancing the current
set of functionality.&lt;/p>
&lt;h3 id="using-triforce-in-the-wild">Using triforce in the wild&lt;/h3>
&lt;p>This is all well and good for exploring triangular arrangements of numbers that have been extensively studied, however
one may wish to conjecture properties of triangular numbers that are defined in a novel way.&lt;/p>
&lt;p>For instance, the authors of &amp;ldquo;&lt;em>Some properties of the Fibonacci-Pascal triangle&lt;/em>&amp;rdquo; (&lt;a href="https://www.fq.math.ca/Papers1/60-5/sonrod.pdf">Fibonacci Quart. 60 (2022), no. 5,
372–383&lt;/a>) define the so-called &lt;em>Fibonacci-Pascal triangle&lt;/em> via the recurrence&lt;/p>
$$
\begin{equation}
T(n, i) =
\begin{cases}
F_{n+1} &amp; \text{if } i = 0, \\
F_{n+1} &amp; \text{if } i = n, \\
T(n-1, i-1) + T(n-1, i) &amp; \text{otherwise,}
\end{cases}
\end{equation}
$$
&lt;p>
where \(F_i\) is the \(i\)-th Fibonacci number, with \(F_0 = 0\), \(F_1 = 1\), and \(F_n = F_{n-1} + F_{n-2}\) for \(n
\geq 2\).&lt;/p>
&lt;p>By inheriting from the &lt;code>Triangle&lt;/code> base class and overriding the &lt;code>generate_triangle&lt;/code> function, we can define this
triangular arrangement of numbers. Indeed, &lt;code>FibonacciPascalTriangle&lt;/code> is already defined in &lt;code>triforce&lt;/code> by using this
strategy of implementation, so we can just pull it off the shelf.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-py" data-lang="py">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> &lt;span style="color:#f92672">from&lt;/span> triforce.triangles &lt;span style="color:#f92672">import&lt;/span> FibonacciPascalTriangle
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> triangle &lt;span style="color:#f92672">=&lt;/span> FibonacciPascalTriangle(&lt;span style="color:#ae81ff">5&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> print(triangle)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">1&lt;/span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">2&lt;/span> &lt;span style="color:#ae81ff">2&lt;/span> &lt;span style="color:#ae81ff">2&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">3&lt;/span> &lt;span style="color:#ae81ff">4&lt;/span> &lt;span style="color:#ae81ff">4&lt;/span> &lt;span style="color:#ae81ff">3&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">5&lt;/span> &lt;span style="color:#ae81ff">7&lt;/span> &lt;span style="color:#ae81ff">8&lt;/span> &lt;span style="color:#ae81ff">7&lt;/span> &lt;span style="color:#ae81ff">5&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>While their paper is unfortunately pay-walled (thanks, Fibonacci Quarterly!), I can recall that the authors proved a
number of properties about the Fibonacci-Pascal triangle.&lt;/p>
&lt;p>If you have read the blog post this far, you&amp;rsquo;re likely interested in thinking about such things (NERD!). One
&amp;ldquo;exercise-for-the-reader&amp;rdquo; might be to consider a slightly different triangle that has the same recursive structure but
is defined in terms of Lucas numbers instead of Fibonacci numbers.&lt;/p>
&lt;p>Let&amp;rsquo;s define the &lt;em>Lucas-Pascal triangle&lt;/em> via the recurrence
&lt;/p>
$$
\begin{equation}
T(n, i) =
\begin{cases}
L_{n+1} &amp; \text{if } i = 0, \\
L_{n+1} &amp; \text{if } i = n, \\
T(n-1, i-1) + T(n-1, i) &amp; \text{otherwise,}
\end{cases}
\end{equation}
$$
&lt;p>
where \(L_i\) is the \(i\)-th Lucas number, with \(L_0 = 2\), \(L_1 = 1\), and \(L_n = L_{n-1} + L_{n-2}\) for \(n
\geq 2\). Here is a Lucas-Pascal triangle I prepared earlier 🥧:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-py" data-lang="py">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> &lt;span style="color:#f92672">from&lt;/span> triforce.triangles &lt;span style="color:#f92672">import&lt;/span> LucasPascalTriangle
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> triangle &lt;span style="color:#f92672">=&lt;/span> LucasPascalTriangle(&lt;span style="color:#ae81ff">5&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> print(triangle)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">3&lt;/span> &lt;span style="color:#ae81ff">3&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">4&lt;/span> &lt;span style="color:#ae81ff">6&lt;/span> &lt;span style="color:#ae81ff">4&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#ae81ff">7&lt;/span> &lt;span style="color:#ae81ff">10&lt;/span> &lt;span style="color:#ae81ff">10&lt;/span> &lt;span style="color:#ae81ff">7&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">11&lt;/span> &lt;span style="color:#ae81ff">17&lt;/span> &lt;span style="color:#ae81ff">20&lt;/span> &lt;span style="color:#ae81ff">17&lt;/span> &lt;span style="color:#ae81ff">11&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>One question we may want to answer is whether there is a closed-form expression for the row sum. We can look at the
first few values of each row sum of the Lucas-Pascal triangle using &lt;code>triforce&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-py" data-lang="py">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> &lt;span style="color:#f92672">from&lt;/span> triforce.triangles &lt;span style="color:#f92672">import&lt;/span> LucasPascalTriangle
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> triangle &lt;span style="color:#f92672">=&lt;/span> LucasPascalTriangle(&lt;span style="color:#ae81ff">15&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;gt;&amp;gt;&amp;gt;&lt;/span> print(triangle&lt;span style="color:#f92672">.&lt;/span>row_sums())
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>[&lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">6&lt;/span>, &lt;span style="color:#ae81ff">14&lt;/span>, &lt;span style="color:#ae81ff">34&lt;/span>, &lt;span style="color:#ae81ff">76&lt;/span>, &lt;span style="color:#ae81ff">166&lt;/span>, &lt;span style="color:#ae81ff">354&lt;/span>, &lt;span style="color:#ae81ff">744&lt;/span>, &lt;span style="color:#ae81ff">1546&lt;/span>, &lt;span style="color:#ae81ff">3186&lt;/span>, &lt;span style="color:#ae81ff">6524&lt;/span>, &lt;span style="color:#ae81ff">13294&lt;/span>, &lt;span style="color:#ae81ff">26986&lt;/span>, &lt;span style="color:#ae81ff">54616&lt;/span>, &lt;span style="color:#ae81ff">110274&lt;/span>]
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>After playing around with the sum values and the Lucas numbers, I was able to conjecture the following. Let \(n \geq 0\)
be a positive integer. It holds that the row sum of the Lucas-Pascal triangle is given by&lt;/p>
$$
\begin{equation}
\sum_{j=0}^n T(n,j) = 2^n L_4 - 2 L_{n+2}.
\end{equation}
$$
&lt;p>I&amp;rsquo;ll omit the proof, but will mention that an inductive argument is straightforward to prove given the definition of the
triangle. While &lt;code>triforce&lt;/code> can&amp;rsquo;t be used to prove things of course, it can still garner intuition about the triangular
array structure for making conjectures about its properties.&lt;/p>
&lt;h3 id="hexagonal-labyrinths">Hexagonal labyrinths&lt;/h3>
&lt;p>I&amp;rsquo;ll end with an idea I had as a bit of a fever dream when thinking about these triangular arrays and reading the short
story &lt;a href="https://en.wikipedia.org/wiki/The_Library_of_Babel">&amp;ldquo;The Library of Babel&amp;rdquo;&lt;/a> by &lt;a href="https://en.wikipedia.org/wiki/Jorge_Luis_Borges">Jorge Luis
Borges&lt;/a>. In the story, the protagonist describes a labyrinth of
vertically adjacent hexagonal rooms of bookshelves with random books. The books contain every possible ordering of a set
of basic characters and thus contain every book that has been or will be written. The books include the meaning of life,
the cure for cancer, and even verbal sections of this blog post.&lt;/p>
&lt;p>&lt;img alt="library-of-babel" src="https://vrusso.com/blog/library_of_babel.jpg">&lt;/p>
&lt;p>Paradoxically, this information is utterly useless, given its sheer immensity and scope. Inspired by the hexagonal
architecture of this fictional library, we could consider a similar style of recursive structure superimposed on
triangular arrays of numbers.&lt;/p>
&lt;p>There are likely many ways one &lt;em>could&lt;/em> define a hexagonal labyrinth with the above description. One way is as a
recursive sequence of triangular arrays \(\{T_d\}_{d \geq 0}\) where given \(T_d\), for \(d \geq 0\), the array
\(T_{d+1}\) is constructed by extracting entries from \(T_d\) located at positions corresponding to the centers of
hexagonal patterns superimposed on \(T_d\). Specifically, for \(d \geq 0\), we define&lt;/p>
$$
\begin{equation}
T_{d+1}(j, k) = T_d(2(j+1), 2k + 1)
\end{equation}
$$
&lt;p>for \(j \geq 0\) and \(0 \leq k \leq j\). For example, here are some numbers arranged in such a hexagonal configuration:&lt;/p>
&lt;pre tabindex="0">&lt;code> 1
/ \
1---1
/ \
2 1 2
\ /
3---2---2---3
/ \ / \
5 3 4 3 5
8---5---6---6---5---8
...
&lt;/code>&lt;/pre>&lt;p>If one wished, they could extend &lt;code>triforce&lt;/code> to include a &lt;code>labyrinth.py&lt;/code>. Doing so would give similar capabilities to
empiraclly analyze the structure and make claims about the hexagonal labyrinth structures. Given an initial hexagonal
configuration, we could &amp;ldquo;descend&amp;rdquo; into a subsequent layer of the library by selecting a hexagonal center. Then, this
hexagonal center would dictate the starting point of the next triangular arrangement of numbers. Again, this is not the
only way one could define this, but it could be one way of staying &amp;ldquo;true&amp;rdquo; to the literature angle.&lt;/p>
&lt;p>As a bit of fun, we could assign some other names to some of the other attributes of the triangle that are creatively
inspired.&lt;/p>
&lt;p>For instance, we could define the path (or ladder) down from one section of the library to the next as a
&lt;em>Lateralus&lt;/em>. The term &lt;a href="https://en.wikipedia.org/wiki/Lateralus_(song)">&lt;em>Lateralus&lt;/em>&lt;/a> is derived from a song by the band
&lt;a href="https://en.wikipedia.org/wiki/Tool_(band)">Tool&lt;/a>. This song is particularly notable for its syllabic lyrical
construction, which is based off the Fibonacci sequence.&lt;/p>
&lt;p>Another one (perhaps more relevant to the structure at hand) is a &lt;a href="https://en.wikipedia.org/wiki/Hexagon_Sun">hexagon
sun&lt;/a> from the band &lt;a href="https://en.wikipedia.org/wiki/Boards_of_Canada">Boards of
Canada&lt;/a>. What is a &amp;ldquo;hexagon sun&amp;rdquo;? Well, it could be the hexagonal
configurations with the rays emanating from these configurations. Is it possible to determine an equation for hexagonal
suns for a given level of the labyrinth?&lt;/p>
&lt;p>Is it worth thinking about such a structure? Is it worth thinking about such properties within these structures? I don&amp;rsquo;t
know. I thought that the juxtaposition of a mathematical construct against something inspired by literature and music
was kind of cool. Others have thought about such structures within triangular arrays before (for instance, the &lt;a href="https://en.wikipedia.org/wiki/Star_of_David_theorem">&amp;ldquo;Star of
David&amp;rdquo;&lt;/a> theorem for triangular arrangements of numbers was surely
inspired by such a melding of comparisons).&lt;/p>
&lt;p>&lt;img alt="star-of-david" src="https://vrusso.com/blog/star_of_david.png">&lt;/p>
&lt;p>There&amp;rsquo;s obviously a lot of freedom with how one could define this type of structure and maybe even one of them would be
worthwhile to think about. I welcome any input on the above (very rough) thoughts and ideas as well as any pull-requests for the
&lt;code>triforce&lt;/code> package.&lt;/p></content></item></channel></rss>