Using kron is a sensible option for this cross product of Td1 and Td2 and creating Td as a function?

5 views (last 30 days)
function Td1 = compute_Td1(M)
% Create a matrix of binomial coefficients
[I, J] = ndgrid(1:M, 1:M);
binomials = zeros(M, M);
for i = 1:M
binomials(i, 1:i) = arrayfun(@(ii, jj) nchoosek(ii-1, jj-1), I(i, 1:i), J(i, 1:i));
end
% Create a matrix for powers
powers = ((- (M - 1) / 2) .^ (I - J)) .* (J <= I);
% Element-wise multiplication to get Td1
Td1 = binomials .* powers;
end
function Td2 = compute_Td2(M)
% Initialize Td2 with identity
Td2 = eye(M+1);
for n = 2:M+1
for k = 2:n-1
Td2(n, k) = Td2(n-1, k-1) - (n-2) * Td2(n-1, k);
end
end
Td2 = Td2(2:M+1, 2:M+1);
end
M= 3;
Td1 = compute_Td1(M);
disp('T_d^1:');
disp(Td1);
Td2 = compute_Td2(M);
disp('T_d^2:');
disp(Td2);
M= 5;
Td1 = compute_Td1(M);
disp('T_d^1:');
disp(Td1);
Td2 = compute_Td2(M);
disp('T_d^2:');
disp(Td2);
Td = kron(Td1,Td2);
disp('T_d:');
disp(Td);
T_d:
1 0 0 0 0 0 0 0 0
-1 1 0 0 0 0 0 0 0
2 -3 1 0 0 0 0 0 0
-1 0 0 1 0 0 0 0 0
1 -1 0 -1 1 0 0 0 0
-2 3 -1 2 -3 1 0 0 0
1 0 0 -2 0 0 1 0 0
-1 1 0 2 -2 0 -1 1 0
2 -3 1 -4 6 -2 2 -3 1
Using Kron is a suitable choice or not please explain is it possible to recreate Td as a function using cross product of Td1 and Td2 ?
  1 Comment
Matt J
Matt J on 21 Oct 2024
Edited: Matt J on 21 Oct 2024
The cross-product is an operation defined on 3x1 vectors.
But Td1 and Td2 are 5x5 matrices, as you've defined them. There is no such thing as a cross-product of 5x5 matrices.
Please give the necessary context and mathematical aims of this problem, so that it may be better understood.

Sign in to comment.

Accepted Answer

R
R on 21 Oct 2024
Using the Kronecker product to combine Td1 and Td2 makes a lot of sense here. If you want to blend the structures of both matrices into one larger matrix while keeping their individual characteristics, the Kronecker product is a solid choice. It’s particularly handy for creating block matrices where you want to maintain relationships across different dimensions.
When you take the Kronecker product of two matrices A and B, you end up with a bigger matrix. Each element of A gets multiplied by the entire matrix B. This approach is super useful in various applications, especially in multi-dimensional systems or when working with tensor products.
What About the Cross Product? Now, if you’re thinking about using something like a cross product to combine Td1 and Td2, it’s not really going to work. The cross product usually refers to a vector operation in three dimensions, and it doesn’t apply well to matrices in this context. Here’s why:
  1. Different Dimensions: The Kronecker product effectively combines all elements from both matrices, while the cross product gives you a new vector that’s perpendicular to the original vectors. That doesn’t really help when you’re just trying to multiply matrices.
  2. Structure Preservation: The Kronecker product keeps the relationships and structures of both matrices intact, which you wouldn’t achieve with a cross product.
In short:
  • Go ahead and use the Kronecker product to create Td from Td1 and Td2. It’ll keep the interactions you need.
  • A cross product isn’t the right tool for this job because it doesn’t fit with how you’re trying to combine matrices.
If you’re considering other ways to express Td, it might be worth exploring different matrix multiplication methods. But for your needs, the Kronecker product is likely the best bet!

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!