% for each k <= kmax the rows in G contain the entries mu,
% alpha_{lambda_mu} and the rows in Phi contain the entries j, mu, alphatilde_{j lambda_mu}
% use the recurrence formula where lambda = (lambda[m[1]],...,lambda[mu[k]])
% coeff*Phi[j](lambda)
% -> coeff/j!*G(lambda)
% -> coeff*Phi[j+1](lambda,lambda(k))
% -> coeff/j!*Phi[1](lambda,lambda(k+1))

clear all;
format rational; 

kmax = 6;

% k = 0
G = [];
coeff = 1;
j = 1; 
mu = 1;
Phi = [j,mu,coeff];

for k = 1:kmax
    k 
    dim_Phi = size(Phi);
    d1 = dim_Phi(1); 
    d2 = dim_Phi(2); 
    G_new = [];
    Phi_new = [];
    for i = 1:d1 
        j = Phi(i,1);
        mu = Phi(i,2:(d2-1));
        dim_mu = length(mu);
        coeff = Phi(i,d2);
        G_new = [G_new;mu,coeff/factorial(j)];
        Phi_new = [Phi_new;j+1,mu,mu(dim_mu),coeff;1,mu,mu(dim_mu)+1,coeff/factorial(j)];
    end
    G = G_new
    Phi = Phi_new;
end 