A14 · Lesson 50 · Analysis lab
Sup norms, Picard iterates and Fourier errors, computed and checked
Analysis proves things about limits; computation lets you watch them happen. In this lab you'll measure sup norms to tell uniform from pointwise convergence, run Picard's iteration on a grid and watch it build , and compute the error of a square wave's Fourier sums two ways, by direct integration and by Parseval's identity, to see them agree while the Gibbs overshoot refuses to shrink. Each task checks the computation against the exact value the theory predicts.
Predict
On a grid of 2001 points over [0, 1], how close can a computed sup norm of get to the true value 0.05?
Very close. Near a smooth maximum the function is flat, so missing the peak by a grid spacing h costs only about . Here the grid even contains x = 0.1, so the computed value is exact to rounding. Sharp features (like the Gibbs peak) need finer grids.
Name it
What you'll write
sup_norm(g, a, b, n=2001): the largest on n equally spaced points of [a, b], using NumPy.picard(f, y0, T, iters, n=2001): Picard's iteration on a grid of n points over [0, T], starting from the constant , with the integral done by the cumulative trapezoid rule. Return the list of iterates (arrays), first one included.square_errors(K, n=20001): for the ±1 square wave on [−π, π] and its Fourier sum over odd harmonics up to K, return(l2_direct, l2_parseval, peak): the error by numerical integration of the squared difference, the same by Parseval, , and the largest value of the sum.
What to expect
- , and (lesson 25).
- Picard's iterates for are the Taylor polynomials of (lesson 34).
- The two errors agree; the peak stays near 1.179 (lesson 40).
Worked example
How accurate is the cumulative trapezoid rule for on 2001 points?
Show the solution
- The step. The step is h = 0.0005.
- The trapezoid error. It's about
- Compare with the Picard errors. That's far below the Picard iterates' own errors for the first ten or so iterations, so the grid doesn't spoil the comparison with the theory.
Answer the error is about , too small to spoil the comparison with the theory.
Worked example
What should the error be for the square wave summed through K = 25?
Show the solution
- The squared error.
- Take the root.
- Check. Your direct integral should agree to about three digits on a fine grid.
Answer the error should be 0.313.
Check
Step 1. Write sup_norm(g, a, b, n=2001).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 2. Write picard(f, y0, T, iters, n=2001) returning the list of iterates.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 3. Write square_errors(K, n=20001) returning (l2_direct, l2_parseval, peak).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
What sup norm should your sup_norm report for on [0, 1]?
Check
By Parseval, what's the error of the square wave's sum through harmonic K = 7?
Explain why
Why do the error and the Gibbs peak tell different stories about the same Fourier sums?
The error adds up the squared difference over the whole interval, so it measures how much energy is missing; the peak measures the single worst value. As more harmonics are added, the partial sums match the square wave better almost everywhere, and the ringing near the jumps squeezes into narrower regions, so the integrated error shrinks toward zero. But in each of those narrowing regions the sum still overshoots by about 9% of the jump, so the worst-case error never shrinks. Computing both shows directly that the series converges in energy but not uniformly.
Practice
Keep practicing
5 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.