<jupyter_start><jupyter_text><img src="http://www.cerm.unifi.it/chianti/images/logo%20unifi_positivo.jpg"         alt="UniFI logo" style="float:left;width:20%;height:20%;"> <NAME>September 27, 2016: refactoring and syncAbstractIn this notebook we study the *Pascal triangle*, locking at it recursively: using it's $A$-sequence, we perform a series of unfolding using the main recurrence relation, where subscripts dependends on *two* dimensions, as rewriting rule. This is a natural enhancement to the case of recurrences where subscripts have *one* dimension only, as the *Fibonacci* sequence; on the other hand, Pascal array is a deeply studied and well know triangle, yet simple, toy we can play with.<jupyter_code>%run "../src/start_session.py"
%run "../src/recurrences.py"
import oeis<jupyter_output><empty_output><jupyter_text>Pascal array $\mathcal{P}$This notebook studies the Riordan array $\mathcal{P}$, aka the *Pascal triangle*, defined according to the following definition:$$\mathcal{P}=\left(\frac{1}{1-t}, \frac{t}{1-t}\right)$$with $A$-sequence $A(t)=1+t$ and $Z$-sequence $Z(t)=1$.<jupyter_code>d = IndexedBase('d')
n, k = symbols('n k')

pascal_recurrence_spec = recurrence_spec(recurrence_eq=Eq(d[n+1, k+1], d[n, k] + d[n, k+1]), 
                                         recurrence_symbol=d, 
                                         variables=[n,k])
pascal_recurrence_spec
unfolded = pascal_recurrence_spec.unfold(depth=2)
unfolded
instantiated = unfolded.instantiate(strategy=raw(substitutions={n:9,k:4}))
instantiated
known_binomials = {d[n,k]:binomial(n,k) for n in [7] for k in range(2,6)}

checked = instantiated.instantiate(strategy=raw(substitutions=known_binomials))
checked
checked.subsume()
based_recurrence_spec = unfolded.instantiate(strategy=based(arity=doubly_indexed()))
based_recurrence_spec
based_recurrence_spec.subsume()
ipython_latex_description(rec_spec=pascal_recurrence_spec, depths=range(6), arity=doubly_indexed())<jupyter_output><empty_output><jupyter_text>OEIS content about $\mathcal{P}$<jupyter_code>s = oeis.oeis_search(id=7318)
s()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.130558183538316, 'fraction_numerical': 0.01466414380321665, 'mean_word_length': 5.866883116883117, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '517849', 'license': 'Apache-2.0', 'n_tokens_mistral': 758, 'n_tokens_neox': 705, 'n_words': 162, 'path': 'notebooks/pascal-array-doubly-indexed-unfolding.ipynb', 'repo_name': 'massimo-nocentini/Ph.D', 'size': '2125'}