The "Father Wavelet" :

ϕ[x_]=Piecewise[{{1,0<x<1}},0]

pic001=Plot[ϕ[x],{x,-1,2},PlotStyle->{Blue,Thick},ImageSize->350,Background->White]

pic002=Plot[ϕ[x],{x,0,1},PlotStyle->{Thick,Blue},Ticks->{Automatic,{0,1}},ImageSize->350,Background->White]

ϕ[x_,k_,j_]:=2^(j/2)ϕ[2^j x-k]

Plot[ϕ[x,0,0],{x,0,1},PlotStyle->Thick,PlotLabel->"ϕ(x)",Ticks->{Automatic,{0,1}},ImageSize->350]

k=0;j=1;
pic003=Plot[ϕ[x,k,j],{x,0,1},PlotStyle->{Thick,Blue},Ticks->{{0,1/2,1},{0,Sqrt[2]}},ImageSize->350,Background->White]

k=1;j=1;
pic004=Plot[ϕ[x,k,j],{x,0,1},PlotStyle->{Blue,Thick},Ticks->{{0,1/2,1},{0,Sqrt[2]}},Background->White]

k=0;j=2;
Plot[ϕ[x,k,j],{x,0,1},PlotStyle->Thick,PlotLabel->ϕ[k,j],Ticks->{Automatic,{0,1}}]

k=1;j=2;
Plot[ϕ[x,k,j],{x,0,1},PlotStyle->Thick,PlotLabel->ϕ[k,j],Ticks->{Automatic,{0,1}}]

k=5;j=3;
Plot[ϕ[x,k,j],{x,0,1},PlotStyle->{Blue,Thick},Ticks->{Table[k  2^(-3),{k,0,2^3}],{0,2 Sqrt[2]}},ImageSize->350,Background->White]

j=3;t3=Table[Plot[ϕ[x,k,j],{x,0,1},PlotStyle->{Blue,AbsoluteThickness[4]},PlotRange->{0,3},Ticks->{Table[k  2^(-3),{k,0,2^3}],{0,1,Sqrt[2],2,2 Sqrt[2]}},Background->White,PlotLabel->StringForm["`` ϕ(``x-``)",2^(j/2),2^j,k]],{k,0,7}];
j=2;t2=Table[Plot[ϕ[x,k,j],{x,0,1},PlotStyle->{Blue,AbsoluteThickness[4]},PlotRange->{0,3},Ticks->{Table[k  2^(-3),{k,0,2^3}],{0,1,Sqrt[2],2,2 Sqrt[2]}},Background->White,PlotLabel->StringForm["`` ϕ(``x-``)",2^(j/2),2^j,k]],{k,0,3}];
j=1;t1=Table[Plot[ϕ[x,k,j],{x,0,1},PlotStyle->{Blue,AbsoluteThickness[4]},PlotRange->{0,3},Ticks->{Table[k  2^(-3),{k,0,2^3}],{0,1,Sqrt[2],2,2 Sqrt[2]}},Background->White,PlotLabel->StringForm["`` ϕ(``x-``)",2^(j/2),2^j,k]],{k,0,1}];
j=0;t0=Table[Plot[ϕ[x,k,j],{x,0,1},PlotStyle->{Blue,AbsoluteThickness[4]},PlotRange->{0,3},Ticks->{Table[k  2^(-3),{k,0,2^3}],{0,1,Sqrt[2],2,2 Sqrt[2]}},Background->White,PlotLabel->StringForm["`` ϕ(``x-``)",2^(j/2),2^j,k]],{k,0,0}];

GraphicsGrid[{t0,{GraphicsGrid[{t1}]},{GraphicsGrid[{t2}]}},Frame->All,ImageSize->700]

Table[Integrate[2ϕ[x,i,2] 2ϕ[x,j,2],{x,0,1}],{i,0,3},{j,0,3}]

Table[Integrate[2Sqrt[2]ϕ[x,i,3] 2Sqrt[2]ϕ[x,j,3],{x,0,1}],{i,0,7},{j,0,7}]

The Search for the "Mother Wavelet" ψ (x):

First Step  - We need to satisfy two conditions:

ψ[x_]:=a Sqrt[2] ϕ[x,0,1]+b Sqrt[2] ϕ[x,1,1]

Integrate[(ψ[x])^2,{x,0,1}]==1

Integrate[ψ[x]ϕ[x],{x,0,1}]==0

Solve[{2 ((a^2)+(b^2))==1,((a+b)/2)==0}]

Let' s take the second choice :

ψ[x_]=a Sqrt[2]ϕ[x,0,1]+b Sqrt[2]ϕ[x,1,1]/.{a->(1/2),b->-(1/2)}

Plot[ψ[x],{x,0,1},PlotStyle->{Thick,Red},Ticks->{{0,1/2,1},{-1,0,1}},Background->White]

Second Step  - This time we have three conditions:

f[x_]:=a 2ϕ[x,0,2]+b 2 ϕ[x,1,2]+c 2ϕ[x,2,2]+d 2ϕ[x,3,2]

Integrate[(f[x])^2,{x,0,1}]==1

Integrate[f[x]ϕ[x,0,1],{x,0,1}]==0

Integrate[f[x]Sqrt[2]ϕ[x,1,1],{x,0,1}]==0

Solve[{Integrate[(f[x])^2,{x,0,1}]==1,Integrate[f[x]ϕ[x,0,1],{x,0,1}]==0,Integrate[f[x]2ϕ[x,1,1],{x,0,1}]==0}]

f[x_]=a 2ϕ[x,0,2]+b 2ϕ[x,1,2]+c 2ϕ[x,2,2]+d 2ϕ[x,3,2]/.{a->((Sqrt[1-8 (d^2)])/(2 (Sqrt[2]))),b->-((Sqrt[1-8 (d^2)])/(2 (Sqrt[2]))),c->-d}/.d->0

pic1=Plot[f[x],{x,0,1},PlotStyle->{Thick,Red},Ticks->{{0,1/4,1/2,3/4,1},{-Sqrt[2],0,Sqrt[2]}},Background->White]

Plot[f[x],{x,0,1},PlotStyle->{Thick,Red},Ticks->{{0,1/4,1/2,3/4,1},{-Sqrt[2],0,Sqrt[2]}}]

To determine a second function, we have to impose one more condition :

Clear[a,b,c,d];

g[x_]:=a 2ϕ[x,0,2]+b 2ϕ[x,1,2]+c 2ϕ[x,2,2]+d 2ϕ[x,3,2]

Solve[{Integrate[(g[x])^2,{x,0,1}]==1,Integrate[g[x]ϕ[x,0,1],{x,0,1}]==0,Integrate[g[x]ϕ[x,1,1],{x,0,1}]==0,Integrate[f[x] g[x],{x,0,1}]==0}]

g[x_]=a 2ϕ[x,0,2]+b 2ϕ[x,1,2]+c 2ϕ[x,2,2]+d 2ϕ[x,3,2]/.{c->(1/(2 (Sqrt[2]))),d->-(1/(2 (Sqrt[2]))),a->0,b->0}

pic2=Plot[g[x],{x,0,1},PlotStyle->{Thick,Red},Ticks->{{0,1/4,1/2,3/4,1},{-Sqrt[2],0,Sqrt[2]}},Background->White]

Approximating functions

48 (π/8+π/24)

f[x_]=Sin[10 x^2]+x^3-2x-Piecewise[{{Sin[96x],π/8<x<π/8+π/96},{0,False}}]

Plot[Evaluate[f[x]],{x,0,1},PlotStyle->{{Thick,Dashed,Green}},PlotPoints->2000]

j=6;
ϕ[x_]=ϕ[x_]=Piecewise[{{1,0<x<1}},0]
ϕ[x_,k_,j_]:=ϕ[2^j x-k]
a[k_]:=Integrate[2^(j/2)f[x] ϕ[x,k,j],{x,0,1}]

coeff=Table[a[k],{k,0,2^j-1}];
fcts=Table[2^(j/2) ϕ[x,k,j],{k,0,2^j-1}];
app[x_]=coeff.fcts;

Plot[{f[x],app[x]},{x,0,1},PlotStyle->{{Thick,Dashed,Green},{Thick,Blue}},Background->White]

j=7;
ϕ[x_]=ϕ[x_]=Piecewise[{{1,0<x<1}},0];
ϕ[x_,k_,j_]:=ϕ[2^j x-k]
a[k_]:=Integrate[2^(j/2)f[x] ϕ[x,k,j],{x,0,1}]

coeff=Table[a[k],{k,0,2^j-1}];
fcts=Table[2^(j/2) ϕ[x,k,j],{k,0,2^j-1}];
app2[x_]=coeff.fcts;

Plot[{f[x],app2[x]},{x,0,1},PlotStyle->{{Thick,Dashed,Green},{Thick,Blue}},Background->White]

Plot[app[x]-app2[x],{x,0,1},PlotStyle->{Thick,Red},PlotRange->All]

j=7;
ϕ[x_]=Which[x<0||x>1,0,0≤x≤1,1]
ϕ[x_,k_,j_]:=ϕ[2^j x-k]
a[k_]:=Integrate[2^(j/2)f[x] ϕ[x,k,j],{x,0,1}]

coeff=Table[a[k],{k,0,2^j-1}];
fcts=Table[2^(j/2) ϕ[x,k,j],{k,0,2^j-1}];
app[x_]=coeff.fcts;

Plot[{f[x],app[x]},{x,0,1},PlotStyle->{{Thick,Dashed,Green},{Thick,Blue}},Background->White]

Example

ψ[x_]=Piecewise[{{1,0<x<1/2},{-1,1/2<=x<1}},0];

coeff=(127+RandomInteger[{0,127},16])

coeff={180,167,244,190,159,242,176,192,168,250,175,219,193,232,200,234}

Entropy[coeff]

TeXForm[{180,167,244,190,159,242,176,192,168,250,175,219,193,232,200,234}]

j=4;fcts=Table[2^(j/2) ϕ[x,k,j],{k,0,2^j-1}];

v4[x_]=coeff.fcts;
p11=Plot[v4[x],{x,0,1},AxesOrigin->{0,0},PlotStyle->{Black,Thick},PlotRange->{0,1000},Background->White]

coeff3=Round[Sqrt[2]{(180+167)/2,(244+190)/2,(159+242)/2,(176+192)/2,(168+250)/2,(175+219)/2,(193+232)/2,(200+234)/2}]

coeff

Normal[SparseArray[{{i_,j_}/;i==2j-1->1,{i_,j_}/;i==2j->1},{16,8}]]

TeXForm[1/Sqrt[2]%]

Normal[SparseArray[{{i_,j_}/;i==2j-1->1,{i_,j_}/;i==2j->-1},{16,8}]]

TeXForm[1/Sqrt[2]%]

Round[1/Sqrt[2]coeff.SparseArray[{{i_,j_}/;i==2j-1->1,{i_,j_}/;i==2j->1},{16,8}]]

j=3;fcts3=Table[2^(j/2) ϕ[x,k,j],{k,0,2^j-1}];

v3[x_]=coeff3.fcts3;
p12=Plot[v3[x],{x,0,1},AxesOrigin->{0,0},PlotStyle->{Gray,Thick,Dashed},PlotRange->{0,1000},Background->White]

Show[p11,p12,Background->White]

Plot[coeff.fcts-coeff3.fcts3,{x,0,1},AxesOrigin->{0,0},PlotStyle->{Green,Thick}]

coeffm3=Round[1/Sqrt[2]coeff.SparseArray[{{i_,j_}/;i==2j-1->1,{i_,j_}/;i==2j->-1},{16,8}]]

j=3;w3[x_]=coeffm3.Table[2^(j/2) ψ[(2^j x-k)],{k,0,2^j-1}];Plot[w3[x],{x,0,1},Background->White,PlotStyle->{Gray,Thick,Dashed}]

Plot[{v3[x],v4[x]},{x,0,1},PlotStyle->{{Blue},{Red}}]

Plot[{v3[x]+w3[x],v4[x]},{x,0,1},PlotStyle->{{Blue},{Red}}]

Join[coeff3,coeffm3]
Entropy[Join[coeff3,coeffm3]]

ce1=CEnergy[{245,307,284,260,296,279,301,307,9,38,-59,-11,-58,-31,-28,-24},Background->White]

ce0=CEnergy[{180,167,244,190,159,242,176,192,168,250,175,219,193,232,200,234},PlotStyle->{Blue,Dashed,Thick},Background->White]

Show[ce0,ce1]