14. Separate averages and differences
All examples · Glossary: Haar pair · Papers, proofs, Lean, and code
Explore the 16-sample interactive Haar lab for four levels of decomposition, selectable details, and exact reconstruction errors.
Take the real signal \((2,6,10,14)\). For each neighboring pair \((u,v)\), define
We use the averaging normalization throughout this example.
Analyze the first level
For \((2,6)\), the average is \(4\) and the detail is \(-2\). For \((10,14)\), they are \(12\) and \(-2\). The averaging transform and its inverse are
Multiplying gives \(H^{-1}H=HH^{-1}=I\). The inverse rule is \(u=a+d\) and \(v=a-d\). It recovers \((4-2,4+2)=(2,6)\) and \((12-2,12+2)=(10,14)\).
Analyze the averages once more
The pair \((4,12)\) has average \(8\) and detail \(-4\). Store coefficients in the declared order
To invert, first reconstruct \((8-4,8+4)=(4,12)\). Then combine each of these averages with its saved detail. The result is the original four samples.
Track the effect of the normalization
For one pair, \(u^2+v^2=2(a^2+d^2)\). Applying this at both levels gives
The unweighted sum of the four stored coefficient squares is only \(88\). This \(H\) is not an orthogonal matrix: \(H^{\mathsf T}H=I/2\). Using \(\sqrt2H\) for a single pair gives an orthogonal matrix instead. Do not mix the two normalization conventions in reconstruction or energy checks.
Drop fine details and measure the loss
Set the two first-level details to zero, while keeping \(8\) and \(-4\). Reconstruction gives \((4,4,12,12)\). The residual is \((-2,2,-2,2)\) and its squared Euclidean norm is \(16\). The reconstructed squared norm is \(320\), so \(336=320+16\).
Try it
Transform \((1,3,5,7)\) in the same coefficient order.
Answer: The first averages are \((2,6)\) and the details are \((-1,-1)\). The stored coefficients are \((4,-2,-1,-1)\). Their weighted energy is \(4(16+4)+2(1+1)=84\), the original squared norm.
Papers, proofs, Lean, and code
Terms in this example: Haar pair · Detail coefficient · Normalization · Orthogonal matrix · Refinement
Paper V supplies signal background. Information Realization includes a finite Haar contract within its recorded formal core.
Paper V: Polyphase Signal Calculus
Read · Written proofs · Lean coverage · Code and setup · Evidence
Information Realization
Read · Written proofs · Lean coverage · Code and setup · Evidence
Related library guide and code examples. The guide covers related constructions and their software interfaces.
Python arithmetic check for this example: haar_pairs(). This checks the displayed rational, modular or finite-set calculations exactly.
The Lean links open each work’s recorded coverage and sources. They do not certify this tutorial. A work may have limited coverage or no linked Lean or code. Its page states what is available.