Group Abstract Group Abstract

Message Boards Message Boards

0
|
1.8K Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

Long, nested matrix product with coefficients

Posted 11 years ago
POSTED BY: Bryan Zaldivar
Posted 11 years ago

If you can accept needing to use your own function then

In[1]:= mydist[expr_] := Distribute[expr] //. Dot[Times[a_, A_], Times[c_, C_]] -> a*c*A.C;
mydist[(a*A + b*B).(c*C + d*D)]

Out[2]= a c A.C + a d A.D + b c B.C + b d B.D

Please test that carefully before you depend on it.

UnProtecting and redefining Distribute to do this automatically might be feasible, but only if you want to risk that.

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard