A14 · Lesson 51 · Lab: fixed points, operators and Fourier means
Stopping rules, Gronwall against reality, matrix norms, worst-case inputs and Fejér means
The last third of the course moved into spaces of functions and operators: contractions and Picard iteration, Gronwall's inequality, operator norms, Fourier series and their Fejér means. In this lab you'll run each one. You'll stop a contraction with an a posteriori bound, measure how far two ODE solutions actually separate against Gronwall's guarantee, compute matrix norms three ways, build the input that drives a filter to its worst-case output, and compare Fejér means with plain partial sums at a jump.
- A filter with impulse response is driven by inputs bounded by 1.
- The worst input sets each sample to the sign of the matching tap, , so that every term in the convolution adds.
- The readout gives the resulting output, , which you'll reproduce in the lab: no bounded input can do better.
Predict
Two solutions of start 0.01 apart. Gronwall allows their gap to reach 0.20 by t = 3. What does an accurate simulation show?
About 0.012. Gronwall uses the worst case of the Lipschitz constant, , at every moment. Along these particular solutions is often small or negative, so the gap grows far less than . The bound is guaranteed; the actual behavior is usually much better.
Name it
A posteriori stopping
For a contraction with constant q, stop when falls below the tolerance: that bounds the true error of (lesson 33).
Matrix norms in NumPy
np.linalg.norm(A, 1), np.linalg.norm(A, np.inf) and np.linalg.norm(A, 2) give the induced 1-, ∞- and 2-norms (largest column sum, largest row sum, largest singular value).
Worst-case inputs
For a convolution, the output sample is largest when , which achieves , the norm. That's the operator norm on bounded signals, constructed explicitly.
Fejér means in code
Weight harmonic k by (lesson 42) and sum. Compare maxima near a jump with the plain partial sum.
Worked example
Iterate from 0 until two successive iterates differ by less than . How many steps, and how accurate is the result?
Show the solution
- Iterate. Sixteen steps reach , at
- The a posteriori bound. With q = ½, so the result is guaranteed to that accuracy.
- The actual rate. It's better than q: near the fixed point so each step gains about 0.66 digits.
- Compare the a priori bound. It assumes the worst rate from the start, and would ask for 34 steps.
Answer 16 steps, giving x = 0.4501836113, guaranteed to within .
Worked example
Compute , and for with NumPy, and check them against lesson 38.
Show the solution
- NumPy. It gives 6, 7 and 5.11667.
- By hand. The largest column sum is , the largest row sum , and the 2-norm is
- Compare with the spectral radius. All three bound the spectral radius from above, as any operator norm must, and here the 2-norm is the tightest of them. For a symmetric matrix it would equal the spectral radius exactly.
Answer , and , matching lesson 38.
Check
A contraction with q = 0.6 just took a step of 1 × 10⁻⁵. What bound does that give on the current error?
Check
Gronwall's bound for two solutions starting 0.01 apart, Lipschitz constant 1, at t = 3?
Check
Iterate from 0 until . Set steps and x.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Write rk4(f, y, T, steps) for a scalar ODE from t = 0. Integrate to T = 3 with 3000 steps from y(0) = 0 and from y(0) = 0.01. Set gap to their final difference and bound to Gronwall's .
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
For , set n1, ninf and n2 with np.linalg.norm, and rho to the largest absolute eigenvalue.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
For , n = 0 to 59, build the worst-case input (the signs of h, reversed in time) and set y to the output it produces at the last moment, ; set l1 to .
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
On 20 001 points of (0, π], set partial to the largest value of the square wave's partial sum and fejer to the largest value with each term weighted by .
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Explain why
Why is Gronwall's bound usually far from the actual separation of two solutions?
Gronwall's inequality replaces the rate at which two solutions separate by its largest possible value, the Lipschitz constant, at every instant and along every path. Real solutions spend much of their time where the local rate, here , is smaller, and sometimes where it's negative, so that neighboring solutions are pulled together. The exponential bound compounds the worst case over the whole interval, so the overestimate itself grows exponentially. The bound is valuable because it's always true and needs only one number; sharper estimates come from looking at the actual local rates, as the contracting version and Lyapunov exponents do.
Practice
Keep practicing
3 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.