STATUS: Draft
import numpy as np
import sympy as sp
import pickle
from IPython.display import HTML, Image
import ipywidgets as widgets
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
mpl.rcParams['legend.fontsize'] = 10
import pandas as pd
import itertools
pd.set_option('display.max_colwidth', None)
import treelib as tr
# function to print latex
def renderListToLatex(e):
latex_rendering = []
for i in range(len(e)):
latex_rendering.append("$$" + sp.latex(e[i]) + "$$")
return(HTML("".join(latex_rendering[0:])))
Aim: Explore bridge between BiTri numbers and polygonal subdivisions
Methodology: Consider the structure of the first row of numbers in the matrix of coefficients returned by the function $C$
Observe: Recall the solution to a general cubic equation from a previous notebook.
$$C(m, n) \equiv \frac{(2m + 3n)!}{(1 + m + 2n)!m!n!}$$Let $F1$ for a function that implements $C$.
def F1(m2, m3, returnCoefficientsOnly = False, returnCoefficientsOnlyWithoutSigns = True, returnCoefficientsAsFactorialStrings = False):
c_0, c_1, c_2, c_3 = sp.symbols('c_0, c_1, c_2, c_3')
s1 = (-1)**(m3 + 1)
s2 = sp.factorial(2 * m2 + 3 * m3)
s3 = sp.factorial(1 + m2 + 2 * m3) * sp.factorial(m2) * sp.factorial(m3)
s4 = c_0**(1 + m2 + 2 * m3) * c_2**m2 *c_3**m3
s5 = c_1**(2 * m2 + 3 * m3 + 1)
s7 = str(2 * m2 + 3 * m3) + "!"
s8 = str(1 + m2 + 2 * m3) + "!" + str(m2) + "!" + str(m3) + "!"
if returnCoefficientsOnly:
s6 = s1 * (s2 / s3)
elif returnCoefficientsOnlyWithoutSigns:
s6 = (s2 / s3)
elif returnCoefficientsAsFactorialStrings:
s6 = str(s7 + " | " + s8)
else:
s6 = s1 * (s2 / s3) * (s4 / s5)
return(s6)
Let $P3$ be a matrix of values relating the part of the formula that calculates unsigned coefficients: $ \frac{(2m + 3n)!}{(1 + m + 2n)!m!n!}$
P1 = np.arange(8)
P2 = np.array([[F1(j, i) for i in P1] for j in P1])
P3 = sp.Matrix(P2)
P3
Observe: It is not a given that the solutions to cubic equation should be related to BiTri numbers and more investigation is needed.
Definition: A BiTri Roofed Polygon consists of a polygon subdivided diagonally into traingles, with a distinguised (top) edge.
Conjecture: The numbers $C(n, m)$ give us a power series solution to a general cubic equation, and they count the number of BiTri polygons with $m$ triangles and $n$ quadrilaterals, with $1 + m + 2n$ vertices
Let $F2$ be a function that returns the number of vertices for polygons in $P3$.
def F2(m, n):
return(2 + m + 2 * n)
Let $P6$ be an $8 \times 8$ array of the number or vertices in $P3$
P4 = np.arange(8)
P5 = np.array([[F2(j, i) for i in P4] for j in P4])
P6 = sp.Matrix(P5)
P6
Observe: The above matrices show that there are, for example, 10010 ways to subdivide roofed 11-gons into 3 triangles and 3 quadrilaterals.
Observe: The above conjecture proposes a way to to unify a fundamental problem of algebra with large scale extension of Catalan and Fuss numbers.
Observe: To investigate further it will be required to extend the binary and ternary operations seen in previous notebooks to BiTri roofed polygons.
Observe: Recall that $ \overline{\triangledown} \text{ }(P, Q) = P \text{ } \overline{\triangledown} \text{ } Q $ is a binary operation that appends $P$ and $Q$ to left and right sides of a roofed central triangle, where $P$ and $Q$ are BiTri rooted polygons.
Observe: It is possible to extend the operation, $\overline { \triangledown }$ to BiTri rooted polygons.
Observe: To make this extension a symbol$ \overline{\square}$ can be used.
Observe: The symbol can be used in the context of the operation $ \overline{\square} \text{ }(P, Q, R) $ relating to BiTri roofed polygons, where 3 polygons can be be glued on to central quadrilateral.
Observe: The BiTri roofted polygons are then closed under the two operations, $\overline{\triangledown}$ and $\overline{\square}$.
Todo: Create functions for both of these operations, notign that vertical is showing how many triangles, and horizontal is showing how many quadrilaterals.
Observe: These polygons can be viewed in a multset array and it is possible to do consistent arithmetic with them.
Reference: The approach is related to Q22 of Ch. 7 in Concrete Mathematics (Knuth et al) which considers multiset operations of the BiTri roof polygons.
Aim: Demonstrate an identity of multisets
Let $A$ be the entire Mset of BiTri rootfted polygons. It follows that:
$$A = | + \overline{\triangledown}(A, A) + \overline{\square}\text{ }(A, A, A)$$Observe: This is a fundamental identity of multisets.
Observe: Both operations can be used to compute all numbers in this array.
Observe: It is possible to link the abstract algebra of MSets to polynomials. To make this link, the symbol $\psi$ can be used to count the number of triangles, and the symbol $q$ can be used to count the number of quadrilaterals.
Observe: The $\psi$ mapping from BiTri roofed polygons can be extended to polynomials in $t$ and $q$:
$$ \psi(P) \equiv t^m q^n $$where$P$ has $m$ triangles and $n$ quadrilaterals
Example
$$ \psi \text{ (some polygon with 2 triangles and 2 quadrilaterals)} = t^2 q^2 $$Observe: This will lead to the following properties (and note the extra $t$ and extra $q$ that arises here).
$$ \psi(\overline{\triangledown}(P, Q) = t \psi (P) \psi(Q) $$Observe: If $\psi(A) \equiv F$ where $F$ is an MSet, and noting that $A = | + \overline{\triangledown}(A, A) + \overline{\square}\text{ }(A, A, A)$, the $\psi$ operation will replace each polygon in the array with powers of $t$ and $q$ where those powers represent the number of triangles and quadrilaterals.
Example: The number $28$ in the above array becomes $tq^2$ under this $\psi$ mapping.
Observe: the operation $F = 1 + tF^2 + qF^3 $ capures all the operations plus addtional triangle.
Observe The expression above cubic equation in $F$. Note this is close to a general cubic equation, and helps to explain why there is a relationship between solutions to cubic equations and the BiTri roofed polygons.
Ovserve
Aim: Check to see if the BiTri Array satisfies the above identities.
P7 = np.arange(6)
P8 = np.array([[F1(j, i) for i in P7] for j in P7])
P9 = sp.Matrix(P8)
P9
Let $t$ and $q$ be unknown types
t, q = sp.symbols('t q')
Let $P10$ and $P11$ be matrices.
P10 = sp.Matrix([t**i for i in range(6)])
P10 = P10.transpose()
P10
P11 = sp.Matrix([q**i for i in range(6)])
P11
Let $P12$ be the matrix multiplication of $P10 \times P9 \times P11$.
P12 = sp.expand(P10 * P9 * P11)[0]
P12
Let $P12$ be the identity $$F = 1 + tF^2 + qF^3 $$
Let $P13$ be a verification that this holds up to degree 5
P13 = sp.expand(1 + t * P12**2 + q * P12**3).series(q, 0, 6).removeO()
P13
P14 = sp.expand(sp.expand(P13).series(t, 0, 6).removeO())
P14
Observe: $P14 \equiv P12$, verifying that, up do degree 5, these numbers are counting BiTri Roofed polygons, which confirms the conjecture.