If I use symbolic integration for the following:

Sum[Integrate[i + x, {x, 1, 7}], {i, 1, 7}]


as one can see it gives the answer as it seems to 'understand' the sum integral.

However with

NSum[NIntegrate[i + x, {x, 1, 7}], {i, 1, 7}]

NIntegrate::inumr: The integrand i+x has evaluated to non-numerical values for all sampling points in the region with boundaries {{1,7}}.


As one can see it does not seem to know that $i$ is 1 I think or something like that.

What is the problem and how can I format the numerical functions to do what I want without these errors?

  • 2
    $\begingroup$ FWIW: Sum[NIntegrate[...]] works just fine. $\endgroup$ Jun 24, 2019 at 13:28
  • 1
    $\begingroup$ Use Quiet[] or ignore it. NSum[] is evaluating its argument symbolically probably to see if it can be differentiated $\endgroup$
    – Michael E2
    Jun 24, 2019 at 22:09
  • $\begingroup$ Possible duplicate: mathematica.stackexchange.com/questions/18393/… $\endgroup$
    – Michael E2
    Feb 7, 2021 at 2:57
  • $\begingroup$ Michael E2 Jun 24 '19 at 22:09 then Michael E2 yesterday Feb 07 '21 just noticed aye! $\endgroup$
    – onepound
    Feb 8, 2021 at 12:58

1 Answer 1


Define a function that can only be called with a numerical argument $i$:

f[i_?NumericQ] := NIntegrate[i + x, {x, 1, 7}]

Numerical sum without possibility of analytic attempts at integration:

NSum[f[i], {i, 1, 7}]
(*    336.    *)

Your Answer

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

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