<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>April 19, 2018: splitting from Pascal notebookAbstractTheory of matrix functions, with applications to generation matrix $\mathcal{H}$.<jupyter_code>from sympy import *
from sympy.abc import n, i, N, x, lamda, phi, z, j, r, k, a, alpha, beta

from commons import *
from matrix_functions import *
from sequences import *
import functions_catalog

init_printing()
d,h = IndexedBase('d'), IndexedBase('h')
alpha, beta, gamma = symbols(r'\alpha \beta \gamma')<jupyter_output><empty_output><jupyter_text>Generation matrix $\mathcal{H}$see https://en.wikipedia.org/wiki/Pascal_matrix<jupyter_code>m = 16
H = define(Symbol(r'\mathcal{{H}}_{{ {} }}'.format(m)), 
           Matrix(m, m, lambda n, k: 0 if n==m/2 or n!=k+1 else -h[-(k-(m/S(2))+2)] if n<m/2 else h[k-(m/S(2))]))
H
f = Function('E')
f_expt = define(let=f(z), be=exp(z))
f_expt
eigendata = spectrum(H)
eigendata
data, eigenvals, multiplicities = eigendata.rhs
Phi_polynomials = component_polynomials(eigendata, early_eigenvals_subs=True)
Phi_polynomials
g_expt = Hermite_interpolation_polynomial(f_expt, eigendata, Phi_polynomials)
#g_expt
g_expt = g_expt.subs(eigenvals)
g_expt
with lift_to_matrix_function(g_expt) as G_expt:
    H_expt = G_expt(H)
H_expt
production_matrix(H_expt.rhs[7:,7:])
H_expt.rhs.subs({h[0]:1,h[1]:1,h[2]:1, h[3]:1,h[4]:1,h[5]:1,h[6]:1})
H_expt.rhs.subs({h[0]:1,h[1]:2,h[2]:3, h[3]:4,h[4]:5,h[5]:6,h[6]:7})
H_expt.rhs.subs({h[0]:1,h[1]:1,h[2]:2, h[3]:3,h[4]:5,h[5]:8,h[6]:13})
H_expt.rhs.subs({h[0]:1,h[1]:1,h[2]:2, h[3]:5,h[4]:14,h[5]:42})
H_expt.rhs.subs({h[0]:factorial(0),h[1]:factorial(1),h[2]:factorial(2), 
                 h[3]:factorial(3),h[4]:factorial(4), h[5]:factorial(5), 
                 h[6]:factorial(6)})
H_expt.rhs.subs({h[0]:2**0,h[1]:2**1,h[2]:2**2, h[3]:2**3,h[4]:2**4,h[5]:2**5,h[6]:2**6})
H_expt.rhs.subs({h[0]:1,h[1]:3,h[2]:6, h[3]:10,h[4]:15,h[5]:21,h[6]:28})<jupyter_output><empty_output><jupyter_text>Areated generation matrix $\mathcal{H}$<jupyter_code>m = 16
H = define(Symbol(r'\mathcal{{H}}_{{ {} }}'.format(m)), 
           Matrix(m, m, lambda n, k: 0 if n==m/2 or n!=k+2 else -h[-(k-(m/S(2))+3)] if n<m/2 else h[k-(m/S(2))+1]))
H
f = Function('E')
f_expt = define(let=f(z), be=exp(z))
f_expt
eigendata = spectrum(H)
eigendata
data, eigenvals, multiplicities = eigendata.rhs
Phi_polynomials = component_polynomials(eigendata, early_eigenvals_subs=True)
Phi_polynomials
g_expt = Hermite_interpolation_polynomial(f_expt, eigendata, Phi_polynomials)
#g_expt
g_expt = g_expt.subs(eigenvals)
g_expt
with lift_to_matrix_function(g_expt) as G_expt:
    H_expt = G_expt(H)
H_expt
H_expt.rhs.subs({h[0]:1,h[1]:2,h[2]:3, h[3]:4,h[4]:5,h[5]:6,h[6]:7})<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21722454672245467, 'fraction_numerical': 0.054741980474198045, 'mean_word_length': 6.86027397260274, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '221178', 'license': 'MIT', 'n_tokens_mistral': 1392, 'n_tokens_neox': 1368, 'n_words': 195, 'path': 'notes/matrices-functions/H-generation-matrix.ipynb', 'repo_name': 'massimo-nocentini/simulation-methods', 'size': '2879'}