This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)


gives a numerical approximation to the sum .
uses a step di in the sum.
  • NSum can be used for sums with both finite and infinite limits.
  • NSum can be used to evaluate multidimensional sums.
  • The following options can be given:
AccuracyGoalInfinitynumber of digits of final accuracy sought
EvaluationMonitorNoneexpression to evaluate whenever f is evaluated
MethodAutomaticmethod to use
NSumTerms15number of terms to use before extrapolation
PrecisionGoalAutomaticnumber of digits of final precision sought
VerifyConvergenceTruewhether to explicitly test for convergence
WorkingPrecisionMachinePrecisionthe precision used in internal computations
  • Possible settings for the Method option include:
"AlternatingSigns"method for summands with alternating signs
"EulerMaclaurin"Euler-Maclaurin summation method
"WynnEpsilon"Wynn epsilon extrapolation 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.
  • N[Sum[...]] calls NSum for sums that cannot be done symbolically.
  • NSum first localizes the values of all variables, then evaluates f with the variables being symbolic, and then repeatedly evaluates the result numerically.
Approximate an infinite sum numerically:
The error versus the exact value of :
Approximate an infinite sum numerically:
Click for copyable input
The error versus the exact value of :
Click for copyable input
Approximate the value of a finite sum:
This is effectively the difference of two infinite sums:
Approximate a multidimensional sum:
Approximate a multidimensional sum with the second index depending on the first:
Complex series summation:
Sum the even terms of a series:
An equivalent way of specifying the same sum:
Approximate a sum with the default tolerances:
Find the error versus the exact value of :
The error with smaller absolute and relative tolerances:
The error with larger absolute and relative tolerances:
Get the number of evaluation points used in a numerical summation:
The evaluation points used in a summation approximated by an integration method:
The evaluation points used in a summation approximated by the sequence extrapolation method:
Use a method for alternating series to get a very precise sum approximation:
The error from the exact result computed by Sum:
The error using the default method:
By default NSum uses 15 terms at the beginning before approximating the tail:
The error for this example is large because the summand peaks at 20:
Increasing to include this feature improves the approximation:
By default the summand's convergence is verified:
Generally, if the convergence is not verified the summation is faster:
Approximate the formal sum without verifying convergence:
This is roughly equivalent to the formal symbolic result:
Use higher precision to get a better approximation:
Find the error versus the exact value of :
Approximate the sum of the reciprocals of the Fibonacci numbers:
Find the approximate limit of a slowly converging sequence by summing the difference:
Compare to the exact result:
When the closed-form sum is available, Sum can be used instead of NSum:
The results of Sum and NSum agree closely:
Using Log and Exp to estimate a product:
The estimate compares well with the exact result:
The approximation can be done directly with NProduct:
NSum can be used to calculate oscillatory integrals over :
NIntegrate gives the same result:
Wynn's extrapolation algorithm loses precision for series that are not alternating:
Uses of NIntegrate by NSum may lead to convergence messages:
The error compared to the exact value of is large:
You can increase the appropriate parameters for NIntegrate using Method options:
The error is much smaller:
Find the error versus the exact value of :
NSum may not detect divergence for some infinite sums:
Convergence verification is based on a ratio test that is inconclusive when equal to 1:
New in 1 | Last modified in 6