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

NIntegrate

Updated In 6 Graphic
NIntegrate[f, {x, xmin, xmax}]
gives a numerical approximation to the integral .
NIntegrate[f, {x, xmin, xmax}, {y, ymin, ymax}, ...]
gives a numerical approximation to the multiple integral .
  • Multiple integrals use a variant of the standard iterator notation. The first variable given corresponds to the outermost integral, and is done last.
  • NIntegrate by default tests for singularities at the boundaries of the integration region, and at the boundaries of regions specified by settings for the Exclusions option.
  • NIntegrate[f, {x, x0, x1, ..., xk}] tests for singularities in a one-dimensional integral at each of the intermediate points xi. If there are no singularities, the result is equivalent to an integral from x0 to xk. You can use complex numbers xi to specify an integration contour in the complex plane.
  • The following options can be given:
AccuracyGoalInfinitydigits of absolute accuracy sought
EvaluationMonitorNoneexpression to evaluate whenever expr is evaluated
ExclusionsNoneparts of the integration region to exclude
MaxPointsAutomaticmaximum total number of sample points
MaxRecursionAutomaticmaximum number of recursive subdivisions
MethodAutomaticmethod to use
MinRecursion0minimum number of recursive subdivisions
PrecisionGoalAutomaticdigits of precision sought
WorkingPrecisionMachinePrecisionthe precision used in internal computations
  • NIntegrate usually uses adaptive algorithms, which recursively subdivide the integration region as needed. MinRecursion specifies the minimum number of recursive subdivisions to try. MaxRecursion gives the maximum number.
  • NIntegrate usually continues doing subdivisions until the error estimate it gets implies that the final result achieves either the AccuracyGoal or the PrecisionGoal specified.
  • For low-dimensional integrals, the default setting for PrecisionGoal is related to WorkingPrecision. For high-dimensional integrals, it is typically taken to be a fixed value, usually 2.
  • You should realize that with sufficiently pathological functions, the algorithms used by NIntegrate 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 NIntegrate.
  • Possible explicit settings for the Method option include:
"GlobalAdaptive"global adaptive integration strategy
"LocalAdaptive"local adaptive integration strategy
"DoubleExponential"double exponential quadrature
"MonteCarlo"Monte Carlo integration
"AdaptiveMonteCarlo"adaptive Monte Carlo integration
"QuasiMonteCarlo"quasi Monte Carlo integration
"AdaptiveQuasiMonteCarlo"adaptive quasi Monte Carlo integration
  • With Method->{"strategy", Method->"rule"} or Method->{"strategy", Method->{rule1, rule2, ...}} possible strategy methods include:
"GlobalAdaptive"subdivide based on global error estimates
"LocalAdaptive"subdivide based only on local error estimates
  • Methods used as rules include:
"CartesianRule"multidimensional Cartesian product of rules
"ClenshawCurtisRule"Clenshaw-Curtis rule
"GaussKronrodRule"Gauss points with Kronrod extension
"LobattoKronrodRule"Gauss-Lobatto points with Kronrod extension
"MultidimensionalRule"multidimensional symmetric rule
"MultipanelRule"combination of 1D rules
"NewtonCotesRule"Newton-Cotes rule
"TrapezoidalRule"uniform points in one dimension
  • Additional method suboptions can be given in the form Method->{..., opts}.
  • The method suboption "SymbolicProcessing" specifies the maximum number of seconds for which to attempt performing symbolic analysis of the integrand.
  • NIntegrate first localizes the values of all variables, then evaluates f with the variables being symbolic, and then repeatedly evaluates the result numerically.
Compute a numerical integral:
In[1]:=
Click for copyable input
Out[1]=
 
Compute a multi dimensional integral (with singularity at the origin):
In[1]:=
Click for copyable input
Out[1]=
 
Compute a high dimensional integral:
In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
New in 1 | Last modified in 6