dlyons3
(Daniel Lyons)
1
I have the below:
r1 = Sum[2*b0*b1*Subscript[x, i], {i, 1, n}] + Sum[b1^2*Subscript[x, i]^4, {i, 1, n}]
I understand that
\sum _{i=1}^n 2 b_0b_1 x_i+\sum _{i=1}^n b_1^2 x_i^4=2b_0b_1\sum _{i=1}^n x_i+b_1^2\sum _{i=1}^n x_i^4
However, I do not know how to make Mathematica recognize this. i.e. how to factor the constants b_0 and b_1 out of the series.
Is there a way to do this?
One way to do it is with pattern replacement:
factorFromSum =
Sum[a_*b_, {var_, lmts__}] /; FreeQ[b, var] :> b*Sum[a, {var, lmts}];
Sum[2*b0*b1*Subscript[x, i], {i, 1, n}] +
Sum[b1^2*Subscript[x, i]^4, {i, 1, n}] /. factorFromSum
dlyons3
(Daniel Lyons)
3
Thank you so much. I have tried this out and so far, so good. I am amazed with this.