In [1]:
from sympy import *
from sympy.abc import n, i, N, x, lamda, phi, z, j, r, k, a, alpha
from commons import *
from matrix_functions import *
from sequences import *
import functions_catalog
init_printing()
In [2]:
m = 10
In [3]:
eP = Matrix(m, m, lambda n,k: factorial(n)*binomial(n,k)/factorial(k))
eP
Out[3]:
In [6]:
inspect(eP)
Out[6]:
In [7]:
eP_pm = production_matrix(eP)
eP_epm = production_matrix(eP, exp=True)
eP_pm, eP_epm
Out[7]:
In [10]:
F = Matrix(m, m, diagonal_func_matrix(factorial))
F_inv = F**(-1)
F, F_inv
Out[10]:
In order to factorize eP
as F U F^{-1}
, for some matrix U
In [11]:
B = F_inv * eP * F
B
Out[11]:
In [12]:
U = Matrix(m, m, rows_shift_matrix(by=1))
U
Out[12]:
In [13]:
F_inv * U * F
Out[13]:
In [14]:
F_inv * U * F * B
Out[14]:
In [15]:
B**(-1) * F_inv * U * F * B
Out[15]:
In [16]:
F * B**(-1) * F_inv * U * F * B * F_inv
Out[16]:
In [17]:
P = Matrix(m, m, binomial)
In [18]:
P_bar = Matrix(m, m, lambda i, j: binomial(i, j) if j < i else 0)
P_bar
Out[18]:
In [20]:
production_matrix(P_bar[1:,:-1], exp=False), production_matrix(P_bar[1:,:-1], exp=True)
Out[20]:
In [21]:
j=3
(P_bar**j).applyfunc(lambda i: i/factorial(j))
Out[21]:
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.