Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate a Krawtchouk matrix
ResourceFunction["KrawtchoukMatrix"][n] returns an n×n Krawtchouk matrix. |
A 4×4 Krawtchouk matrix:
In[1]:= | ![]() |
Out[1]= | ![]() |
Visualize the entries of a Krawtchouk matrix:
In[2]:= | ![]() |
Out[2]= | ![]() |
A normalized Krawtchouk matrix:
In[3]:= | ![]() |
Out[3]= | ![]() |
The normalized matrix is both symmetric and orthogonal:
In[4]:= | ![]() |
Out[4]= | ![]() |
By default, an exact matrix is computed:
In[5]:= | ![]() |
Out[5]= | ![]() |
Use machine precision:
In[6]:= | ![]() |
Out[6]= | ![]() |
Use arbitrary precision:
In[7]:= | ![]() |
Out[7]= | ![]() |
Define a symmetrized version of the Krawtchouk matrix:
In[8]:= | ![]() |
The symmetrized Krawtchouk matrix is symmetric, as its name implies:
In[9]:= | ![]() |
Out[9]= | ![]() |
In[10]:= | ![]() |
Out[10]= | ![]() |
The symmetrized Krawtchouk matrix gives the coefficients of the bivariate polynomial (1+x+y-x y)n-1:
In[11]:= | ![]() |
Out[11]= | ![]() |
Demonstrate a recursive method for generating the symmetrized Krawtchouk matrix:
In[12]:= | ![]() |
Out[12]= | ![]() |
The Kac matrix is a tridiagonal matrix whose subdiagonal and superdiagonal entries are consecutive integers:
In[13]:= | ![]() |
In[14]:= | ![]() |
Out[14]= | ![]() |
The Kac matrix can be diagonalized by the symmetrized Krawtchouk matrix:
In[15]:= | ![]() |
Out[15]= | ![]() |
Columns of the Krawtchouk matrix can be determined from the coefficients of the polynomial (1+x)n-j-1(1-x)j:
In[16]:= | ![]() |
Out[16]= | ![]() |
In[17]:= | ![]() |
Out[17]= | ![]() |
The entries of the Krawtchouk matrix can be expressed in terms of the Krawtchouk polynomial, which can be expressed in terms of Hypergeometric2F1:
In[18]:= | ![]() |
Out[18]= | ![]() |
In[19]:= | ![]() |
Out[19]= | ![]() |
Generate the Krawtchouk matrix through a recursive definition:
In[20]:= | ![]() |
Out[20]= | ![]() |
In[21]:= | ![]() |
Out[21]= | ![]() |
The product of a Krawtchouk matrix with itself is a constant multiple of the identity matrix of the same size:
In[22]:= | ![]() |
Out[22]= | ![]() |
Generate a Krawtchouk matrix from a Hadamard matrix, using condensation of the rows and columns with the same binary weights (number of 1's in the binary representation):
In[23]:= | ![]() |
Out[24]= | ![]() |
Verify that the result is a Krawtchouk matrix:
In[25]:= | ![]() |
Out[25]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License