--- format: html: html-math-method: katex --- Notes on Pseudo-Taylor Series ============================= Whilst examining type algebra, I found that the geometric series, a cornerstone of calculus, could be derived by analyzing its definition as a rewrite rule. That is, $(1 - X)^{-1}$ is expressed similarly to an exponential object; when it is written as $-1 \rightarrow (1 - X)$, it can be interpreted thus: $$ (1 - X)^{-1} = -1 ~\rightarrow~ 1 - X \\ \\ \begin{matrix} -1 & \rightarrow& 1 - X \\&& 1 + (-1) \times X & \rightarrow & 1 +(1 - X)X \\ & & & & 1 + X + (- 1) \times X^2 & \rightarrow & 1 + X + (1-X)X^2 \\ &&&&&& ... \end{matrix} $$ Which, in the limit, becomes the geometric series $$ 1 + X + X^2 + X^3 + X^4 + ... = \sum_{n=0}^\infty X^n $$ I would like dedicate a bit more of my time to examining this apparent correspondence between Taylor series and rewrite rules, which as far as I can tell, appears to be new territory. Why is -1 Special? ------------------ One of my first questions upon seeing this was why -1 is special. In type theory, integers can represent the number of values which occupy a type. Naturally (if you'll pardon the pun), this only makes sense for the positives and zero. But what is it that distinguishes -1 from any other negative number? Naively, we can examine what happens when examining $-2 \rightarrow 1 - 2X$: $$ \textcolor{blue}{-2} \rightarrow 1 - 2X \\ \begin{matrix} \textcolor{blue}{-2} & \stackrel{?}{\rightarrow} & 1 - 2X \\&& 1 + (\textcolor{blue}{-2}) \times X & \stackrel{?}{\rightarrow} & 1 +(1 - 2X)X \\ & & & & 1 + X + (\textcolor{blue}{-2}) \times X^2 & \stackrel{?}{\rightarrow} & 1 + X + (1-2X)X^2 \\ &&&&&& ... \end{matrix} $$ But we know that this arrowed expression should evaluate to $(1-2X)^{-2}$ $$ \textcolor{blue}{-2} \rightarrow 1 - 2X = (1 - 2X)^{-2} = (1 - 4X + 4X^2)^{-1} = \textcolor{red}{-1} \rightarrow 1 - 4X + 4X^2 \\ \ \\ \begin{matrix} \textcolor{red}{-1} & \rightarrow & 1 - 4X + 4X^2 \\&& 1 + (\textcolor{red}{-1}) \times 4X + 4X^2 & \rightarrow & 1 +(1 - 4X + 4X^2) \times 4X + 4X^2 \\ & & & & 1 + 4X - 12X^2 + 16X^3 \\ & & & & 1 + 4X + (\textcolor{red}{-1}) \times 12X^2 + 16X^3 & \rightarrow & ... \end{matrix} $$ Continuing the rewrite rule gives coefficients of 12, 32, 80, 192... for $X^2$ onward. And indeed, the [Taylor series for the reciprocal](https://www.wolframalpha.com/input?i=taylor+series+%281+-+4X+%2B+4X%5E2%29%5E-1) of $1 - 4X + 4X^2$ is This gives us a bit more information: -1 is special because it factors out of all other negatives. From there, we can evaluate the remaining positive exponent by the binomial theorem. Ordering -------- What happens when there are multiple negatives in the denominator? For example, the expression $(1 - X -X^2)^{-1}$ has the Fibonacci numbers as its Taylor series coefficients. If we try replacing all the -1s at once, we don't even come close past the first numbers: $$ {1 \over 1 - X -X^2} = \textcolor{red}{-1} \rightarrow 1 - X - X^2 \\ \ \\ \begin{matrix} \textcolor{red}{-1} & \rightarrow & 1 - X - X^2 \\&& 1 + (\textcolor{red}{-1}) \times X + (\textcolor{red}{-1}) \times X^2 & \rightarrow & 1 + (1 - X - X^2 )X + (1 - X - X^2 )X^2 \\ & & & & 1 + X - X^2 - X^3 + X^2 - X^3 - X^4 \\ & & & & 1 + X - 2X^3 - X^4 \\ & & & & 1 + X + (\textcolor{red}{-1}) \times 2X^3 + (\textcolor{red}{-1}) \times X^4 \\ & & & & ... \end{matrix} $$ The [katex]X^2[/katex] terms cancel after the first iterated replacement. This is clearly not right; the Fibonacci number following two 1's is 2. In fact, all is well if we replace less aggressively. $$ \begin{matrix} \textcolor{red}{-1} & \rightarrow & 1 - X - X^2 \\&& 1 + (\textcolor{red}{-1}) \times X -X^2 & \rightarrow & 1 + (1 - X - X^2 ) \times X - X^2 \\ & & & & 1 + X - X^2 - X^3 -X^2 \\ & & & & 1 + X - 2X^3 - X^3 \\ & & 1 + X+ (1- X - X^2)\times2X^2 - X^3 & \leftarrow & 1 + X + (\textcolor{red}{-1}) \times 2X^2 - X^3 \\ & & 1 + X + 2X^2 - 2X^3 - 2X^4 - X^3 \\ & & 1 + X + 2X^2 - 3X^3 - 2X^4 \\ & & 1 + X + 2X^2 + (\textcolor{red}{-1})\times 3X^3 - 2X^4 & \rightarrow & ... \end{matrix} \\ \ \\ {1 \over 1 - X - X^2} = 1 + X + 2X^2 + 3X^3 + 5X^4 + 8X^5 + ... $$ This gives us another way of obtaining the generating function for the Fibonacci numbers. $$ {1 \over 1 - X -X^2} = \textcolor{red}{-1} \rightarrow 1 - X - X^2 \\ \ \\ \begin{matrix} \textcolor{red}{-1} & \rightarrow & F_0 + F_1 X + F_2 X^2 + ... - F_{n-1} X^{n-1} - F_{n-2} X^n \\ & & ... + (-1) \times F_{n-1} X^{n-1} - F_{n-2} X^n \\ & & \downarrow \\ & & ... + (1 - X - X^2) \times F_{n-1} X^{n-1} - F_{n-2} X^n \\ & & ... + F_{n-1} X^{n-1} - F_{n-1} X^n - F_{n-1} X^{n+1} - F_{n-2} X^n \\ & & ... + F_{n-1} X^{n-1} - (F_{n-1} + F_{n-2}) X^n - F_{n-1} X^{n+1} \\ & & ... + F_{n-1} X^{n-1} - F_n X^n - F_{n-1} X^{n+1} \end{matrix} $$ Complex Roots ------------- Negatives? Must have a pole? Continued Fractions ------------------- I am the most interested in generalizing rewrite rule-style types. The recursive equation for a forest is actually similar to the continued fraction for the Catalan numbers: $$ F(X) = {1 \over 1 - X \times F(X)} = {1 \over 1 - X \times {1 \over 1 - X \times F(X)}} =...= \cfrac{1}{1 - \cfrac{X}{1- \cfrac{X}{1- \cfrac{X}{_\ddots} }}} \\ = 1 + X\times F(X) + X^2 \times F(X)^2 +X^3 \times F(X)^3 + ... \\ = 1 + X + 2X^2 +5X^3 + 14X^4 + 42X^5+... $$ Successively replacing F(X) with itself will produce the desired series. Access to -1 and exponentials implies access to fractions and all surds.