# Summation with jump indices like 1,4,6,9?

I is easy to enter

$\sum_{s=1}^{n}k(s)$

But how can I enter

$\sum_{s=1,3}k(s)$

?

When I try it, Mathematica says

Syntax::sntxi: Incomplete expression; more input is needed .


Also the following didn't work.

$\sum_{s=1,3}^{3}k(s)$

-

According to the documentation:

$\sum _i^{i_{\max }} f$ is by default interpreted as Sum[f {$i$, $i_{\max }$}]

so we can abuse this:

You can use Sequence to provide di too because:

$\sum _{i=i_{\min }}^{i_{\max }} f$ is by default interpreted as Sum[f {$i$, $i_{\min }$, $i_{\max }$}]

ssch has found undocumented but useful pattern that is also interpreted:

$\sum _{spec} f$ is by default interpreted as Sum[f, spec]

-
Using {i,1,5,2} instead of i=1 works too – ssch Dec 7 '13 at 13:05
@ssch Good point, definitely cleaner than Sequence :) – Kuba Dec 7 '13 at 13:06
@Kuba What exactly do you mean by your "Sequence" solution? When I evaluate Sum[i, {i, {i = 1, Sequence[5, 2]}}] I get 8 in Mathematica 8.0.4. Please clarify. – Alexey Popkov Dec 7 '13 at 16:43
@AlexeyPopkov according to the documentation, solution with Sequence is equivalent to Sum[i, {i, 1, Sequence[5, 2]}] not to the one you've provided. – Kuba Dec 7 '13 at 16:46
@Kuba Thanks, it is clear now. +1 – Alexey Popkov Dec 8 '13 at 6:51