# Non commutative products and scalars [closed]

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.

• 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. Jul 26, 2016 at 16:15
• @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? Jul 26, 2016 at 16:18
• You might want to see this. Jul 26, 2016 at 16:23
• @J.M. Ok, thanks. I think that should hopefully sort things out. Jul 26, 2016 at 16:28
• 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.
– Jens
Jul 26, 2016 at 16:35