# Defining a new wavelet (Fibonacci wavelet)

I want to define a new wavelet (Fibonacci wavelet) in the reference. So, I read the tutorial on Wolfram Site, @Jason B. ' s answer, and also @Sektor 's answers. But I still have some problems in my code while defining wavelet function in Eq. (6).

Clear["Global*"];
g[n_, t_] := 1/Sqrt[Integrate[Fibonacci[n, t]^2, {t, 0, 1}]] Fibonacci[n, t]
FibonacciWavelet[]["WaveletQ"] := True
FibonacciWavelet[]["OrthogonalQ"] := True
FibonacciWavelet[]["BiorthogonalQ"] := False
FibonacciWavelet[]["WaveletFunction"] := g[#1, #2] &


First Goal: Where is the problem in the code above? When I run the following code; I get the error WaveletPsi::bbdwave: The specification FibonacciWavelet[2] is not a valid wavelet specification recognized by the system.

WaveletPsi[FibonacciWavelet[2], x]


Second Goal: I want to derive the followings: The following code is right?

\[CapitalPsi][n_, m_, t_] :=2^((k-1)/2)WaveletPsi[FibonacciWavelet[m], 2^((k - 1)/2) t - n + 1]
k = 2; M = 3;
Column[Table[
Simplify@\[CapitalPsi][i, j, t], {j, 0, M - 1, 1}, {i, 1, 2^(k - 1), 1}] // Flatten]


Third Goal: Finally; how to save the new type of wavelet in order to use WaveletPsi[FibonacciWavelet[m],x]
as though the already defined wavelets (DaubechiesWavelet etc.) Please see:

• What is the purpose of your definition? Do you try to follow paper cited or do you try to follow Mathematica tutorial? Sep 4, 2021 at 4:26
• I am trying to follow the Mathematica tutorial about how to define new wavelets. Sep 4, 2021 at 5:56
• Definition of wavelets with Mathematica very differ from common applications like it described in the paper . Sep 4, 2021 at 11:38
• I understand. All right, how to write an efficient code in order to achieve steps in the post? What is your code suggestion? Sep 4, 2021 at 17:02
• I can recommend to use standard definition from the paper as it shown in my answer. The function what you try to define with Mathematica is useless. Sep 14, 2021 at 3:31

You need to (1) use a different integration variable in the integral (which is Integrate, not Int) and (2) use an immediate assignment in the definition of $$g$$ so that the integral in the denominator is not re-evaluated every time you request a wavelet.

Using partial memoization:

Clear[g];
g[n_Integer] := g[n] = Function[t, Evaluate[
Fibonacci[n, t]/Sqrt[Integrate[Fibonacci[n, s]^2, {s, 0, 1}]]]]


g now returns pure functions that are memoized:

g[3]
(*    Function[t$$, 1/2 Sqrt[15/7] (1 + t$$^2)]    *)


Calling one of these with an argument gives the wavelet:

g[3][t]
(*    1/2 Sqrt[15/7] (1 + t^2)    *)


Now defining

FibonacciWavelet[_]["WaveletQ"] = True;
FibonacciWavelet[_]["OrthogonalQ"] = True;
FibonacciWavelet[_]["BiorthogonalQ"] = False;
FibonacciWavelet[n_Integer]["WaveletFunction"] := g[n]


you can request, for example,

FibonacciWavelet[3]["WaveletFunction"][t]
(*    1/2 Sqrt[15/7] (1 + t^2)    *)

• Thank you. Your code works, but it is not what I exactly want. I can' t use WaveletPsi[FibonacciWavelet[2], x] in your code. I want to save the new wavelet and I want to use WaveletPsi[FibonacciWavelet[m],x] such as the already defined wavelets. (HaarWavelet etc.) Please see: reference.wolfram.com/language/ref/WaveletPsi.html Sep 3, 2021 at 12:10

We can answer Second Goal, since it has some meaning in connection with the paper cited (with application to delay problems). For second goal we have definitions of Fibonacci wavelets (note, first line can be extended to arbitrary n)

in = Table[Integrate[Fibonacci[n, t]^2, {t, 0, 1}], {n, 10}];

g[n_, t_] := Fibonacci[n + 1, t]/Sqrt[in[[n + 1]]]

psi[k_, n_, m_, t_] :=
Piecewise[{{2^((k - 1)/2) g[m, 2^(k - 1) t - n + 1], (n - 1)/
2^(k - 1) <= t < n/2^(k - 1)}, {0, True}}]

Psi[k_, M_, t_] :=
Flatten[Table[psi[k, n, m, t], {n, 1, 2^(k - 1)}, {m, 0, M - 1}]]


With this definitions we can compute test example as follows

With[{k = 2, M = 3}, Psi[k, M, t]]


Vector Psi` can be used to solve some problems like described in the paper.