This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / Numerical Computation / Sums and Products  /
NSum

  • NSum[ f , i , imin , imax ] gives a numerical approximation to the sum .
  • NSum[ f , i , imin , imax , di ] uses a step di in the sum.
  • NSum can be used for sums with both finite and infinite limits.
  • NSum[ f , i , ... , j , ... , ... ] can be used to evaluate multidimensional sums.
  • The following options can be given:
  • NSum uses either the Euler-Maclaurin (Integrate) or Wynn epsilon (Fit) method.
  • With the Euler-Maclaurin method, the options AccuracyGoal and PrecisionGoal can be used to specify the accuracy and precision to try and get in the final answer. NSum stops when the error estimates it gets imply that either the accuracy or precision sought has been reached.
  • You should realize that with sufficiently pathological summands, the algorithms used by NSum can give wrong answers. In most cases, you can test the answer by looking at its sensitivity to changes in the setting of options for NSum.
  • VerifyConvergence is only used for sums with infinite limits.
  • N[Sum[ ... ]] calls NSum.
  • NSum has attribute HoldAll.
  • See the Mathematica book: Section 1.6.2, Section 3.9.1Section 3.9.4.
  • See also Implementation NotesA.9.44.19MainBookLinkOldButtonDataA.9.44.19.
  • See also: NProduct.
  • Related package: NumericalMath`ListIntegrate`, NumericalMath`NLimit`.

    Further Examples

    This gives a numerical approximation to a sum.

    In[1]:=

    Out[1]=

    Here is an exact value that we will use for comparison.

    In[2]:=

    The numerical sum is not very accurate.

    In[3]:=

    Out[3]=

    Increasing NSumTerms improves the result.

    In[4]:=

    Out[4]=

    Increasing NSumExtraTermsalso improves the result.

    In[5]:=

    Out[5]=

    With enough NSumExtraTerms and the correct value for WynnDegree the only error is due to the arithmetic.

    In[6]:=

    Out[6]=