diff options
| author | Christian Kolset <christian.kolset@gmail.com> | 2025-09-22 00:44:12 -0600 |
|---|---|---|
| committer | Christian Kolset <christian.kolset@gmail.com> | 2025-09-22 00:44:12 -0600 |
| commit | 0c90b794fa3c11d5ca20722369080a52070ffaad (patch) | |
| tree | 5c306d2ecfeaa6475d276a48d2072c3983fcf29e /tutorials/module_3/4_numerical_integration.md | |
| parent | ab2b98a153216af10fa71f909a346bcc83533551 (diff) | |
Finished off system_of_equations and pde's
Diffstat (limited to 'tutorials/module_3/4_numerical_integration.md')
| -rw-r--r-- | tutorials/module_3/4_numerical_integration.md | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tutorials/module_3/4_numerical_integration.md b/tutorials/module_3/4_numerical_integration.md index 78b0328..06cb8b9 100644 --- a/tutorials/module_3/4_numerical_integration.md +++ b/tutorials/module_3/4_numerical_integration.md @@ -183,9 +183,6 @@ for n in n_list: ```python -#!/usr/bin/env python3 -# Gauss Quadrature using Gauss-Legendre method (manual 2-point & 3-point) - import numpy as np from scipy.integrate import quad # for reference "exact" integral @@ -244,6 +241,7 @@ print(f"Error (3-point): {err3:.2e}") ## Numerical Integration to Compute Work + ## Implementing the Composite Trapezoidal Rule **Objective:** Implement a Python function to approximate integrals using the trapezoidal rule. @@ -266,6 +264,7 @@ for n in [4, 8, 16, 32]: Students should compare results for increasing $n$ and observe how the error decreases with $O(h^2$). +--- ## Gaussian Quadrature Write 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 compare performance against the trapezoidal rule on oscillatory test functions. |
