3.9.4 Numerical Evaluation of Sums and Products

 NSum[f, {i, , }] find a numerical approximation to the sum NSum[f, {i, , , di}] use step di in the sum NProduct[f, {i, , }] find a numerical approximation to the product

Numerical sums and products.
This gives a numerical approximation to .
 In[1]:=  NSum[1/(i^3 + i!), {i, 1, Infinity}]
 Out[1]=
There is no exact result for this sum, so Mathematica leaves it in a symbolic form.
 In[2]:=  Sum[1/(i^3 + i!), {i, 1, Infinity}]
 Out[2]=
You can apply N explicitly to get a numerical result.
 In[3]:=  N[%]
 Out[3]=

The way NSum works is to include a certain number of terms explicitly, and then to try and estimate the contribution of the remaining ones. There are two approaches to estimating this contribution. The first uses the Euler-Maclaurin method, and is based on approximating the sum by an integral. The second method, known as the Wynn epsilon method, samples a number of additional terms in the sum, and then tries to fit them to a polynomial multiplied by a decaying exponential.

 option name default value Method Automatic Integrate (Euler-Maclaurin method) or Fit (Wynn epsilon method) NSumTerms 15 number of terms to include explicitly NSumExtraTerms 12 number of terms to use for extrapolation in the Wynn epsilon method

Special options for NSum.

If you do not explicitly specify the method to use, NSum will try to choose between the methods it knows. In any case, some implicit assumptions about the functions you are summing have to be made. If these assumptions are not correct, you may get inaccurate answers.

The most common place to use NSum is in evaluating sums with infinite limits. You can, however, also use it for sums with finite limits. By making implicit assumptions about the objects you are evaluating, NSum can often avoid doing as many function evaluations as an explicit Sum computation would require.

This finds the numerical value of by extrapolation techniques.
 In[4]:=  NSum[Exp[-n], {n, 0, 100}]
 Out[4]=
You can also get the result, albeit much less efficiently, by constructing the symbolic form of the sum, then evaluating it numerically.
 In[5]:=  Sum[Exp[-n], {n, 0, 100}] //N
 Out[5]=

NProduct works in essentially the same way as NSum, with analogous options.

THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.