Last active
April 17, 2022 19:16
-
-
Save hugle/3cf42b47e71cc0d0e980ab0a3900790f to your computer and use it in GitHub Desktop.
Expand summation expression and apply the distribution law
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SumExpand[exp_] := | |
exp /. Sum[c_, {i_, a_, b_}] :> | |
Distribute[Sum[ExpandAll[c], {i, a, b}]]; | |
rule = Sum[Times[Longest[u___], x___], {y_, z___}] :> | |
Times[u] Sum[Times[x], {y, z}] /; (FreeQ[{u}, y]); | |
SumSimplify[exp_] := SumExpand[exp] /. rule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment