<< Calculus`DiracDelta`

W[x_]  :=  UnitStep[x] UnitStep[1 - x]

\(thisPlot[g_] := 
      Plot[g[x], {x, \(- .1\), 1.1}, 
        PlotRange -> {{\(- .1\), 1.1}, {\(-1.1\), 1.1}}]; 

    plotij[g_, i_Integer, j_Integer] := 
      Plot[g[x, i, j], {x, \(- .1\), 1.1}, PlotPoints -> 256, 
        PlotRange -> {{\(- .1\), 1.1}, {\(-1.1\), 1.1}}]; \)

thisPlot[W]

WW[x_, j_Integer, i_Integer] := W[(2^j) x - i]

plotij[WW, 7, 120]

V[x_, j_Integer, i_Integer] := 
      WW[x, j + 1, 2  i] - WW[x, j + 1, 2  i + 1]

plotij[V, 3, 2]

Do[plotij[V, i, j], {i, 0, 5}, {j, 0, (2^i) - 1}]

y  =  Table[Sin[x], {x, 0, Pi,  .1}]

ListPlot[y]

{a,b,c,d} -> { (a+b)/sqrt(2),   (c+d)/sqrt(2),  (a-b)/sqrt(2), (c-d)/sqrt(2) }
 sqrt(2) factors preserve length of vector.
 Then do recursively on left side.  Essentially decomposes in terms of "multi-resolution" scales.
 Inverse is obvious :    (m,n,p,q) ->   ( (m+p)/sqrt(2), (m-p)/sqrt(2),  n+q, n-q )
 => Wavelet (haar) transform !     Localized!  Self-similar on smaller and smaller scales!  Preserves power!   (sum of squares)
        Filter:   don't send anything smaller than given cutoff => lossy transform => compression !
  
  Can we code this as a class exercise?  In mathematica?  In C?
  
  applications:  sound  (1D)
                       images (2D)
  
  more general original scaling function; can overlap with next one
  
    a b c d
         a b c d
              a  b  c  d
   
   daub4   wavelet

Options[Plot]