JustToThePoint English Website Version
JustToThePoint en español
JustToThePoint in Thai

Numerical integration.

The more I learn about people, the more I like dogs and I don’t even have a dog, Apocalypse, Anawim, #justtothepoint.

Numerical integration

In analysis, numerical integration comprises a broad family of algorithms for calculating the numerical value of a definite integral.

All numerical approximations of the integral $\int_{a}^{b} f(x)dx$ will start with a partition of the interval [a, b] into n equal parts, a = x0 < x1 < ··· < xn = b, Δx = xi-xi-1, y0 = f(x0), y1 = f(x1), ···, yn = f(xn). Loosely speaking, we want to average or add the y’s to get an approximation. We define the left Riemann sum as follows = (y0 + y1 + ··· + yn-1)Δx = f(x0)Δx + f(x1)Δx + ··· + f(xn-1)Δx = $\sum_{k=0}^{n-1} f(x_k)Δx$, and the right Riemann sum is defined similarly = (y1 + y2 + ··· + yn)Δx = f(x1)Δx + f(x2)Δx + ··· + f(xn)Δx = $\sum_{k=1}^{n} f(x_k)Δx$ -Figure 1.b.-

 

A trapezoid is a four-sided region with two opposite sides parallel. Given a partition of [a, b] as above, we can define the associated trapezoid sum to correspond to the area shown below. The area of a trapezoid is the average length of the parallel sides, times the distance between them, e.g., base * average_height = Δx(y2+y32). Adding all the areas of the individual trapezoids together, gives the trapezoid sum: $Δx(\frac{y_0+y_1}{2} + \frac{y_1+y_2}{2} + ··· + \frac{y_{n-1}+y_n}{2}) = Δx(\frac{y_0}{2} + y_1 + y_2 + ··· y_{n-1}+\frac{y_n}{2}) = \frac{left Riemann Sum + Right Riemann Sum}{2}$ -Figure 1.c.-.

Simpson’s rule gives us another approximation of the integral. Again, we start by partitioning [a, b] into intervals all of the same width, but this time we must use an even number of intervals, so n needs to be even. We are going to use a parabola through the three points (xk-1, f(xk-1)), (xk, f(xk)), and (xk+1, f(xk+1)), and the area under the parabola (it is left as an exercise) equals base*average height = $2Δx(\frac{y_{k-1}+4y_k+y_{k+1}}{6})=\frac{b-a}{3n}[f(x_{k-1})+4f(x_k)+f(x_{k+1})]$, and the total sum is $\frac{Δx}{3}((y_0+4y_1+y_2) + (y_2+4y_3+y_4) + ··· (y_{n-2}+4y_{n-1}+y_n))$ = 🚀

1 1 4 4 1 1 2 4 4 1 1 2 4 4 1 1 2 4 4 1 · 2 · · · · · 1

=[🚀] $\frac{Δx}{3}(y_0 +4y_1 +2y_2 +4y_3 + ··· + 2y_{n-2}+4y_{n-1}+y_n)$ -Figure 1.d.- Here, the coefficients 1, 4, and 2 alternate. Simpson's Rule is more accurate than the trapezoidal rule for approximating integrals because it uses quadratic functions to model the curve. It provides a good balance between simplicity and accuracy for numerical integration. Futhermore, it is exact when integrating polynomials of degree 3 or less.

 

Example

$\int_{1}^{2} \frac{dx}{x}= ln(x)\bigg|_{1}^{2} = ln(2) -ln(1) = ln(2) $ ≈ 0.693147 where b = x2 = 2, y2 = 2, x1 = 3/2, y1 = 2/3, a = x0 = 1, y0 = 1, b -a = 1, n = 2, $\Delta x = \frac{b-a}{n} = \frac{1}{2},$ Figure 1.a.

 

  1. Trapezoidal rule. $\Delta x(\frac{1}{2}y_0 + y_1 + \frac{1}{2}y_2)=\frac{1}{2}(\frac{1}{2})·1 + \frac{2}{3} + \frac{1}{2}·\frac{1}{2}$ ≈ 0.96 it is obviously not a good approximation 😞, but it was expected we should split the interval into more subintervals.

  2. Sympson’s rule. $\frac{\Delta x}{3}(y_0 +4y_1 +y_2) = \frac{1}{6}(1 + 4·\frac{2}{3}+\frac{1}{2}) ≈ 0.69444$ that is surprisingly a relatively good approximation of the correct value.

Exercise

$\int_{-∞}^{∞} e^{-t^{2}}dt$ =[Recall F(x) = $\int_{0}^{x} e^{-t^{2}}dt$] 2F(∞) =[F(∞)=$\frac{\sqrt{π}}{2}$] $\sqrt{π}$ -Figure 1.b.-.

 

Volume of the function 0 < y < x rotated around y-axis, $\int_{0}^{1} 2π(x-x^3)dx = π(x^2-\frac{x^4}{2})\bigg|_{0}^{1} = π(1-\frac{1}{2}) = \frac{π}{2},$ Figure 1.c.

Bibliography

This content is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License and is based on MIT OpenCourseWare [18.01 Single Variable Calculus, Fall 2007].
  1. NPTEL-NOC IITM, Introduction to Galois Theory.
  2. Algebra, Second Edition, by Michael Artin.
  3. LibreTexts, Calculus. Abstract and Geometric Algebra, Abstract Algebra: Theory and Applications (Judson).
  4. Field and Galois Theory, by Patrick Morandi. Springer.
  5. Michael Penn, and MathMajor.
  6. Contemporary Abstract Algebra, Joseph, A. Gallian.
  7. YouTube’s Andrew Misseldine: Calculus. College Algebra and Abstract Algebra.
  8. MIT OpenCourseWare 18.01 Single Variable Calculus, Fall 2007 and 18.02 Multivariable Calculus, Fall 2007.
  9. Calculus Early Transcendentals: Differential & Multi-Variable Calculus for Social Sciences.
Bitcoin donation

JustToThePoint Copyright © 2011 - 2024 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.