diff options
| author | Christian Kolset <christian.kolset@gmail.com> | 2025-09-03 13:19:49 -0600 |
|---|---|---|
| committer | Christian Kolset <christian.kolset@gmail.com> | 2025-09-03 13:19:49 -0600 |
| commit | 183c55c09e62c069d65b2f5d9f5d7c065ad16228 (patch) | |
| tree | bb0603094d9418ecb1c04c3b7e9610ff5609ac63 /tutorials/module_3 | |
| parent | b95095e4278ccda691c721bcd902a6d0b5492486 (diff) | |
Updated entries
Diffstat (limited to 'tutorials/module_3')
| -rw-r--r-- | tutorials/module_3/0_numerical_methods.md (renamed from tutorials/module_3/numerical_methods.md) | 0 | ||||
| -rw-r--r-- | tutorials/module_3/1_numerical_differentiation.md (renamed from tutorials/module_3/numerical_differentiation.md) | 0 | ||||
| -rw-r--r-- | tutorials/module_3/2_roots_optimization.md (renamed from tutorials/module_3/roots_optimization.md) | 0 | ||||
| -rw-r--r-- | tutorials/module_3/3_system_of_equations.md (renamed from tutorials/module_3/system_of_equations.md) | 0 | ||||
| -rw-r--r-- | tutorials/module_3/4_numerical_integration.md (renamed from tutorials/module_3/numerical_integration.md) | 39 | ||||
| -rw-r--r-- | tutorials/module_3/5_ode.md (renamed from tutorials/module_3/ode.md) | 0 |
6 files changed, 14 insertions, 25 deletions
diff --git a/tutorials/module_3/numerical_methods.md b/tutorials/module_3/0_numerical_methods.md index 449ece0..449ece0 100644 --- a/tutorials/module_3/numerical_methods.md +++ b/tutorials/module_3/0_numerical_methods.md diff --git a/tutorials/module_3/numerical_differentiation.md b/tutorials/module_3/1_numerical_differentiation.md index b34b315..b34b315 100644 --- a/tutorials/module_3/numerical_differentiation.md +++ b/tutorials/module_3/1_numerical_differentiation.md diff --git a/tutorials/module_3/roots_optimization.md b/tutorials/module_3/2_roots_optimization.md index 3a288cc..3a288cc 100644 --- a/tutorials/module_3/roots_optimization.md +++ b/tutorials/module_3/2_roots_optimization.md diff --git a/tutorials/module_3/system_of_equations.md b/tutorials/module_3/3_system_of_equations.md index 9830060..9830060 100644 --- a/tutorials/module_3/system_of_equations.md +++ b/tutorials/module_3/3_system_of_equations.md diff --git a/tutorials/module_3/numerical_integration.md b/tutorials/module_3/4_numerical_integration.md index 86ce015..c486825 100644 --- a/tutorials/module_3/numerical_integration.md +++ b/tutorials/module_3/4_numerical_integration.md @@ -20,18 +20,14 @@ # Numerical Integration -## Introduction and Importance +## Why Numerical? Integration is one of the fundamental tools in engineering analysis. Mechanical engineers frequently encounter integrals when computing work from force–displacement data, determining heat transfer from a time-dependent signal, or calculating lift and drag forces from pressure distributions over an airfoil. While some integrals can be evaluated analytically, most practical problems involve functions that are either too complex or are available only as experimental data. As engineering we choose numerical integration—also known as quadrature—provides a systematic approach to approximate the integral of a function over a finite interval. -In this tutorial, we will study several standard methods of numerical integration, compare their -accuracy, and implement them in Python. By the end, you will understand not only how to apply -each method, but also when one method may be more suitable than another. +In this tutorial, we will study several standard methods of numerical integration, compare their accuracy, and implement them in Python. By the end, you will understand not only how to apply each method, but also when one method may be more suitable than another. --- -## Section 2 — Core Concepts and Numerical Methods - -### General Form of Numerical Integration +## Numerical Methods We wish to approximate a definite integral of the form: $$ I = \int_a^b f(x) \, dx @@ -48,21 +44,20 @@ evaluates the function at the midpoint of each subinterval: $$ I \approx \sum_{i=0}^{n-1} h \, f\!\left(x_i + \tfrac{h}{2}\right). $$ -This method achieves second-order accuracy (error decreases with \(h^2\)). - +This method achieves second-order accuracy (error decreases with $h^2$). ### Trapezoidal Rule The trapezoidal rule approximates the area under the curve as a series of trapezoids: $$ I \approx \frac{h}{2}\Big[f(x_0) + 2\sum_{i=1}^{n-1} f(x_i) + f(x_n)\Big]. $$ It is simple to implement and works especially well for tabulated data. Like the midpoint rule, -its accuracy is of order \(O(h^2)\). +its accuracy is of order $O(h^2)$. ### Simpson’s Rule Simpson’s rules use polynomial interpolation to achieve higher accuracy. -- **Simpson’s 1/3 Rule (order \(O(h^4)\))** - Requires an even number of subintervals \(n\): +- **Simpson’s 1/3 Rule (order $O(h^4)$)** + Requires an even number of subintervals $n$: $$ I \approx \frac{h}{3}\Big[f(x_0) + 4\sum_{\text{odd } i} f(x_i) + 2\sum_{\text{even } i<n} f(x_i) + f(x_n)\Big]. @@ -76,14 +71,11 @@ Simpson’s rules use polynomial interpolation to achieve higher accuracy. Often used to handle the final three panels when \(n\) is not divisible by two. ### Romberg Integration -Romberg integration refines trapezoidal approximations using Richardson extrapolation to cancel -error terms. This results in very rapid convergence for smooth functions, making it a powerful -method once the trapezoidal rule is implemented. +Romberg integration refines trapezoidal approximations using Richardson extrapolation to cancel error terms. This results in very rapid convergence for smooth functions, making it a powerful method once the trapezoidal rule is implemented. ### Gaussian Quadrature Gaussian quadrature chooses evaluation points and weights optimally (based on Legendre -polynomials) to maximize accuracy. With \(n\) evaluation points, Gaussian quadrature is exact for -polynomials of degree up to \(2n-1\). This makes it extremely efficient for smooth integrands. +polynomials) to maximize accuracy. With $n$ evaluation points, Gaussian quadrature is exact for polynomials of degree up to $2n-1$. This makes it extremely efficient for smooth integrands. --- @@ -107,28 +99,25 @@ for n in [4, 8, 16, 32]: print(n, trapz(f1, 0, np.pi, n)) ``` -Students should compare results for increasing \(n\) and observe how the error decreases with -\(O(h^2)\). +Students should compare results for increasing $n$ and observe how the error decreases with $O(h^2$). --- -## Section 4 — Extensions and Advanced Topics +## Taking this further -- **Romberg Integration:** Demonstrates how extrapolation accelerates convergence of trapezoidal -approximations. +- **Romberg Integration:** Demonstrates how extrapolation accelerates convergence of trapezoidal approximations. - **Gaussian Quadrature:** Introduces optimal integration points and highlights efficiency for polynomial and smooth functions. - **Simpson’s Rules:** Show how higher-order polynomial interpolation improves accuracy. -These methods will be implemented and compared in subsequent assignments to build a deeper -understanding of numerical integration accuracy and efficiency. +These methods will be implemented and compared in subsequent assignments to build a deeper understanding of numerical integration accuracy and efficiency. --- ## Assignment 1 — Gaussian Quadrature Implement a Python function for two-point and three-point Gauss–Legendre quadrature over an -arbitrary interval \([a,b]\). Verify exactness for polynomials up to the appropriate degree and +arbitrary interval $[a,b]$. Verify exactness for polynomials up to the appropriate degree and compare performance against the trapezoidal rule on oscillatory test functions. --- diff --git a/tutorials/module_3/ode.md b/tutorials/module_3/5_ode.md index 23b647c..23b647c 100644 --- a/tutorials/module_3/ode.md +++ b/tutorials/module_3/5_ode.md |
