3
$\begingroup$

TensorProduct shows a behavior I don't understand when giving as an argument the square of a variable.
Example:

TensorProduct[a,b]
a\[TensorProduct]b

But for the square:

TensorProduct[a^2,b]
a^2*b

The TensorProduct gets evaluated as a standard product in the second case.
Is there a reason why Mathematica does that or is it a bug?

$\endgroup$
2
  • $\begingroup$ It's funny that even this input leads to vanishing of tensor product: AA\[TensorProduct]BB /. AA -> AA^2 $\endgroup$ Commented Feb 8, 2018 at 10:50
  • $\begingroup$ Hm. Maybe a^2 is assumed to be a scalar? This assumption is not too artificial since the usual definition of Power for arrays (aka tensors) is not covariant. $\endgroup$ Commented Feb 8, 2018 at 10:56

1 Answer 1

2
$\begingroup$

@HenrikSchumacher's comment is spot-on. Consider:

TensorRank[a]
TensorRank[a^2]

TensorRank[a]

0

Mathematica does some automatic simplifications of TensorProduct objects with scalars. Another manifestation:

g /: TensorRank[g] = 0;

TensorProduct[a, g]

a g

$\endgroup$

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.