# Numerical Calculus Package

Numerical Calculation of Limits | Numerical Calculation of Series Expansions |

Numerical Calculation of Residues |

The functions defined in the NumericalCalculus` context provide support for finding numerical solutions to calculus-related problems.

## Numerical Calculation of Limits

The built‐in function Limit computes limits using symbolic and analytic methods. The function NLimit contained in the NumericalCalculus package works by numerically evaluating a short sequence of function values as the argument approaches the specified point. The result of this calculation is passed to a routine that uses either Wynn's ‐algorithm or a generalized Euler transformation to find an approximation to the limit.

NLimit[expr,x->x_{0}] | numerically finds the limit as x approaches x_{0} |

option name | default value | |

WorkingPrecision | MachinePrecision | number of digits of precision to be used |

Scale | 1 | initial step size |

Terms | 7 | total number of terms generated in the sequence |

Method | EulerSum | method of evaluation, either EulerSum or SequenceLimit |

WynnDegree | 1 | degree to use in the Wynn method |

Options for NLimit.

There are many specialized techniques for accelerating the convergence of a series. Faster convergence means that in a numerical evaluation fewer terms are needed to give a result of the desired accuracy. One such technique, Euler's transformation, is used by EulerSum.

EulerSum is particularly good for working with alternating series and series whose terms have the form where is a polynomial in . It is a useful adjunct to the built‐in NSum, which is designed to be an effective general case algorithm.

Numerical evaluation of sums using Euler's transformation.

option name | default value | |

WorkingPrecision | MachinePrecision | number of digits of precision to be used |

Terms | 5 | total number of terms generated before extrapolation |

ExtraTerms | 7 | number of terms to be used in the extrapolation process; must be at least 2 |

EulerRatio | Automatic | the fixed ratio to be used in the transformation |

Options for EulerSum.

There are occasionally instances in which it is difficult or impossible to analytically compute the derivative of a function. In these cases you can compute the derivative using the function ND instead of the built‐in function D.

ND[f,x,x_{0}] | gives a numerical approximation to evaluated at the point x_{0} |

ND[f,{x,n},x_{0}] | gives the n^{th} derivative |

Numerical computation of derivatives.

option name | default value | |

WorkingPrecision | MachinePrecision | number of digits of precision to be used |

Scale | 1 | size of steps in the evaluation |

Terms | 7 | total number of terms generated in the sequence |

Method | EulerSum | method of evaluation, either EulerSum (numerical limit of difference quotients) or NIntegrate (Cauchy's integral formula) |

Options for ND.

You should realize that with sufficiently pathological examples, the algorithms used for EulerSum, NLimit, or ND can give wrong answers. In most cases, you can test your answer by looking at the sensitivity to changes in the setting of options.

## Numerical Calculation of Residues

The Wolfram Language function Residue symbolically finds the residue of an expression at a point in the complex plane. Because it is symbolic in nature, it is sometimes unable to get a result.

NResidue is the numerical version of Residue. It works by numerically integrating around a small circle centered at the point at which the residue is being sought. The obvious problem with this approach is that it in fact finds the sum of the residues at all of the points contained within the circle. By making the radius of the circle sufficiently small, you can exclude all singularities but the one in question.

NResidue[expr,{x,x_{0}}] | numerically find the residue of expr at the point x=x_{0} |

Numerical evaluation of residues.

Radius | specifies the radius of the circle around which the integration is performed |

PrecisionGoal | the PrecisionGoal to be used by NIntegrate |

WorkingPrecision | the WorkingPrecision to be used by NIntegrate |

Options for NResidue.

## Numerical Calculation of Series Expansions

The Wolfram Language function Series finds a power series expansion of a function about a point by evaluating derivatives. However, sometimes you only want a numerical approximation to a series and the derivatives are difficult to evaluate. You could use ND to evaluate the derivatives, but that would involve repeating most of the work (i.e., evaluating the function itself at several points) for each derivative. If the function is analytic and can be evaluated in the complex plane, the solution is to use the NSeries.

NSeries[f,{x,x_{0},n}] | gives a numerical approximation to the series expansion of f about x=x_{0} including the terms (x-x_{0})^{-n} through (x-x_{0})^{n} |

Numerically finding series expansions.

NSeries works by evaluating the function at discrete points on a circle centered at the expansion point. It then uses InverseFourier to express the function as a sum of orthogonal basis functions, each of which is trivial to integrate around the circle. By Cauchy's integral formula it is seen that InverseFourier essentially gives us the required series coefficients; very little additional work is required and NSeries does it all for you. Because it is based on Cauchy's integral formula, care should be taken to ensure that no singularities of the function occur inside the circle of sample points.

option name | default value | |

WorkingPrecision | MachinePrecision | precision of the arithmetic to use in calculations |

Radius | 1 | radius of the circle on which the function is sampled |

Options for NSeries.

^{x}about the origin. Note that NSeries is unable to recognize small numbers that should in fact be zero.