- Piecewise constant approximation = Rectangular Rule [upper, lower, middle, left, right]
- Piecewise linear approximation = Trapezium Rule
- Piecewise quadratic approximation = Simpson’s 1/3 Rule
- Piecewise cubic approximation = Simpson’s 3/8 Rule
There are several reasons for carrying out numerical integration, some of them are
- The integrand f(x) does not exist, but it is known at certain points, as sampling.
- The integrand f(x) may exist, but we have a discrete data points only
- The integrand f(x) exist, but formula for antiderivative is unknown
- The integrand f(x) exist, the formula for antiderivative exist, but complicated to execute
Test your understanding: Quiz 1
- Which rule is associated with piecewise quadratic approximation?
- Piecewise linear approximation is also known as
- Piecewise constant approximation corresponds to
- Which rule is used for piecewise graph below?
- Why use numerical integration if the formula for antiderivative exists?
Newton’s-Cotes quadrature formula
Suppose\(y=f( x )\) is tabulated for equally spaced values
\( x=x_0,x_1,x_2,\ldots ,x_n \)
given by
\( y=y_0,y_1,y_2,\ldots ,y_n \)
Now assuming that, \(y=f( x )\) be a polynomial of degree \(n\),
We integrate
\(I= \int_a^b f(x) dx\)
Let, interval [a,b] is divided into n equal subintervals of width \(h\) so that
\(x_i=x_0+ih\) for \(i=0,1,2,\ldots ,n\) with \(x_0=a,x_n=b\)
Then
\(I= \int_a^bydx\)
or
\(I= \int_{x_0}^{x_n}f(x)dx\)
or
\(I= \int_{x_0}^{x_n}[ y_0+p\Delta y_0+\frac{p( p-1 )}{2!}\Delta ^2 y_0+\frac{p( p-1 )( p-2 )}{3!}\Delta ^3 y_0+\ldots ]dx\)
As we know
\(x=x_0+ph\)
We have
\(dx=h \times dp\)
Here
when \(x=x_0\), then p=0
when \(x=x_n\), then p=n
Hence, we have
\(I=h \int_0^n[ y_0+p\Delta y_0+\frac{p( p-1 )}{2!}\Delta ^2 y_0+\frac{p( p-1 )( p-2 )}{3!}\Delta ^3 y_0+\ldots ]dp\)
or
\(I=h \left [ y_0p+\frac{p^2}{2}\Delta y_0+\frac{( 2p^3-3p^2 )}{12}\Delta ^2 y_0+\frac{p^4-4p^3+4p^2}{24}\Delta ^3y_0+\ldots \right ]_0^n\)
or
\(I=h \left [ y_0n+\frac{n^2}{2}\Delta y_0+\frac{( 2n^3-3n^2 )}{12}\Delta ^2 y_0+\frac{n^4-4n^3+4n^2}{24}\Delta ^3y_0+\ldots \right ]\)
or
\(I=nh[ y_0+\frac{n}{2}\Delta y_0+\frac{n( 2n-3 )}{12}\Delta ^2y_0+\frac{n( n-2 )^2}{24}\Delta ^3y_0+\ldots ]\)
This is known as Newton’s-Cotes quadrature formula.
Numerical Integration: Trapezoidal rule [n=1]
\( a=x_0 \leq x_1 \leq x_2 \leq x_3 \leq ... \leq x_n=b\)
This partitions the interval [a, b] into n sub-intervals\( [x_{i−1}, x_i] \) of length \(\Delta x=\frac{b-a}{n}\)
Then Trapezoidal rule approximate the area under f(x) by a sum of n trapezia (instead of rectangles).
There are an infinite number of straight lines through any given points, but only one straight line through two given points, so the trapezoidal rule is used for estimating definite integrals with such unique trapezoids to approximate the area under a curve.
Suppose \(y=f( x )\) is tabulated for equally spaced values
\( x=x_0,x_1,x_2,\ldots ,x_n \)
given by
\( y=y_0,y_1,y_2,\ldots ,y_n \)
Then, Newton’s-Cotes quadrature formula for \(I= \int_a^b f(x) dx\) is
\(I=nh[ y_0+\frac{n}{2}\Delta y_0+\frac{n( 2n-3 )}{12}\Delta ^2y_0+\frac{n( n-2 )^2}{24}\Delta ^3y_0+\ldots ]\)
Taking n=1,
The polynomial is straight line
All higher differences
greater than one are zero.
Thus,
\( \int_{x_0}^{x_1}f( x )dx\)
or \(nh[ y_0+\frac{n}{2}\Delta y_0]\)
or \(h[ y_0+\frac{1}{2}\Delta {y_0} ]\)
or \( h [ y_0+ \frac{1}{2} (y_1-y_0) ]\)
or \( h [ \frac{2y_0+y_1-y_0}{2}] \)
or \( \frac{h}{2} ( y_0+y_1 )\)
Here
\( \int_{x_0}^{x_1}f( x )dx=\frac{h}{2} ( y_0+y_1 )\)
Area=\(\frac{1}{2} h(b_1+b_2)\)
In our formula, we see that the first trapezoid has a height h and parallel bases of length \(f(x_0)\) and \(f(x_1)\) . Thus, the area of the first trapezoid is
Area=\(\frac{1}{2} h[f(x_0)+f(x_0)]\)
or Area=\(\frac{1}{2} h(y_0+y_1)\)
\( \int_{x_1}^{x_2}f( x )dx=\frac{h}{2}[ {y_1}+{y_2} ]\)
or \( \int_{x_{n-1}}^{x_n}f( x )dx=\frac{h}{2}[ {y_{n-1}}+{y_n} ]\)
Adding all, we get
\( \int_{x_0}^{x_n}f( x )dx=\frac{h}{2}[ {y_0}+{y_n}+2( {y_1}+{y_2}+\ldots +{y_{n-1}} ) ]\)
This is known as Trapezoidal Rule
=================================
Numerical Integration: Simpson’s 1/3 rule [n=2]
Suppose \( y=f(x) \) is tabulated for equally spaced values\( x=x_0,x_1,x_2,\ldots ,x_n \)
given by
\( y=y_0,y_1,y_2,\ldots ,y_n \)
Then, Newton’s-Cotes quadrature formula for\(I= \int_a^b f(x) dx\)is
\(I=nh[ y_0+\frac{n}{2}\Delta y_0+\frac{n( 2n-3 )}{12}\Delta ^2y_0+\frac{n( n-2 )^2}{24}\Delta ^3y_0+\ldots ]\)
Taking n=2,
The polynomial is formed as parabolic curve
All higher differences greater than two are zero Thus,
\( \int_{x_0}^{x_2}f( x )dx\)
or \(nh[ y_0+\frac{n}{2}\Delta y_0+\frac{n( 2n-3 )}{12}\Delta ^2y_0]\)
\( 2h[ y_0+\Delta y_0+\frac{1}{6}\Delta ^2y_0 ]\)
or \( 2h[ y_0+(y_1-y_0)+\frac{1}{6}(\Delta y_1-\Delta y_0 )\)
or \( 2h[ y_1+\frac{1}{6}\left \{(y_2-y_1)-(y_1-y_0) \right \} \)
or \( 2h[ y_1+\frac{1}{6}(y_2-2y_1+y_0) \)
or \( \frac{2h}{6}( 6y_1+y_2-2y_1+y_0) \)
or \( \frac{h}{3}( y_0+4y_1+y_2) \)
=====================================
Here
\( \int_{x_0}^{x_2}f( x )dx=\frac{h}{3}[ {y_0}+4{y_1}+{y_2} ]\)
Similarly, we get
\( \int_{x_2}^{x_4}f( x )dx=\frac{h}{3}[ {y_2}+4{y_3}+{y_4} ]\)
………………………………
\( \int_{x_{n-2}}^{x_n}f( x )dx=\frac{h}{3}[ {y_{n-2}}+4{y_{n-1}}+{y_n} ]\)
=====================================
Adding all we get
\( \int_{x_0}^{x_n}f( x )dx=\frac{h}{3}[ y_0+y_n+4( {y_1}+{y_3}+\ldots +{y_{n-1}} )+2( {y_2}+{y_4}+\ldots +{y_{n-2}} ) ]\)
This is known as Simpson’s 1/3 rule
=====================================
Numerical Integration: Simpson’s 3/8 rule [n=3]
Suppose \(y=f( x )\) is tabulated for equally spaced values
\( x=x_0,x_1,x_2,\ldots ,x_n \)
given by
\( y=y_0,y_1,y_2,\ldots ,y_n \)
Then, Newton’s-Cotes quadrature formula for is
\(I=nh[ y_0+\frac{n}{2}\Delta y_0+\frac{n( 2n-3 )}{12}\Delta ^2y_0+\frac{n( n-2 )^2}{24}\Delta ^3y_0+\ldots ]\)
Taking n=3,
The polynomial is formed as cubic curve
All higher
differences greater than three are zero
\( \int_{x_0}^{x_3}f( x )dx \)
or \( nh[ y_0+\frac{n}{2}\Delta y_0+\frac{n( 2n-3 )}{12}\Delta ^2y_0+\frac{n( n-2 )^2}{24}\Delta ^3y_0 ]\)
or \(3h[ y_0+\frac{3}{2}\Delta y_0+\frac{3}{4}\Delta ^2y_0+\frac{1}{8}\Delta ^3y_0 ]\)
or \(3h[ y_0+\frac{3}{2}(y_1-y_0)+\frac{3}{4}(y_2-2y_1+y_0)+\frac{1}{8}(y_3-3y_2-3y_1+y_0) ]\)
or \(\frac{3h}{8}[ 8y_0+12(y_1-y_0)+6(y_2-2y_1+y_0)+(y_3-3y_2+3y_1-y_0) ]\)
or \(\frac{3h}{8}[ y_0+3y_1+3y_2+y_3 ]\)
=====================================
Here
\( \int_{x_0}^{x_3}f( x )dx=\frac{3h}{8}[ y_0+3y_1+3y_2+y_3 ]\)
Similarly, we get
\( \int_{x_3}^{x_6}f( x )dx=\frac{3h}{8}[ y_3+3y_4+3y_5+y_6 ]\)
………………………………
\( \int_{x_{n-3}}^{x_n}f( x )dx=\frac{3h}{8}[ y_{n-3}+3y_{n-2}+3y_{n-1}+y_n ]\)
=====================================
Adding all we get
\( \int_{x_0}^{x_n}f( x )dx=\frac{3h}{8}[ y_0+y_n+3( y_1+y_2+y_4+y_5+\ldots ) +2( y_3+y_6+\ldots ) ]\)
This is known as Simpson’s 3/8 rule
=====================================
Which is better
- Trapezoidal rule (better for linear approximation)
- Simpson’s 1/3 rule (better for even number of data points)
- Simpson’s 3/8 rule [better for (mod 3)+2 { for example 5, 8, 11,...} number of data points]
Numerical Integration: Example 1
Evaluate\( \int_{0}^{1}\frac{1}{1+x}dx\) with h= 1/6
SolutionTaking \(h=\frac{1}{6}, a=0,b=1\), the functional values for the partition are given below.
| x | 0 | 1/6 | 2/6 | 3/6 | 4/6 | 5/6 | 1 |
| \(f(x)=\frac{1}{1+x}\) | 1 | 6/7 | 6/8 | 6/9 | 6/10 | 6/11 | 1/2 |
Trapezoidal rule
\( \int_{0}^{1}\frac{1}{1+x}dx\)or \( \int_{x_0}^{x_n}f( x )dx\)
or \(\frac{h}{2}[ {y_0}+{y_n}+2( {y_1}+{y_2}+\ldots +{y_{n-1}} ) ]\)
or \( \frac1{12}[ 1+\frac{1}{2}+2( \frac6{7}+\frac6{8}+\frac6{9}+\frac{6}{10}+\frac{6}{11} ) ]\)
or \( 0.695\)
Simpson’s 1/3 rule
\( \int_{0}^{1}\frac{1}{1+x}dx\)or \( \int_{x_0}^{x_n}f( x )dx\)
or \(\frac{h}{3}[ {y_0}+{y_n}+4( {y_1}+{y_3}+\ldots +{y_{n-1}} ) +2( {y_2}+{y_4}+\ldots +{y_{n-2}} ) ]\)
or \( \frac1{18}[ 1+\frac{1}{2}+4( \frac{6}{7}+\frac6{9}+\frac{6}{11} )+2( \frac{6}{8}+\frac6{10} ) ]\)
or \( 0.693\)
Simpson’s 3/8 rule
\( \int_{0}^{1}\frac{1}{1+x}dx\)or \( \int_{x_0}^{x_n}f( x )dx\)
or \(\frac{3h}{8}[ {y_0}+{y_n}+3( {y_1}+{y_2}+{y_4}+{y_5}+\ldots ) +2( {y_3}+{y_6}+\ldots ) ]\)
or \( \frac{1}{16}[ 1+\frac{1}{2}+3( \frac6{7}+\frac{6}{8}+\frac{6}{10}+\frac{6}{11} )+2( \frac{6}{9} ) ]\)
or \(0.693\)
Numerical Integration: Example 2
Evaluate \( \int_{0}^{1}\frac1{1+x}dx\) correct to three decimal place with h= 0.5.
SolutionTaking \(h=0.5, a=0,b=1\), the functional values for the partition are given below.
| x | 0 | 0.5 | 1 |
| \(f(x)=\frac{1}{1+x}\) | 1 | 1/1.5 | 1/2 |
Trapezoidal rule
\( \int_{0}^{1}\frac{1}{1+x}dx\)or \( \int_{x_0}^{x_n}f( x )dx\)
or \(\frac{h}{2}[ y_0+y_n+2( y_1+y_2+\ldots +y_{n-1} ) ]\)
or \( \frac{1}{4}[ 1+0.5+2( 0.6667 ) ]\)
or \( 0.708\)
Simpson’s 1/3 rule
\( \int_{0}^{1}\frac{1}{1+x}dx\)or \( \int_{x_0}^{x_n}f( x )dx\)
or\(\frac{h}{3}[ y_0+y_n+4( y_1+y_3+\ldots +y_{n-1} ) +2( y_2+y_4+\ldots +y_{n-2} ) ]\)
or \( \frac{1}{6}[ 1+0.5+4( 0.6667 ) ]\)
or \(0.694\)
Simpson’s 3/8 rule
\( \int_{0}^{1}\frac{1}{1+x}dx\)or \( \int_{x_0}^{x_n}f( x )dx\)
or \( \frac{3h}{8}[ y_0+y_n+3( y_1+y_2+y_4+y_5+\ldots ) +2( y_3+y_6+\ldots ) ]\)
or \( \frac{3}{16}[ 1+0.5+3( 0.666 ) ]\)
or \( 0.655\)
Exercise
- \( \displaystyle \int_0^3(5x+4)\) with n=6
- \( \displaystyle \int_0^1 x^2\) with n=4
- \( \displaystyle \int_0^1 (1-x^2)\) with n=8
- \( \displaystyle \int_0^4 x^3\) with n=4
- \( \displaystyle \int_1^2 \frac{1}{x}\) with n=5
Test Your Understanding: Quiz 2
- What is the polynomial type assumed for the interval in the Trapezoidal rule (n=1)?
- Which rule is associated with a piecewise quadratic (parabolic) approximation where n=2?
- In Simpson’s 3/8 rule, the approximation is formed using which type of curve?
- For the Trapezoidal rule, what is the weight of the intermediate ordinates \( (y_1, y_2, \ldots, y_{n-1}) \) in the formula?
- Which rule is specifically noted as being better for an even number of data points?
- In the Simpson's 1/3 rule formula, the odd ordinates \( (y_1, y_3, \ldots) \) are multiplied by which factor?
- Which rule is better for data points numbering 5, 8, or 11?
- What is the coefficient of the entire sum in the Simpson’s 3/8 rule formula?
No comments:
Post a Comment