2
$\begingroup$

Say I have an expression such as $$a.(\alpha b)$$ where $a$ and $b$ are non-commutative operators, but $\alpha$ is simply a scalar. How do I tell Mathematica to treat $\alpha$ as a scalar and "pull" it out of the non-commutative product? i.e. such that $$a.(\alpha b)=\alpha (a.b)$$ I've tried defining $\alpha$ as a real number, but this hasn't worked. I have to admit, I'm not particularly proficient at Mathematica and I'm still in the learning stage. Any help on this problem would be much appreciated.

$\endgroup$
6
  • $\begingroup$ You're using **, I presume (as you did not show any code)? You'll have to teach Mathematica how to handle scalars, since NonCommutativeMultiply[] has no built-in rules. $\endgroup$ Jul 26, 2016 at 16:15
  • $\begingroup$ @J.M. So far I've just been using the $.$ product defined in Mathematica, since it essentially treats the product as non-commutative (due to the matrix multiplication). How does one teach Mathematica how to handle scalars? $\endgroup$
    – user35305
    Jul 26, 2016 at 16:18
  • $\begingroup$ You might want to see this. $\endgroup$ Jul 26, 2016 at 16:23
  • $\begingroup$ @J.M. Ok, thanks. I think that should hopefully sort things out. $\endgroup$
    – user35305
    Jul 26, 2016 at 16:28
  • $\begingroup$ Also have a look at the documentation for NonCommutativeMultiply (under Applications). Definitely don't hesitate to add your code if there are still issues you feel need to be resolved. $\endgroup$
    – Jens
    Jul 26, 2016 at 16:35

0

Browse other questions tagged or ask your own question.