1
$\begingroup$

Often I replace $k$ with, say, $m-k^2$ in a sum, obtaining something like this: $$\sum_{0\leq m-k^2\leq n} f(k)$$ Is there a way to input these without manually solving the inequalities?

$\endgroup$
  • $\begingroup$ maybe Sum[f[k] Boole[0 <= m - k^2 <= n], {k, -Infinity, Infinity}]? $\endgroup$ – kglr Apr 19 '16 at 20:06
  • $\begingroup$ @kgir Is mathematica able to work with that, though? $\endgroup$ – Elliot Gorokhovsky Apr 19 '16 at 20:07
  • $\begingroup$ Rene, it seems to work; please check if the answer i posted is what you had in mind. $\endgroup$ – kglr Apr 19 '16 at 20:14
  • $\begingroup$ @kglr No, what I mean is does that mess up Mathematica's ability to try to find a closed form? $\endgroup$ – Elliot Gorokhovsky Apr 19 '16 at 20:15
  • $\begingroup$ When I tried Sum[i^2 Boole[0 <= m - i^2 <= n], {i, 1, n}], it took some time but did give an output in closed form. $\endgroup$ – kglr Apr 19 '16 at 20:24
5
$\begingroup$
sumF = Sum[f[k] Boole[#], {k, -Infinity, Infinity}] &;
sumF[m <= 100 - k^2 <= n]

Mathematica graphics

sumF[0 <= 100 - k^2 <= 50]

f[-10] + f[-9] + f[-8] + f[8] + f[9] + f[10]

sumF[0 <= 100 - k^2 <= 50] /. f -> (#^2 &)

490

Sum[i^2 Boole[0 <= m - i^2 <= n], {i, -Infinity, Infinity}]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.