# Numerical Evaluation of Sums and Products

NSum[f,{i,i_{min},i_{max}}] | find a numerical approximation to the sum |

NSum[f,{i,i_{min},i_{maxdi}}] | use step in the sum |

NProduct[f,{i,i_{min},i_{max}}] | find a numerical approximation to the product |

Numerical sums and products.

This gives a numerical approximation to

.

Out[1]= | |

There is no exact result for this sum, so

*Mathematica* leaves it in a symbolic form.

Out[2]= | |

You can apply

N explicitly to get a numerical result.

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 three 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. The third approach, useful for alternating series, uses an alternating signs method; it also samples a number of additional terms and approximates their sum by the ratio of two polynomials (Padé approximation).

Special options for NSum.

If you do not explicitly specify the method to use, NSum will try to choose between the or methods. 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.

Out[4]= | |

You can also get the result, albeit much less efficiently, by constructing the symbolic form of the sum, then evaluating it numerically.

Out[5]= | |

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