3
$\begingroup$

Is there a way to have Mathematica simplify long expressions involving sums of variables into expressions using a sum function? Suppose I have something like this:

Subscript[x, 1] + Subscript[x, 2] + Subscript[x, 3] + Subscript[x, 
  4] + Subscript[x, 5] 

I would like to get the following output after simplification:

Sum[Subscript[x, i], {i, 1, 5}] 
$\endgroup$
2
  • $\begingroup$ In fact, the reverse happens by default. Sum[Subscript[x, i], {i, 5}] returns Subscript[x, 1] + Subscript[x, 2] + Subscript[x, 3] + Subscript[x, 4] + Subscript[x, 5]. The same is true for Sum[x[i], {i, 5}]. $\endgroup$
    – bbgodfrey
    Jun 7, 2015 at 4:12
  • $\begingroup$ Yes, and this is particularly unfortunate when differentiating or integrating sums, like D[Sum[x^i, {i, 1, 10}], x]. In some cases it would be nice if sums weren't expanded automatically. $\endgroup$
    – Peter
    Jun 8, 2015 at 18:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.