Noncommutative Expand over addition in Mathematica

余生长醉 提交于 2019-12-01 12:29:19

Try this package which includes a noncommutative Expand as well as other functions rewritten for NC calculations.

From that package:

GExpand[a_, patt___] := Expand[a //. {x_NonCommutativeMultiply :> Distribute[x]}, patt];

In[1]  := GExpand[a ** (b + c^2)]
Out[1] := a ** b + a ** c^2

In[2]  := GExpand[a ** (b + c^2)] //. a -> foo
Out[2] := foo ** b + foo ** c^2

The newest version of NCAlgebra supports ReplaceRepeated through NCReplaceRepeated.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!