Yu-Liang Wu

Entropy of Markov-Cayley tree-shifts

4 min read

Backgrounds

Let 𝒜 be a finite alphabet and K be a k-by-k, 0-1 matrix. A Markov-Cayley tree TK is subset of a free semigroup with generators [k]={1,2,⋯,k}:

TK={g∈∪i≥0[k]i:Kgi,gi+1=1, for all i≥1}。

A Markov-Cayley tree-shifts X𝐀, associated with a k-tuple of 0-1 matrices 𝐀=(A(1),A(2),⋯,A(k)), over TK is a subset of 𝒜TK defined as

X𝐀={x∈𝒜TK:Axg,xgi(i)=1, for all g∈TK,i∈[k] such that gi∈Tk}.

The topological entropy of TK is defined to be

h(X𝐀)=limn→∞⁡hn(i)(X𝐀):=limn→∞⁡log⁡pn(i)(X𝐀)#Δn(i) for i∈[k],

where Δn(i) is the set {g∈TK:g is of length n with i its prefix} and pn(i)=#{x|Δn(i):x∈XA}. If we further define pn;a(i)=#{x|Δn(i):x∈XA,xϵ=a} (so that pn(i)=∑apn;a(i)), one can compute hn(i) via the following recursive relation:

{pn+1;a(i)=∏j:Ki,j=1∑b:Aa,b(i)=1pn;b(j)(#Δn+1(i)−1)=1+∏j:Ki,j=1(#Δn(j)−1)

We remark that pn;a(i), at fastest, grows superexponentially in n, and is too large to store as a number. To address the issue, a naive solution is to normalize pn;a(i) by Dn(i)=maxb⁡pn;b(i), which we denote by p─n;a(i)=pn;a(i)/Dn(i), and rephrase the recursion in terms of p─n;a(i):

{p─n+1;a(i)⋅Cn+1(i)=∏j:Ki,j=1∑b:Aa,b(i)=1p─n;b(j)log⁡Dn+1(i)=log⁡Cn+1(i)+∑j:Ki,j=1log⁡Dn(j)(#Δn+1(i)−1)=1+∏j:Ki,j=1(#Δn(j)−1),

where Cn+1(i):=maxa⁡∏j:Ki,j=1∑b:Aa,b(i)=1. Note that we now can approximate entropy using Dn(i) since log⁡Dn(i)/log⁡pn(i)(X𝐀)→1, and that log⁡Dn(i) grows only exponentially in n.

Program

K=[1 1;1 1]
2×2 Matrix{Int64}:
 1  1
 1  1
A = ([0 1 1;1 0 0;1 0 0], [1 1 1;1 0 0;1 0 1])
([0 1 1; 1 0 0; 1 0 0], [1 1 1; 1 0 0; 1 0 1])
"""
`function mctree_entropy(K, A, max_iter=50)`
The function returns the entropy \$h^{(i)}_n(X_{\\mathbf{A}}) \$ of the Markov tree-shifts \$X_{\\mathbf{A}}\$ over the Markov-Cayley tree \$T_K\$ associated with matrix ``K``, where
- `K` is the defining `k`-by-`k` matrix for the Markov-Cayley tree
- `A` is a vector of `k` adjacency matrices
- `max_iter` is the maximal number of iterations
"""
function mctree_entropy(K, A, max_iter=50)
    norm_pattern_num = ones(size(K,2), size(A[1],2), max_iter) # normalized number of patterns
    log_pattern_num = zeros(size(K,2), max_iter) # logarithm of pattern numbers (D^{(i)}_n)
    entropy = zeros(size(K,2), max_iter) # n-order approximation of entropy
    norm_const = ones(size(K,2), max_iter) # normalization constant (C^{(i)}_n)
    lattice_point_num = ones(size(K,2), max_iter) # numbers of lattice points (\# \Delta^{(i)}_n - 1)
    break_flag = false # break flag: terminate iteration if converged
    end_iter = 0 # number of executed iterations
    for i in 2:max_iter
        lattice_point_num[:,i] = K * lattice_point_num[:,i-1] .+ 1;
        for j in 1:size(K,2)
            temp = ones(size(A[1],2),1);
            for k in 1:size(K,2)
                if K[j,k] == 1
                    temp = temp .* (A[k] * norm_pattern_num[k,:,i-1]);
                end
            end
            norm_const[j,i] = maximum(temp);
            norm_pattern_num[j,:,i] = temp / norm_const[j,i];
            log_pattern_num[j,i] = K[j,:]' * log_pattern_num[:,i-1] + log10(norm_const[j,i]);
            entropy[j,i] = log_pattern_num[j,i] / lattice_point_num[j,i];
            if log_pattern_num[j,i] == -Inf
                break_flag = true;
                break;
            elseif abs(entropy[j,i] - entropy[j,i-1]) / entropy[j,i] < 1E-11 || entropy[j,i] < 1E-11
                break_flag = true;
                break;
            end
        end
        end_iter = i
        if break_flag
            end_iter = i-1;
            break
        end
    end
    return maximum(entropy[:,1:end_iter], dims = 1)
end
mctree_entropy
mctree_entropy(K,A)
1×36 Matrix{Float64}:
 0.0  0.259384  0.240177  0.26464  0.258857  0.264113  0.262379  0.26366  0.263177  0.263501  0.263375  0.263457  0.263425  0.263446  0.263438  0.263443  0.263441  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442  0.263442

Related posts

Learning Julia

1 min read

Workshop notes on programming in Julia — covering installation, basics, plotting, and advanced topics.

Advanced Topics

9 min read

Advanced Julia — structs, multiple dispatch, and the type system.

Basics

20 min read

Introduction to Julia fundamentals — variables, types, functions, and control flow.