# Math-Linux.com

Knowledge base dedicated to Linux and applied mathematics.

Home > Mathematics > Numerical integration > Newton-Cotes formulas

## Newton-Cotes formulas

The main objective is to numerically compute an integral. In order to do so, we shall introduce Lagrange interpolation polynomials, present the notions of quadrature rules and of exact quadrature rules on polynomial spaces. Finally, we shall define Newton-Cotes formulas and the particular cases of composite formulas for rectangles, trapezes and Simpson’s formula.

Let $f:[a,b] \rightarrow \mathbf{R}$ be a continuous function. The aim is to compute the following integral:

$$I(f)=\int_a^bf(x)dx$$

We start by partitioning the interval $[a,b]$ into $n$ intervals $[x_i,x_{i+1}],i=0,\ldots,n-1$ with

$$a=x_0 Therefore:$$I(f)=\int_a^bf(x)dx=\sum_{i=0}^{n-1}\int_{x_i}^{x_{i+1}}f(x)dx$$ We then have to determine the following integral:$$\int_{x_i}^{x_{i+1}}f(x)dx,i=0,\ldots,n-1.$$ It is easy to switch to the interval [-1,1] via the following substitution$$t=2\frac{x-x_{i}}{x_{i+1}-x_{i}}-1$$or$$x=\frac{x_{i+1}-x_{i}}{2}(t+1)+x_i$$therefore$$\int_{x_i}^{x_{i+1}}f(x)dx=\frac{x_{i+1}-x_{i}}{2} \int_{-1}^{1}g_i(t)dt$$where$$g_i(t)=f\left(\frac{x_{i+1}-x_{i}}{2}(t+1)+x_i\right),i=0,\ldots,n-1.$$ ### Quadrature rule Let g be a continuous function on [-1,1]. The application J$$J:g \longmapsto \sum_{j=0}^p\omega_j g(t_j)$$is said to be a quadrature rule. The points defined by$$-1\leq t_0 are called points of integration of the quadrature
$J$ and

$$\omega_0,\omega_1,\ldots,\omega_p$$

are the weights of the quadrature rule $J$.
The weights and the points of integration are chosen such that:

$$\int_{-1}^{1}g(t)dt\simeq\sum_{j=0}^p\omega_j g(t_j)$$

Let $Q\in\mathbf{P}_q$ be the set of polynomials of degree at most equal to q. The quadrature rule $J$ is said to be exact in $\mathbf{P}_q$ if

$$\forall Q\in\mathbf{P}_q,\quad \int_{-1}^{1}Q(t)dt=J(Q)$$

Alternatively stated, if

$$\forall Q\in\mathbf{P}_q,\quad \int_{-1}^{1}Q(t)dt=\sum_{j=0}^p\omega_j Q(t_j)$$

### Exact quadrature rule: Lagrange basis

Theorem.

Let $L_0,L_1,\ldots,\L_p$ be the Lagrange-basis of $\mathbf{P}_{p}$ relatively to the points