A1450 of 55
0 XP
  1. Hook
  2. Predict
  3. Name it
  4. Check
  5. Explain

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 et, and compute the L2 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 x/(1+100x2) get to the true value 0.05?

Name it

What you'll write

  1. sup_norm(g, a, b, n=2001): the largest |g(x)| on n equally spaced points of [a, b], using NumPy.
  2. picard(f, y0, T, iters, n=2001): Picard's iteration yk+1(t)=y0+∫0tf(s,yk(s))ds on a grid of n points over [0, T], starting from the constant y0, with the integral done by the cumulative trapezoid rule. Return the list of iterates (arrays), first one included.
  3. 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 L2 error by numerical integration of the squared difference, the same by Parseval, 2π−16π∑k odd≤K1k2, and the largest value of the sum.

What to expect

  • sup[0,0.9]⁡xn=0.9n, and sup⁡x1+nx2=12n (lesson 25).
  • Picard's iterates for y˙=y are the Taylor polynomials of et (lesson 34).
  • The two L2 errors agree; the peak stays near 1.179 (lesson 40).

Worked example

How accurate is the cumulative trapezoid rule for ∫01esds on 2001 points?

Show the solution
  1. The step. The step is h = 0.0005.
  2. The trapezoid error. It's about h212(e−1)=3.6×10−8
  3. 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 3.6×10−8, too small to spoil the comparison with the theory.

Worked example

What should the L2 error be for the square wave summed through K = 25?

Show the solution
  1. The squared error. error2=2π−16π∑k odd≤251k2=6.2832−5.0930×1.2145=0.0979
  2. Take the root. 0.0979=0.313
  3. Check. Your direct integral should agree to about three digits on a fine grid.

Answer the L2 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 x1+49x2 on [0, 1]?

Check

By Parseval, what's the L2 error of the square wave's sum through harmonic K = 7?

Explain why

Why do the L2 error and the Gibbs peak tell different stories about the same Fourier sums?

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.