Mathematica Asked by Net on August 26, 2021
If I have, say three sites in a symbolic operator which is of the form A = a⊗1⊗c and I want it to act on another operator B = a1⊗b⊗1 in order to find the commutator A.B – B.A, the result I expect would be A.B = a.a1⊗b⊗c, but I am unable to achieve such a result using the regular A.B command. A.B gives a⊗c.a1⊗b. I would also like to know how I can expand the dot product to multiple terms if they exist. Any help would be appreciated.
I tried the following:
A = TensorProduct[a, 1, c]
B = TensorProduct[a1, b, 1]
A.B
The output it gives is a⊗c.a1⊗b but the output I expect is a.a1⊗b⊗c
KroneckerProduct
will work with symbolic tensors, although it needs some help from TensorExpand
. First, set some assumptions on your tensors:
$Assumptions = (a | a1 | b | c) ∈ Matrices[{n, n}];
Then, your example is:
A = KroneckerProduct[a, IdentityMatrix[n], c];
B = KroneckerProduct[a1, b, IdentityMatrix[n]];
A.B
KroneckerProduct[a, IdentityMatrix[n], c].KroneckerProduct[a1, b, IdentityMatrix[n]]
Using TensorExpand
produces your desired result:
TensorExpand[A.B]
KroneckerProduct[a.a1, b, c]
Correct answer by Carl Woll on August 26, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP