Question: How to implement decomposition function respect basis wavelet Haar and scaling Haar fucntions form MRA?

I describe my problem accurately in mws file. I have a step function
 

First step. This is f(x) function

 

 

f := piecewise(-2 <= x and x < -1, 1, -1 <= x and x < 0, -1, 0 <= x and x < 1/2, 2, 1/2 <= x and x < 1, -2, 0)

piecewise(-2 <= x and x < -1, 1, -1 <= x and x < 0, -1, 0 <= x and x < 1/2, 2, 1/2 <= x and x < 1, -2, 0)

(1)

Next step. I try to approximate this function f(x) using wavelet transform, and  I  want to decomposite this function, choose wavelet Haar function and scaling functon  , choose basisn funtion from multiresolution analysis of the Lebesgue space  L^2(R). I choose  such wavelet fucntion `&varphi;`(x) from space MRA V0 and scaling function psi(x)from space MRA V0:NULL

`&varphi;__0` := piecewise(0 < x and x < 1/2, 1, 1/2 < x and x < 1, -1, 0)

piecewise(0 < x and x < 1/2, 1, 1/2 < x and x < 1, -1, 0)

(2)

`&psi;__0` := piecewise(0 < x and x < 1, 1, 0)

piecewise(0 < x and x < 1, 1, 0)

(3)

After I try approximate initial function f(x), decomposed using such contruction:

"f(x) =(&sum;) (&sum;)`C__m,k` `&varphi;__m,k`(x)  &approx;   f(x) =(&sum;)`C__i` `&varphi;__i` (x-k)"

"f(x) = (&sum;) (&sum;)`D__m,k` `psi__m,k`(x)    &approx;   f(x)=(&sum;)`D__i` `psi__i` (x-k)"

where coeff m shows, space MRA, to which the basis function belongs, and kk shows,basis function shift (x-k)

i.e. I try decompose function respective to basis function, where coeffs calculate the such way:

`C__m,k` = int(f(x)*`&varphi;__m,k`(x), x = -infinity .. infinity)

`D__m,k` = int(f(x)*`&psi;__m,k`(x), x = -infinity .. infinity)

The approximation is considered satisfactory if the following condition is  true:

sup = LinearAlgebra[Norm](f(x)-(sum(sum(`C__m,k`*`&varphi;__m,k`(x), k = 0 .. infinity), m = 0 .. infinity))) and LinearAlgebra[Norm](f(x)-(sum(sum(`C__m,k`*`&varphi;__m,k`(x), k = 0 .. infinity), m = 0 .. infinity))) <= .1

sup = LinearAlgebra[Norm](f(x)-(sum(sum(`D__m,k`*`&psi;__m,k`(x), k = 0 .. infinity), m = 0 .. infinity))) and LinearAlgebra[Norm](f(x)-(sum(sum(`D__m,k`*`&psi;__m,k`(x), k = 0 .. infinity), m = 0 .. infinity))) <= .1

For example `&varphi;__i` calculate that such way:

`&varphi;i` := proc (j, k, t) local a, b, c, m; m := 2^j; a := k/m; b := (k+1/2)/m; c := (k+1)/m; return piecewise(a <= t and t < b, 1, b <= t and t < c, -1) end proc

if `&varphi;__i`the wavelet Haar functions:

`&varphi;__i` := piecewise(a <= x and x < b, 1, b <= x and x < c, -1, 0)

piecewise(a <= x and x < b, 1, b <= x and x < c, -1, 0)

(4)

a = k/m, b = (k+.5)/m, c = (k+1)/m

Then vector of Haar functions compute using the follow code:

N := 2^J; `&varphi;d` := Vector(N); H := Matrix(N, N); T := Vector(N); `&varphi;d`[1] := `&varphi;1`(t); for i to N do T[i] := (i-1/2)/N end do; for j from 0 to J-1 do m := 2^j; for k from 0 to m-1 do i := m+k+1; `&varphi;d`[i] := `&varphi;i`(j, k, t) end do end do; for i to N do for j to N do H[i, j] := eval(`&varphi;d`[i], t = T[j]) end do end do

``

Then integrals

`&approx;`(int(`&varphi;__m,k`(x), x = -infinity .. infinity), `p__d,1`(x)) and `p__d,1`(x) = int(`&varphi;__d`(x), x = 0 .. x) and `&approx;`(int(`&varphi;__d`(x), x = 0 .. x), `P__d `*`&Phi;__d`)

`&approx;`(int(`&psi;__m,k`(x), x = -infinity .. infinity), `p__d,1`(x)) and `p__d,1`(x) = int(`&psi;__d`(x), x = 0 .. x) and `&approx;`(int(`&psi;__d`(x), x = 0 .. x), `P__d `*`&Psi;__d`)

where `P__d ` is an d-square matrix called an operational matrix of integration

pn := proc (i, n, t) if n = 1 then return int(`&varphi;d`[i], t) end if; return int(pn(i, n-1, t)) end proc

NULL

And now, it's not working, so I have troubles for calculate coeffs and writing and  plotting this result, so, I have some questions:

1) How to calculate coeffs `C__m,k`and `D__m,k`  for my fucntion f(x) and get value of coeffs?
2) How to implement integration and write the final sum (approximation of function f(x)?

3) How to calculate  

LinearAlgebra[Norm](f(x)-(sum(sum(`C__m,k`*`&varphi;__m,k`(x), k = 0 .. infinity), m = 0 .. infinity)))

LinearAlgebra[Norm](f(x)-(sum(sum(`D__m,k`*`&psi;__m,k`(x), k = 0 .. infinity), m = 0 .. infinity)))

and plot initial function f(x) and approximation sum at one plot?
 

Do I understand correctly that I need to calculate this integral for my function on each interval of my function?

int(`&varphi;__m,k`(x), x = -2 .. -1); int(`&varphi;__m,k`(x), x = -1 .. 0); int(`&varphi;__m,k`(x), x = 0 .. 1/2); int(`&varphi;__m,k`(x), x = 1/2 .. 1)

int(`&psi;__m,k`(x), x = -2 .. -1); int(`&psi;__m,k`(x), x = -1 .. 0); int(`&psi;__m,k`(x), x = 0 .. 1/2); int(`&psi;__m,k`(x), x = 1/2 .. 1)

How to implement this procedure?


Code for calculating procs a I try ude from this source: http://www.m-hikari.com/ams/ams-2012/ams-125-128-2012/sunmonuAMS125-128-2012.pdf

Download LR1.mw

I would be very grateful for any help!

Please Wait...