Numerical integration

To calculate definite integral by the rectangle method, trapezoid method, Simpson method or other Newton-Cotes quadrature methods.

This page exists due to the efforts of the following people:

Anton

Timur

Timur

Created: 2017-02-07 11:56:59, Last updated: 2021-02-10 05:41:51

Numerical methods can be used for definite integral value approximation. Numerical integration is used in case of impossibility to evaluate antiderivative analytically and then calculate definite integral using Newton–Leibniz axiom.

Numerical integration of a single argument function can be represented as the area (or quadrature) calculation of a curvilinear trapezoid bounded by the graph of a given function, the x-axis, and vertical lines bounding given limits.
The integrand function is replaced by a simpler one (which has antiderivative) approximating the integrand with a given accuracy. Replacing the integrand with Lagrange polynomials evaluated at equally spaced points in given limits yields the Newton-Cotes integration formulas, such as:

  1. Rectangle rule
  2. Trapezoidal rule
  3. Simpson rules

PLANETCALC, Numerical integration using Newton-Cotes formulas

Numerical integration using Newton-Cotes formulas

Digits after the decimal point: 6
Formula
 
Definite integral value
 
Quadrature function
 
Method error
 
Interval
 
Integral geometric view
The file is very large. Browser slowdown may occur during loading and creation.
Formula source
 
The file is very large. Browser slowdown may occur during loading and creation.

Numerical integration using Newton-Cotes formulas

Using Newton-Cotes formulas, the integration interval is divided by points x1,x2,x3..xn into equal line segments.
Integrand function is replaced by the Lagrange polynomials of various degrees, integration of which yields the numerical integration formulas with various degrees of accuracy.

Finally the definite integral approximation is evaluated as the weighted sum of integrand values evaluated for the integration points:
I\approx \sum _{{i=1}}^{{n}}{W_i}f(x_{i})+R_n

  • Wi - weights, determined by integration methods
  • Rn - remainder or error.
  • n - number of integration points.
  • The formula sum is a quadrature rule.

Handbook Newton-Cotes quadrature functions contains a few commonly mentioned Newton-Cotes quadrature rules for integration on equally spaced intervals. Any registered user can add a new quadrature rule in this handbook.

Integration segment limits

Depending on the endpoints used by an integration method, open or closed rules are distinguished.

Open rules do not use endpoints. The open integration methods can be used in cases where the integrand function is undefined in some points.
E.g. using rectangle method we can approximate ln(x) definite integral value on (0,1) line segment, in spite of ln(0) is undefined.

In opposite, Closed rules use endpoints as well as midpoints to evaluate integrand function values.

Half-opened rules (e.g., left rectangle rule or right rectangle rule) can also be used to approximate integral on the line segment opened from only one side.

Newton-Cotes rule approximation error

Commonly by the increasing number of integration points (with increasing polynomial degree), the accuracy is raised. But for some functions, it is not valid.

Karl Runge, a German mathematician, analyzed this oddity first.
He noticed, the interpolaton polynomial with equally spaced interval for \frac{1}{1+25x^2} function ceases to converge in the range 0.726.. ≤ |x| <1 with raising polynomial degree.
It can be explained by looking at the error equation. The formula includes interval h and factorial n!; both increase accuracy if n tends to infinity, but the n-degree derivative part value, which decreases accuracy in the error equation, raises faster for particular functions.

Also, with raising interpolation polynomial degree, we get negative weights, which can increase computational error. The calculator displays intermediate quadrature function results in graphical form. The methods having only positive Wi weights look like Riemann sum representation. If negative Wi weights exist, the graph has both positive and negative halves wider than the integration interval. This effect can be seen here: Closed Newton-Cotes rule with 11-nodes

Taking into account these arguments, it is not recommended to use rules with polynomial degree >10.

The integration interval can be divided into a few parts to increase accuracy, for each of which definite integral can be calculated separately with any integration rule. The final integral value is the sum of integrals for each partial interval.

To evaluate new integration methods based on equally spaced intervals, you may use the following calculator having an input box for entering weights:

PLANETCALC, Numerical integration with explicit Newton-Cotes formula coefficients

Numerical integration with explicit Newton-Cotes formula coefficients

All weights must be separated by comma. A weight is a simple fraction in form of n/d, where n - numerator, d - denominator or real number. The first weight is a common multiplier, set 1 if there is no common multiplier.
Digits after the decimal point: 6
Definite integral value
 
Formula
 
Quadrature function
 
Integral geometric view
The file is very large. Browser slowdown may occur during loading and creation.
The file is very large. Browser slowdown may occur during loading and creation.

The weights are comma-separated real numbers or common fractions. The first coefficient in the weight list is a common multiplier; enter 1 if there is no common multiplier.

E.g. 3/8,1,3,3,1 weights can be used for Simpson 3/8 rule

Definite integral approximation with Newton-Cotes integration rules is far from ideal. For real applications, you should use better methods, e.g., the Gauss-Kronrod rule. Hopefully, we'll illustrate it with the new calculators and articles in nearest future.


Literature:

  1. N.S. Bakhvalov Numerical methods, 2012
  2. U.G.Pirumov Numerical methods, 2006
  3. D. Kahaner, C.Moler, S.Nash Numerical methods and software, 1989
  4. R.V. Hamming Numerical methods for scientists and engineers, 1972
  5. M. Abramovitz и I. Stegun Handbook of Mathematical Functions With Formulas, Graphs and Mathematical Tables, 1973
URL copied to clipboard
PLANETCALC, Numerical integration

Comments