Is there a way to regroup terms into a sum? I mean, for example, if I have the sequence
$\quad \quad S_1 S_2 + S_2 S_3 + S_3 S_4 + S_4 S_5$
I would like to get the form
$\quad \quad {\rm Sum}[S_i\,S_{i+1},\ \{i,\,4\}]$.
I actually need this for a way longer and more complicated expression.
EDIT
Following the discussion in the comments, I think I should clarify the intent of the question: How do I construct a function that, given the input:
$\quad \quad S_1 S_2 + S_2 S_3 + S_3 S_4 + S_4 S_5$
gives the output
$\quad \quad {\rm Sum}[S_i\,S_{i+1},\ \{i,\,4\}]$
Sumwhich is what I thought wanted. Could you clarify your intent? Would you give a short example of the specific input and the output that would like the hypothetical function to produce? – Mr.Wizard Oct 22 '14 at 20:45S_1S_2+S_2S_3+S_3S_4+S_4S_5and I want as output an expression involvingSumHow would you construct such a function? – user50473 Oct 24 '14 at 15:28