In

^{''2''}), the antiderivative of which (the

f heta_, x_:= theta/(1 + theta^2 * x^2);
aTan heta_, M_, nMax_:=
2*Sum Function[x,_Evaluate[D[f[theta,_x_.html" ;"title=",_Evaluate[D[f[theta,_x.html" ;"title="Function[x, Evaluate[D[f[theta, x">Function[x, Evaluate[D[f[theta, x ">,_Evaluate[D[f[theta,_x.html" ;"title="Function[x, Evaluate[D[f[theta, x">Function[x, Evaluate[D[f[theta, x ][(m - 1/2)/
M])/((2*n + 1)!*(2*M)^(2*n + 1)), , ];
Plot[, ,
PlotRange -> All]
For a function $g(t)$ defined over interval $(a,b)$, its integral is
$$\backslash int\_a^b\; g(t)\; \backslash ,\; dt\; =\; \backslash int\_0^\; g(\backslash tau+a)\; \backslash ,\; d\backslash tau=\; (b-a)\; \backslash int\_0^1\; g((b-a)x+a)\; \backslash ,\; dx.$$
Therefore, we can apply the generalized midpoint integration formula above by assuming that $f(x)\; =\; (b-a)\; \backslash ,\; g((b-a)x+a)$.

def calculate_definite_integral_of_f(f, initial_step_size):
"""
This algorithm calculates the definite integral of a function
from 0 to 1, adaptively, by choosing smaller steps near
problematic points.
"""
x = 0.0
h = initial_step_size
accumulator = 0.0
while x < 1.0:
if x + h > 1.0:
h = 1.0 - x # At end of unit interval, adjust last step to end at 1.
if error_too_big_in_quadrature_of_f_over_range(f, , x + h:
h = make_h_smaller(h)
else:
accumulator += quadrature_of_f_over_range(f, , x + h
x += h
if error_too_small_in_quadrature_of_over_range(f, , x + h:
h = make_h_larger(h) # Avoid wasting time on tiny steps.
return accumulator
Some details of the algorithm require careful thought. For many cases, estimating the error from quadrature over an interval for a function ''f''(''x'') isn't obvious. One popular solution is to use two different rules of quadrature, and use their difference as an estimate of the error from quadrature. The other problem is deciding what "too large" or "very small" signify. A ''local'' criterion for "too large" is that the quadrature error should not be larger than ''t'' ⋅ ''h'' where ''t'', a real number, is the tolerance we wish to set for global error. Then again, if ''h'' is already tiny, it may not be worthwhile to make it even smaller even if the quadrature error is apparently large. A ''global'' criterion is that the sum of errors on all the intervals should be less than ''t''. This type of error analysis is usually called "a posteriori" since we compute the error after having computed the approximation.
Heuristics for adaptive quadrature are discussed by Forsythe et al. (Section 5.4).

Integration: Background, Simulations, etc.

at Holistic Numerical Methods Institute

from Wolfram Mathworld

Lobatto quadrature formula

from Encyclopedia of Mathematics

Implementations of many quadrature and cubature formulae

within the free Tracker Component Library.

SageMath Online Integrator

{{Authority control Numerical analysis * Articles with example Python (programming language) code

analysis
Analysis ( : analyses) is the process of breaking a complex topic or substance into smaller parts in order to gain a better understanding of it. The technique has been applied in the study of mathematics and logic since before Aristotle (384 ...

, numerical integration comprises a broad family of algorithm
In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...

s for calculating the numerical value of a definite integral
In mathematics, an integral assigns numbers to functions in a way that describes displacement, area, volume, and other concepts that arise by combining infinitesimal data. The process of finding integrals is called integration. Along with ...

, and by extension, the term is also sometimes used to describe the numerical solution of differential equations. This article focuses on calculation of definite integrals.
The term numerical quadrature (often abbreviated to ''quadrature'') is more or less a synonym for ''numerical integration'', especially as applied to one-dimensional integrals. Some authors refer to numerical integration over more than one dimension as cubature; others take ''quadrature'' to include higher-dimensional integration.
The basic problem in numerical integration is to compute an approximate solution to a definite integral
:$\backslash int\_a^b\; f(x)\; \backslash ,\; dx$
to a given degree of accuracy. If is a smooth function integrated over a small number of dimensions, and the domain of integration is bounded, there are many methods for approximating the integral to the desired precision.
Reasons for numerical integration

There are several reasons for carrying out numerical integration, as opposed to analytical integration by finding theantiderivative
In calculus, an antiderivative, inverse derivative, primitive function, primitive integral or indefinite integral of a function is a differentiable function whose derivative is equal to the original function . This can be stated symbolically ...

:
# The integrand ''f''(''x'') may be known only at certain points, such as obtained by sampling. Some embedded systems
An embedded system is a computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is ''embedded'' as ...

and other computer applications may need numerical integration for this reason.
# A formula for the integrand may be known, but it may be difficult or impossible to find an antiderivative that is an elementary function. An example of such an integrand is ''f''(''x'') = exp(−''x''error function
In mathematics, the error function (also called the Gauss error function), often denoted by , is a complex function of a complex variable defined as:
:\operatorname z = \frac\int_0^z e^\,\mathrm dt.
This integral is a special (non-elementary ...

, times a constant) cannot be written in elementary form.
# It may be possible to find an antiderivative symbolically, but it may be easier to compute a numerical approximation than to compute the antiderivative. That may be the case if the antiderivative is given as an infinite series or product, or if its evaluation requires a special function
Special functions are particular mathematical functions that have more or less established names and notations due to their importance in mathematical analysis, functional analysis, geometry, physics, or other applications.
The term is defined ...

that is not available.
History

The term "numerical integration" first appears in 1915 in the publication ''A Course in Interpolation and Numeric Integration for the Mathematical Laboratory'' by David Gibb. Quadrature is a historical mathematical term that means calculating area. Quadrature problems have served as one of the main sources ofmathematical analysis
Analysis is the branch of mathematics dealing with continuous functions, limits, and related theories, such as differentiation, integration, measure, infinite sequences, series, and analytic functions.
These theories are usually studied i ...

. Mathematicians of Ancient Greece, according to the Pythagorean doctrine, understood calculation of area
Area is the quantity that expresses the extent of a region on the plane or on a curved surface. The area of a plane region or ''plane area'' refers to the area of a shape or planar lamina, while '' surface area'' refers to the area of an open ...

as the process of constructing geometrically a square
In Euclidean geometry, a square is a regular quadrilateral, which means that it has four equal sides and four equal angles (90- degree angles, π/2 radian angles, or right angles). It can also be defined as a rectangle with two equal-lengt ...

having the same area (''squaring''). That is why the process was named quadrature. For example, a quadrature of the circle, Lune of Hippocrates, The Quadrature of the Parabola. This construction must be performed only by means of compass and straightedge.
The ancient Babylonians used the trapezoidal rule
In calculus, the trapezoidal rule (also known as the trapezoid rule or trapezium rule; see Trapezoid for more information on terminology) is a technique for approximating the definite integral.
\int_a^b f(x) \, dx.
The trapezoidal rule works b ...

to integrate the motion of Jupiter
Jupiter is the fifth planet from the Sun and the largest in the Solar System. It is a gas giant with a mass more than two and a half times that of all the other planets in the Solar System combined, but slightly less than one-thousandth t ...

along the ecliptic
The ecliptic or ecliptic plane is the orbital plane of the Earth around the Sun. From the perspective of an observer on Earth, the Sun's movement around the celestial sphere over the course of a year traces out a path along the ecliptic again ...

.
For a quadrature of a rectangle with the sides ''a'' and ''b'' it is necessary to construct a square with the side $x\; =\backslash sqrt$ (the Geometric mean
In mathematics, the geometric mean is a mean or average which indicates a central tendency of a set of numbers by using the product of their values (as opposed to the arithmetic mean which uses their sum). The geometric mean is defined as the ...

of ''a'' and ''b''). For this purpose it is possible to use the following fact: if we draw the circle with the sum of ''a'' and ''b'' as the diameter, then the height BH (from a point of their connection to crossing with a circle) equals their geometric mean. The similar geometrical construction solves a problem of a quadrature for a parallelogram and a triangle.
Problems of quadrature for curvilinear figures are much more difficult. The quadrature of the circle with compass and straightedge had been proved in the 19th century to be impossible. Nevertheless, for some figures (for example the Lune of Hippocrates) a quadrature can be performed. The quadratures of a sphere surface and a parabola segment done by Archimedes
Archimedes of Syracuse (;; ) was a Greek mathematician, physicist, engineer, astronomer, and inventor from the ancient city of Syracuse in Sicily. Although few details of his life are known, he is regarded as one of the leading scientists ...

became the highest achievement of the antique analysis.
* The area of the surface of a sphere is equal to quadruple the area of a great circle
In mathematics, a great circle or orthodrome is the circular intersection of a sphere and a plane passing through the sphere's center point.
Any arc of a great circle is a geodesic of the sphere, so that great circles in spherical geometry ...

of this sphere.
* The area of a segment of the parabola
In mathematics, a parabola is a plane curve which is mirror-symmetrical and is approximately U-shaped. It fits several superficially different mathematical descriptions, which can all be proved to define exactly the same curves.
One descrip ...

cut from it by a straight line is 4/3 the area of the triangle inscribed in this segment.
For the proof of the results Archimedes used the Method of exhaustion
The method of exhaustion (; ) is a method of finding the area of a shape by inscribing inside it a sequence of polygons whose areas converge to the area of the containing shape. If the sequence is correctly constructed, the difference in area ...

of Eudoxus.
In medieval Europe the quadrature meant calculation of area by any method. More often the Method of indivisibles was used; it was less rigorous, but more simple and powerful. With its help Galileo Galilei
Galileo di Vincenzo Bonaiuti de' Galilei (15 February 1564 – 8 January 1642) was an Italian astronomer, physicist and engineer, sometimes described as a polymath. Commonly referred to as Galileo, his name was pronounced (, ). He was ...

and Gilles de Roberval found the area of a cycloid
In geometry, a cycloid is the curve traced by a point on a circle as it rolls along a straight line without slipping. A cycloid is a specific form of trochoid and is an example of a roulette, a curve generated by a curve rolling on another c ...

arch, Grégoire de Saint-Vincent investigated the area under a hyperbola
In mathematics, a hyperbola (; pl. hyperbolas or hyperbolae ; adj. hyperbolic ) is a type of smooth curve lying in a plane, defined by its geometric properties or by equations for which it is the solution set. A hyperbola has two pieces, cal ...

(''Opus Geometricum'', 1647), and Alphonse Antonio de Sarasa
Alphonse Antonio de Sarasa was a Jesuit mathematician who contributed to the understanding of logarithms, particularly as areas under a hyperbola.
Alphonse de Sarasa was born in 1618, in Nieuwpoort in Flanders. In 1632 he was admitted as a ...

, de Saint-Vincent's pupil and commentator, noted the relation of this area to logarithm
In mathematics, the logarithm is the inverse function to exponentiation. That means the logarithm of a number to the base is the exponent to which must be raised, to produce . For example, since , the ''logarithm base'' 10 o ...

s.
John Wallis
John Wallis (; la, Wallisius; ) was an English clergyman and mathematician who is given partial credit for the development of infinitesimal calculus. Between 1643 and 1689 he served as chief cryptographer for Parliament and, later, the roy ...

algebrised this method: he wrote in his ''Arithmetica Infinitorum'' (1656) series that we now call the definite integral, and he calculated their values. Isaac Barrow
Isaac Barrow (October 1630 – 4 May 1677) was an English Christian theologian and mathematician who is generally given credit for his early role in the development of infinitesimal calculus; in particular, for proof of the fundamental theorem ...

and James Gregory made further progress: quadratures for some algebraic curves and spiral
In mathematics, a spiral is a curve which emanates from a point, moving farther away as it revolves around the point.
Helices
Two major definitions of "spiral" in the American Heritage Dictionary are:Christiaan Huygens
Christiaan Huygens, Lord of Zeelhem, ( , , ; also spelled Huyghens; la, Hugenius; 14 April 1629 – 8 July 1695) was a Dutch mathematician, physicist, engineer, astronomer, and inventor, who is regarded as one of the greatest scientists ...

successfully performed a quadrature of some Solids of revolution
In geometry, a solid of revolution is a solid figure obtained by rotating a plane figure around some straight line (the ''axis of revolution'') that lies on the same plane. The surface created by this revolution and which bounds the solid is t ...

.
The quadrature of the hyperbola by Saint-Vincent and de Sarasa provided a new function
Function or functionality may refer to:
Computing
* Function key, a type of key on computer keyboards
* Function model, a structured representation of processes in a system
* Function object or functor or functionoid, a concept of object-orien ...

, the natural logarithm
The natural logarithm of a number is its logarithm to the base of the mathematical constant , which is an irrational and transcendental number approximately equal to . The natural logarithm of is generally written as , , or sometimes, if ...

, of critical importance.
With the invention of integral calculus came a universal method for area calculation. In response, the term quadrature has become traditional, and instead the modern phrase "''computation of a univariate definite integral''" is more common.
Methods for one-dimensional integrals

Numerical integration methods can generally be described as combining evaluations of the integrand to get an approximation to the integral. The integrand is evaluated at a finite set of points called integration points and a weighted sum of these values is used to approximate the integral. The integration points and weights depend on the specific method used and the accuracy required from the approximation. An important part of the analysis of any numerical integration method is to study the behavior of the approximation error as a function of the number of integrand evaluations. A method that yields a small error for a small number of evaluations is usually considered superior. Reducing the number of evaluations of the integrand reduces the number of arithmetic operations involved, and therefore reduces the totalround-off error
A roundoff error, also called rounding error, is the difference between the result produced by a given algorithm using exact arithmetic and the result produced by the same algorithm using finite-precision, rounded arithmetic. Rounding errors are d ...

. Also, each evaluation takes time, and the integrand may be arbitrarily complicated.
A 'brute force' kind of numerical integration can be done, if the integrand is reasonably well-behaved (i.e. piecewise
In mathematics, a piecewise-defined function (also called a piecewise function, a hybrid function, or definition by cases) is a function defined by multiple sub-functions, where each sub-function applies to a different interval in the domain. Pi ...

continuous and of bounded variation
In mathematical analysis, a function of bounded variation, also known as ' function, is a real-valued function whose total variation is bounded (finite): the graph of a function having this property is well behaved in a precise sense. For a cont ...

), by evaluating the integrand with very small increments.
Quadrature rules based on interpolating functions

A large class of quadrature rules can be derived by constructing interpolating functions that are easy to integrate. Typically these interpolating functions arepolynomial
In mathematics, a polynomial is an expression consisting of indeterminates (also called variables) and coefficients, that involves only the operations of addition, subtraction, multiplication, and positive-integer powers of variables. An examp ...

s. In practice, since polynomials of very high degree tend to oscillate wildly, only polynomials of low degree are used, typically linear and quadratic.
The simplest method of this type is to let the interpolating function be a constant function (a polynomial of degree zero) that passes through the point $\backslash left(\; \backslash frac,\; f\; \backslash left(\; \backslash frac\; \backslash right)\backslash right)$. This is called the ''midpoint rule'' or '' rectangle rule''
$$\backslash int\_a^b\; f(x)\backslash ,\; dx\; \backslash approx\; (b-a)\; f\backslash left(\backslash frac\backslash right).$$
The interpolating function may be a straight line (an affine function
In Euclidean geometry, an affine transformation or affinity (from the Latin, ''affinis'', "connected with") is a geometric transformation that preserves lines and parallelism, but not necessarily Euclidean distances and angles.
More generally ...

, i.e. a polynomial of degree 1)
passing through the points $\backslash left(\; a,\; f(a)\backslash right)$ and $\backslash left(\; b,\; f(b)\backslash right)$.
This is called the ''trapezoidal rule
In calculus, the trapezoidal rule (also known as the trapezoid rule or trapezium rule; see Trapezoid for more information on terminology) is a technique for approximating the definite integral.
\int_a^b f(x) \, dx.
The trapezoidal rule works b ...

''
$$\backslash int\_a^b\; f(x)\backslash ,\; dx\; \backslash approx\; (b-a)\; \backslash left(\backslash frac\backslash right).$$
For either one of these rules, we can make a more accurate approximation by breaking up the interval $;\; href="/html/ALL/l/,b.html"\; ;"title=",b">,b$ into some number $n$ of subintervals, computing an approximation for each subinterval, then adding up all the results. This is called a ''composite rule'', ''extended rule'', or ''iterated rule''. For example, the composite trapezoidal rule can be stated as
$$\backslash int\_a^b\; f(x)\backslash ,\; dx\; \backslash approx\; \backslash frac\; \backslash left(\; +\; \backslash sum\_^\; \backslash left(\; f\; \backslash left(\; a\; +\; k\; \backslash frac\; \backslash right)\; \backslash right)\; +\; \backslash right),$$
where the subintervals have the form $;\; href="/html/ALL/l/+k\_h,a+\_(k+1)h.html"\; ;"title="+k\; h,a+\; (k+1)h">+k\; h,a+\; (k+1)h$ with $h\; =\; \backslash frac$ and $k\; =\; 0,\backslash ldots,n-1.$ Here we used subintervals of the same length $h$ but one could also use intervals of varying length $\backslash left(\; h\_k\; \backslash right)\_k$.
Interpolation with polynomials evaluated at equally spaced points in $;\; href="/html/ALL/l/,b.html"\; ;"title=",b">,b$ yields the Newton–Cotes formulas, of which the rectangle rule and the trapezoidal rule are examples. Simpson's rule
In numerical integration, Simpson's rules are several approximations for definite integrals, named after Thomas Simpson (1710–1761).
The most basic of these rules, called Simpson's 1/3 rule, or just Simpson's rule, reads
\int_a^b f(x) \, ...

, which is based on a polynomial of order 2, is also a Newton–Cotes formula.
Quadrature rules with equally spaced points have the very convenient property of ''nesting''. The corresponding rule with each interval subdivided includes all the current points, so those integrand values can be re-used.
If we allow the intervals between interpolation points to vary, we find another group of quadrature formulas, such as the Gaussian quadrature formulas. A Gaussian quadrature rule is typically more accurate than a Newton–Cotes rule that uses the same number of function evaluations, if the integrand is smooth (i.e., if it is sufficiently differentiable). Other quadrature methods with varying intervals include Clenshaw–Curtis quadrature (also called Fejér quadrature) methods, which do nest.
Gaussian quadrature rules do not nest, but the related Gauss–Kronrod quadrature formulas do.
Generalized midpoint rule formula

A generalized midpoint rule formula is given by $$\backslash int\_0^1\; f(x)\; \backslash ,\; dx\; =\; \backslash sum\_^M$$ or $$\backslash int\_0^1\; =\; \backslash lim\_\; \backslash sum\_^M\; ,$$ where $f^(x)$ denotes $n$-th derivative. For example, substituting $M=1$ and $$f(x)\; =\; \backslash frac$$ in the generalized midpoint rule formula, we obtain an equation of the inverse tangent $$\backslash tan^(\backslash theta)\; =\; i\backslash sum\_^\; \backslash frac\backslash left(\backslash frac\; -\; \backslash frac\backslash right)\; =\; 2\backslash sum\_^\; ,$$ where $i=\backslash sqrt$ isimaginary unit
The imaginary unit or unit imaginary number () is a solution to the quadratic equation x^2+1=0. Although there is no real number with this property, can be used to extend the real numbers to what are called complex numbers, using addition a ...

and
$$\backslash begin\; a\_1(\backslash theta)\; \&=\; \backslash frac,\backslash \backslash \; b\_1(\backslash theta)\; \&=\; 1,\backslash \backslash \; a\_n(\backslash theta)\; \&=\; \backslash left(1\; -\; \backslash frac\backslash right)\backslash ,a\_(\backslash theta)\; +\; \backslash frac\backslash ,b\_(\backslash theta),\backslash \backslash \; b\_n(\backslash theta)\; \&=\; \backslash left(1\; -\; \backslash frac\backslash right)\backslash ,b\_(\backslash theta)\; -\; \backslash frac\backslash ,a\_(\backslash theta).\; \backslash end$$
Since at each odd $n$ the numerator of the integrand becomes $(-1)^n\; +\; 1\; =\; 0$, the generalized midpoint rule formula can be reorganized as
$$\backslash int\_0^1\; f(x)\backslash ,dx\; =\; 2\backslash sum\_^M\; \backslash ,\backslash ,.$$
The following example of Mathematica code generates the plot showing difference between inverse tangent and its approximation truncated at $M\; =\; 5$ and $N\; =\; 10$:
Adaptive algorithms

If ''f''(''x'') does not have many derivatives at all points, or if the derivatives become large, then Gaussian quadrature is often insufficient. In this case, an algorithm similar to the following will perform better:Extrapolation methods

The accuracy of a quadrature rule of the Newton–Cotes type is generally a function of the number of evaluation points. The result is usually more accurate as the number of evaluation points increases, or, equivalently, as the width of the step size between the points decreases. It is natural to ask what the result would be if the step size were allowed to approach zero. This can be answered by extrapolating the result from two or more nonzero step sizes, using series acceleration methods such as Richardson extrapolation. The extrapolation function may be apolynomial
In mathematics, a polynomial is an expression consisting of indeterminates (also called variables) and coefficients, that involves only the operations of addition, subtraction, multiplication, and positive-integer powers of variables. An examp ...

or rational function. Extrapolation methods are described in more detail by Stoer and Bulirsch (Section 3.4) and are implemented in many of the routines in the QUADPACK library.
Conservative (a priori) error estimation

Let $f$ have a bounded first derivative over $;\; href="/html/ALL/l/,b.html"\; ;"title=",b">,b$ i.e. $f\; \backslash in\; C^1(;\; href="/html/ALL/l/,b.html"\; ;"title=",b">,b$ Themean value theorem
In mathematics, the mean value theorem (or Lagrange theorem) states, roughly, that for a given planar arc between two endpoints, there is at least one point at which the tangent to the arc is parallel to the secant through its endpoints. It i ...

for $f,$ where $x\; \backslash in;\; href="/html/ALL/l/,b),$
for_some_$\_\backslash xi\_x\_\backslash in\_(a,x.html"\; ;"title=",b),$ gives
$$(x\; -\; a)\; f\text{'}(\backslash xi\_x)\; =\; f(x)\; -\; f(a),$$
for some $\backslash xi\_x\; \backslash in\; (a,x">,b),$ gives
$$(x\; -\; a)\; f\text{'}(\backslash xi\_x)\; =\; f(x)\; -\; f(a),$$
for some $\backslash xi\_x\; \backslash in\; (a,x$ depending on $x$.
If we integrate in $x$ from $a$ to $b$ on both sides and take the absolute values, we obtain
$$\backslash left,\; \backslash int\_a^b\; f(x)\backslash ,\; dx\; -\; (b\; -\; a)\; f(a)\; \backslash \; =\; \backslash left,\; \backslash int\_a^b\; (x\; -\; a)\; f\text{'}(\backslash xi\_x)\backslash ,\; dx\; \backslash \; .$$
We can further approximate the integral on the right-hand side by bringing the absolute value into the integrand, and replacing the term in $f\text{'}$ by an upper bound
where the supremum
In mathematics, the infimum (abbreviated inf; plural infima) of a subset S of a partially ordered set P is a greatest element in P that is less than or equal to each element of S, if such an element exists. Consequently, the term ''greatest l ...

was used to approximate.
Hence, if we approximate the integral $\backslash int\_a^b\; f(x)\; \backslash ,\; dx$ by the quadrature rule $(b\; -\; a)\; f(a)$ our error is no greater than the right hand side of . We can convert this into an error analysis for the Riemann sum
In mathematics, a Riemann sum is a certain kind of approximation of an integral by a finite sum. It is named after nineteenth century German mathematician Bernhard Riemann. One very common application is approximating the area of functions or lin ...

, giving an upper bound of
$$\backslash frac\; \backslash sup\_\; \backslash left,\; f\text{'}(x)\; \backslash $$
for the error term of that particular approximation. (Note that this is precisely the error we calculated for the example $f(x)\; =\; x$.) Using more derivatives, and by tweaking the quadrature, we can do a similar error analysis using a Taylor series
In mathematics, the Taylor series or Taylor expansion of a function is an infinite sum of terms that are expressed in terms of the function's derivatives at a single point. For most common functions, the function and the sum of its Taylor ser ...

(using a partial sum with remainder term) for ''f''. This error analysis gives a strict upper bound on the error, if the derivatives of ''f'' are available.
This integration method can be combined with interval arithmetic to produce computer proofs and ''verified'' calculations.
Integrals over infinite intervals

Several methods exist for approximate integration over unbounded intervals. The standard technique involves specially derived quadrature rules, such as Gauss-Hermite quadrature for integrals on the whole real line and Gauss-Laguerre quadrature for integrals on the positive reals. Monte Carlo methods can also be used, or a change of variables to a finite interval; e.g., for the whole line one could use $$\backslash int\_^\; f(x)\; \backslash ,\; dx\; =\; \backslash int\_^\; f\backslash left(\; \backslash frac\; \backslash right)\; \backslash frac\; \backslash ,\; dt,$$ and for semi-infinite intervals one could use $$\backslash begin\; \backslash int\_a^\; f(x)\; \backslash ,\; dx\; \&=\; \backslash int\_0^1\; f\backslash left(a\; +\; \backslash frac\backslash right)\; \backslash frac,\; \backslash \backslash \; \backslash int\_^a\; f(x)\; \backslash ,\; dx\; \&=\; \backslash int\_0^1\; f\backslash left(a\; -\; \backslash frac\backslash right)\; \backslash frac,\; \backslash end$$ as possible transformations.Multidimensional integrals

The quadrature rules discussed so far are all designed to compute one-dimensional integrals. To compute integrals in multiple dimensions, one approach is to phrase the multiple integral as repeated one-dimensional integrals by applying Fubini's theorem (the tensor product rule). This approach requires the function evaluations to grow exponentially as the number of dimensions increases. Three methods are known to overcome this so-called '' curse of dimensionality''. A great many additional techniques for forming multidimensional cubature integration rules for a variety of weighting functions are given in the monograph by Stroud. Integration on thesphere
A sphere () is a geometrical object that is a three-dimensional analogue to a two-dimensional circle. A sphere is the set of points that are all at the same distance from a given point in three-dimensional space.. That given point is the ...

has been reviewed by Hesse et al. (2015).Kerstin Hesse, Ian H. Sloan, and Robert S. Womersley: Numerical Integration on the Sphere. In W. Freeden et al. (eds.), Handbook of Geomathematics, Springer: Berlin 2015,
Monte Carlo

Monte Carlo method
Monte Carlo methods, or Monte Carlo experiments, are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. The underlying concept is to use randomness to solve problems that might be determi ...

s and quasi-Monte Carlo methods are easy to apply to multi-dimensional integrals. They may yield greater accuracy for the same number of function evaluations than repeated integrations using one-dimensional methods.
A large class of useful Monte Carlo methods are the so-called Markov chain Monte Carlo algorithms, which include the Metropolis–Hastings algorithm and Gibbs sampling.
Sparse grids

Sparse grid Sparse grids are numerical techniques to represent, integrate or interpolate high dimensional functions. They were originally developed by the Russian mathematician Sergey A. Smolyak, a student of Lazar Lyusternik, and are based on a sparse tenso ...

s were originally developed by Smolyak for the quadrature of high-dimensional functions. The method is always based on a one-dimensional quadrature rule, but performs a more sophisticated combination of univariate results. However, whereas the tensor product rule guarantees that the weights of all of the cubature points will be positive if the weights of the quadrature points were positive, Smolyak's rule does not guarantee that the weights will all be positive.
Bayesian Quadrature

Bayesian quadrature is a statistical approach to the numerical problem of computing integrals and falls under the field of probabilistic numerics. It can provide a full handling of the uncertainty over the solution of the integral expressed as aGaussian process
In probability theory and statistics, a Gaussian process is a stochastic process (a collection of random variables indexed by time or space), such that every finite collection of those random variables has a multivariate normal distribution, i.e. ...

posterior variance.
Connection with differential equations

The problem of evaluating the integral :$F(x)\; =\; \backslash int\_a^x\; f(u)\backslash ,\; du$ can be reduced to aninitial value problem
In multivariable calculus, an initial value problem (IVP) is an ordinary differential equation together with an initial condition which specifies the value of the unknown function at a given point in the domain. Modeling a system in physics or ...

for an ordinary differential equation
In mathematics, an ordinary differential equation (ODE) is a differential equation whose unknown(s) consists of one (or more) function(s) of one variable and involves the derivatives of those functions. The term ''ordinary'' is used in contrast ...

by applying the first part of the fundamental theorem of calculus
The fundamental theorem of calculus is a theorem that links the concept of differentiating a function (calculating its slopes, or rate of change at each time) with the concept of integrating a function (calculating the area under its graph, or ...

. By differentiating both sides of the above with respect to the argument ''x'', it is seen that the function ''F'' satisfies
:$\backslash frac\; =\; f(x),\; \backslash quad\; F(a)\; =\; 0.$
Methods developed for ordinary differential equations, such as Runge–Kutta methods, can be applied to the restated problem and thus be used to evaluate the integral. For instance, the standard fourth-order Runge–Kutta method applied to the differential equation yields Simpson's rule from above.
The differential equation $F\text{'}(x)\; =\; f(x)$ has a special form: the right-hand side contains only the independent variable (here $x$) and not the dependent variable (here $F$). This simplifies the theory and algorithms considerably. The problem of evaluating integrals is thus best studied in its own right.
See also

* Numerical methods for ordinary differential equations * Truncation error (numerical integration) * Clenshaw–Curtis quadrature * Gauss-Kronrod quadrature *Riemann Sum
In mathematics, a Riemann sum is a certain kind of approximation of an integral by a finite sum. It is named after nineteenth century German mathematician Bernhard Riemann. One very common application is approximating the area of functions or lin ...

or Riemann Integral
In the branch of mathematics known as real analysis, the Riemann integral, created by Bernhard Riemann, was the first rigorous definition of the integral of a function on an interval. It was presented to the faculty at the University of Göt ...

* Trapezoidal rule
In calculus, the trapezoidal rule (also known as the trapezoid rule or trapezium rule; see Trapezoid for more information on terminology) is a technique for approximating the definite integral.
\int_a^b f(x) \, dx.
The trapezoidal rule works b ...

* Romberg's method
* Tanh-sinh quadrature
* Nonelementary Integral
References

* Philip J. Davis and Philip Rabinowitz, ''Methods of Numerical Integration''. * George E. Forsythe, Michael A. Malcolm, and Cleve B. Moler, ''Computer Methods for Mathematical Computations''. Englewood Cliffs, NJ: Prentice-Hall, 1977. ''(See Chapter 5.)'' * * Josef Stoer and Roland Bulirsch, ''Introduction to Numerical Analysis''. New York: Springer-Verlag, 1980. ''(See Chapter 3.)'' * Boyer, C. B., ''A History of Mathematics'', 2nd ed. rev. by Uta C. Merzbach, New York: Wiley, 1989 (1991 pbk ed. ). * Eves, Howard, ''An Introduction to the History of Mathematics'', Saunders, 1990, ,External links

Integration: Background, Simulations, etc.

at Holistic Numerical Methods Institute

from Wolfram Mathworld

Lobatto quadrature formula

from Encyclopedia of Mathematics

Implementations of many quadrature and cubature formulae

within the free Tracker Component Library.

SageMath Online Integrator

{{Authority control Numerical analysis * Articles with example Python (programming language) code