Message Boards Message Boards

0
|
2437 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Factoring constants out of a series

Posted 3 years ago

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?

POSTED BY: Daniel Lyons
2 Replies
Posted 3 years ago

Thank you so much. I have tried this out and so far, so good. I am amazed with this.

POSTED BY: Daniel Lyons

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
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract