7
$\begingroup$

I began to use Mathematica a few days ago. My problem is: how do I expand expressions like $(a+b)\ast(a+b)$, where the multiplication is noncommutative? Can Mathematica do this?

$\endgroup$
  • 3
    $\begingroup$ Maybe Distribute[(a + b) ** (a + b) ] ? $\endgroup$ – b.gates.you.know.what Apr 10 '13 at 17:02
  • 1
    $\begingroup$ Look here for some more thoughts about non commutative multiplication and more ... $\endgroup$ – Spawn1701D Apr 10 '13 at 18:08
7
$\begingroup$

Distribute[] is a useful thing:

Distribute[(a + b) ** (c + d)]
   a ** c + a ** d + b ** c + b ** d
$\endgroup$
1
$\begingroup$

The package NCAlgebra does exactly what you want.

NCExpand[(a + b) ** (a + b)]
(* a ** a + a ** b + b ** a + b ** b *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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