1. The Core Idea
We want to approximate:
by sampling the function at discrete points.
2. Trapezoidal Rule
Instead of rectangles, we use trapezoids.
Key properties:
-
Error ~ O(h²)
-
Assumes linear variation between points
👉 Think: “connect the dots with straight lines”
3. Simpson’s Rule
Now we approximate using parabolas (quadratic fit).
Key properties:
-
Error ~ O(h⁴) (much faster convergence)
-
Requires even number of intervals
Think: “fit smooth curves instead of straight lines”
4. The Real Question: Which is Better?
| Method | Accuracy | Cost | When it works best |
|---|
| Trapezoidal | Medium | Low | Rough/oscillatory data |
| Simpson | High | Medium | Smooth functions |
5. A Perfect Test Function
Use something smooth but non-trivial:
6. What we Observe
🔸 Trapezoidal:
-
Error decreases slowly
-
Roughly divides by ~4 when doubling n
🔸 Simpson:
-
Error drops dramatically faster
-
Roughly divides by ~16 when doubling n
This directly reflects:
7. How to read the plot
You’ll see:
-
Two descending lines
-
Simpson drops much faster
Key insight:
If you visually estimate slope:
You’ll get:
-
≈ 2 → trapezoidal
-
≈ 4 → Simpson
7. Deep Insight (Important)
This experiment teaches:
-
Numerical methods are about approximating shape
-
Higher-order ≠ always better
-
Smoothness of function matters
-
There is a trade-off between truncation error and floating-point error
No comments:
Post a Comment