02-17-2019, 02:39 PM
How could a Kronecker Product be found with the hp prime?
(This would be like Matlab's kron() command, or Wolfram's KroneckerProduct() command).
https://en.wikipedia.org/wiki/Kronecker_product
I'm no expert on this subject matter, but have recently encountered a need for this in connection with an energy flow problem. Here is an example of a 4x4 identity matrix, with a 2x2 matrix, resulting in an 8x8 Kronecker product:
Example (using wxmaxima here):
(%i3) a:ident(4);
b:matrix ([1,-1],[-1,1]);
kronecker_product(a,b);
(a) matrix(
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]
)
(b) matrix(
[1, -1],
[-1, 1]
)
0 errors, 0 warnings
(%o3) matrix(
[1, -1, 0, 0, 0, 0, 0, 0],
[-1, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 1, -1, 0, 0, 0, 0],
[0, 0, -1, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 1, -1, 0, 0],
[0, 0, 0, 0, -1, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 1, -1],
[0, 0, 0, 0, 0, 0, -1, 1]
)
(This would be like Matlab's kron() command, or Wolfram's KroneckerProduct() command).
https://en.wikipedia.org/wiki/Kronecker_product
I'm no expert on this subject matter, but have recently encountered a need for this in connection with an energy flow problem. Here is an example of a 4x4 identity matrix, with a 2x2 matrix, resulting in an 8x8 Kronecker product:
Example (using wxmaxima here):
(%i3) a:ident(4);
b:matrix ([1,-1],[-1,1]);
kronecker_product(a,b);
(a) matrix(
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]
)
(b) matrix(
[1, -1],
[-1, 1]
)
0 errors, 0 warnings
(%o3) matrix(
[1, -1, 0, 0, 0, 0, 0, 0],
[-1, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 1, -1, 0, 0, 0, 0],
[0, 0, -1, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 1, -1, 0, 0],
[0, 0, 0, 0, -1, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 1, -1],
[0, 0, 0, 0, 0, 0, -1, 1]
)