diff options
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. |
