I want to manipulate expressions like
$$\big\{(aX+bY)\otimes Z \big\}\cdot \big\{U \otimes (c V+d W) \big\} $$
so that Mathematica (10) yields
$$ (aX U+bYU)\otimes(cZV+dZW) = acXU\otimes ZV+bcYU\otimes ZV+ adXU\otimes ZW +bd YU\otimes ZW$$
for finite matrices of the same size (in capitals) and scalars (lowercase).
In the this question TensorExpand
is used in order to take the scalars out of the Dot
product. (I actually was used to TeX-SE forum once, where one has to put the core of the code only, but I oversimplified the linked question, and I apologize)
Assuming[(a | b | c) ∈ Reals && (X | Y) ∈
Matrices[{n, n}],
TensorExpand[
KroneckerProduct[IdentityMatrix[n], a X].(b KroneckerProduct[c IdentityMatrix[n], Y])]]
(*...................................this ^ is culprit?...................*)
If I remove the
b
, the result is: $ac (1_n\otimes XY)$But if
b
is there, only intermediate steps are shown, even though I used theTensorExpand
as in that linked answer.
Why it does not work for Kronecker products?
Another remark is that substituting the b
by a number, say $\pi$, then it does yield $ac\pi (1_n\otimes XY)$.
What am I missing for making Dot
to simplify the computation?
P.S. I also tried the hint here, namely
Unprotect[Dot];
Dot[a___, d_?NumericQ b_, c___] := d Dot[a, b, c]
Protect[Dot];
but it does not help.