1
$\begingroup$

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

$\endgroup$
3
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Dunlop
    Commented Sep 17, 2019 at 4:13
  • $\begingroup$ Perhaps you can give some examples of formatted code you have tried ? This makes it much easier for others to try to work on answering your question $\endgroup$
    – Dunlop
    Commented Sep 17, 2019 at 4:14
  • $\begingroup$ @Dunlop Edited as instructed. $\endgroup$
    – Net
    Commented Sep 17, 2019 at 4:36

1 Answer 1

3
$\begingroup$

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]

$\endgroup$
1
  • $\begingroup$ Thank you very much! $\endgroup$
    – Net
    Commented Jul 25, 2020 at 3:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.