# Vanishing moment

Vanishing moments are a fundamental concept in wavelet theory, signal processing, and functional analysis. They describe a property of a wavelet or function, wherein certain integrals of the function against polynomial terms up to a specific degree vanish. This property is crucial in determining the ability of a wavelet to represent and compress signals effectively. It is used to evaluate whether the mother wavelet effectively captures high-frequency components of a signal.

## Origins

In the Continuous Wavelet Transform (CWT), the mother wavelet must satisfy five primary constraints:
1. Compact Support
2. Real Function
3. Even or Odd Symmetry
4. High Vanishing Moments
5. Admissibility Criterion
    $C_{\psi }=\int _{0}^{\infty }{\frac {|\Psi (f)|^{2}}{|f|}}df<\infty$,
    where $\Psi (f)$ is the Fourier transform of $\psi (t)$.

## Definition

Mathematically, a function $\psi (t)$ is said to have $n$ vanishing moments if:
    $\int _{-\infty }^{\infty }t^{k}\psi (t)dt=0,\quad {\text{for}}\ 0\leq k<p$
In simpler terms, a wavelet has vanishing moments up to order $n$ if it is orthogonal to all polynomials of degree $n-1$ or lower.
The $k$-th moment $m_{k}$ is defined as:
    $m_{k}=\int t^{k}\psi (t)dt$
where $\psi (t)$ has $p$ vanishing moments if $m_{0}=m_{1}=m_{2}=\ldots =m_{p-1}=0$.

## Calculations
### Calculating the zeroth moment

To compute $m_{0}$:
1. Calculate the Fourier transform of $g(t)$:
    $G(f)=\int g(t)e^{-j2\pi ft}dt$
2. Extract the DC component ($f=0$)
    $m_{0}=G(0)=\int g(t)dt$

### Calculating the k-th moment

Using a property of the Fourier transform: differentiating $k$-times in the frequency domain is equivalent to multiplying by $t^{k}$ in the time domain
${\frac {1}{(-j2\pi )^{k}}}G^{(k)}(f)=\,\int t^{k}g(t)e^{-j2\pi ft}dt$.
When $f=0$, this simplifies to:
    ${\frac {1}{(-j2\pi )^{k}}}G^{(k)}(0)=\int t^{k}g(t)dt$
Thus, the $k$-th moment $m_{k}$ can be computed as:
    $m_{k}={\frac {1}{(-j2\pi )^{k}}}G^{(k)}(0)$

## Common functions and their vanishing moments

Vanishing moments are one of the properties for analyzing wavelets. Here are some commonly used functions categorized into continuous functions and discrete coefficients of continuous functions:

### Continuous functions
#### Haar basis function

    Expression:
       $\psi (t)=\,{\begin{cases}1\quad &0\leq t<1/2,\\-1\quad &1/2\leq t<1,\\0\quad &{\text{otherwise.}}\end{cases}}$
    Since $\psi (t)$ is an odd function:
       $m_{0}=\int \psi (t)dt=0$
    However, $t\psi (t)$ is an even function:
       $m_{1}=\int t\psi (t)dt\neq 0$
   * Vanishing moments: 1

#### Ricker wavelet

    Expression.:
       $\psi (t)={\frac {2^{5/4}}{\sqrt {3}}}\,(1-2\pi t^{2})e^{-\pi t^{2}}$
    Since $\psi (t)$ is the second derivative of Gaussian function, its Fourier transform is:
       $F.T.\{\psi (t)\}=\,F.T.\left\{C{\frac {d^{2}}{dt^{2}}}e^{\pi t^{2}}\right\}=-C4\pi ^{2}f^{2}e^{-\pi f^{2}},\,C={\text{constants}}.$
    Using the moment formula:
       ${\frac {1}{(-j2\pi )^{k}}}G^{(k)}(0)=\,\int t^{k}g(t)dt$
    we find:
       $m_{0}=m_{1}=0,m_{2}\neq 0$
   * Vanishing moments: 2

#### p-th derivative of Gaussian function

    $F.T.\{\psi (t)\}=F.T.\left\{{\frac {d^{p}}{dt^{p}}}e^{-\pi t^{2}}\right\}\,=(j2\pi f)^{p}e^{-\pi f^{2}}$
   * Vanishing moments: $p$

### Discrete coefficients of continuous functions
#### Daubechies wavelet

* Daubechies wavelet, widely used in practice, has varying numbers of vanishing moments, offering a balance between localization in time and frequency domains.
* For a $2n$-point Daubechies wavelet, vanishing moment $=n$.

#### Symlet and Coiflets

* Symlets are designed for improved symmetry, and Coiflets ensure both wavelet and scaling functions have vanishing moments
* For a $2n$-point Symlet, vanishing moment $=n$.
* For a $6n$-point Coiflet, vanishing moment $=n$.

## Significance of vanishing moments for functions

Vanishing moments serve as an indicator of how a function decreases in magnitude. For example, consider the function:
    $f(t)={\frac {\sin(t)}{t^{2}}}$
As the input value $t$ increases toward infinity, this function decreases at a rate proportional to ${\frac {1}{t^{2}}}$. The decay rate of such a function can be evaluated using the momentum integral defined as $\int _{-\infty }^{\infty }t^{k}f(t)dt$.
In this example:
When $k=0$: The numerator $\sin(t)$ oscillates between $[-1,1]$, causing the function to oscillate within $\left[-{\frac {1}{t^{2}}},{\frac {1}{t^{2}}}\right]$. This oscillatory behavior ensures that:
    $\int _{-\infty }^{\infty }t^{k}{\frac {\sin(t)}{t^{2}}}dt\to 0$
Thus, the integral converges to 0, representing the zeroth momentum $m_{0}=0$.
When $k=1$:
    $\int _{-\infty }^{\infty }t^{k}{\frac {\sin(t)}{t}}dt=\pi$
Here, the first momentum is nonzero, $m_{1}=\pi \neq 0$.
For $k>1$: The momentum integral diverges as $t\to \infty$.
From this example, the maximum value of $k$ for which the momentum integral converges to zero determines the decay rate of the function. This maximum $k$ value is defined as the vanishing moment of the function.
In continuous wavelet transforms, one of the conditions for designing a wavelet mother function is that its support must be finite. The rate at which the wavelet mother function decays within this finite support is characterized by its vanishing moments.

## Equivalent statements of vanishing moments

According to the definition, the condition for a wavelet mother function $\psi (t)$ to have $p$ vanishing moments is:
    $\int _{-\infty }^{\infty }t^{k}\psi (t)dt=0,\quad {\text{for}}\ 0\leq k<p$
However, since this definition involves an infinite-range continuous integral, it is not practical for designing wavelet mother functions.
If the scaling function in the wavelet transform is defined as $\varphi (t)$, and the following relationship between the wavelet mother function and the scaling function holds:
    $\left|\psi (t)\right|=O((1+t^{2})^{-p/2-1})$
    $\left|\varphi (t)\right|=O((1+t^{2})^{-p/2-1})$
Then, the following four statements are equivalent:
1. The wavelet mother function $\psi (t)$ has $p$ vanishing moments.
2. The Fourier transforms of $\psi (t)$ and $\varphi (t)$, along with their derivatives up to $(p-1)$th order, are zero at $\omega =0$.
3. The Fourier transforms of $h_{\varphi }(t)$ and $H_{\varphi }(e^{j\omega })$, along with their derivatives up to $p-1$th order, are zero at $\omega =0$.
4. For any $k$ in the interval $0\leq k<p$,
    $q_{k}(t)=\sum _{n=-\infty }^{\infty }n^{k}\varphi (t-n)$
    is a polynomial function of degree $k$.

## Vanishing moments and wavelet function design

When the Fourier transform of a filter satisfies the following condition:
    ${\left|H_{\varphi }(\omega )\right|}^{2}+{\left|H_{\varphi }(\omega +\pi )\right|}^{2}=2$
the filter meets the condition of a conjugate mirror filter. Here, $H_{\varphi }(\omega )$ represents the Fourier transform of the discrete low-pass filter $h_{\varphi }[n]$.
By combining the conjugate mirror filter condition with the third equivalent statement of vanishing moments, the low-pass filter can be expressed as:
    $H_{\varphi }(e^{j\omega })={\sqrt {2}}\left({\frac {1+e^{j\omega }}{2}}\right)^{p}L(e^{j\omega })$
where $L(x)$ is a polynomial function.
Using the above condition and the equivalent statements of vanishing moments, the design process for wavelet functions can be simplified.

### Vanishing moments and filter length

In wavelet transforms, the scaling function and wavelet mother function can be defined using discrete filters:
    $\varphi (t)=\sum _{n}^h_{\varphi }[n]{\sqrt {2}}\varphi (2t-n)$
    $\psi (t)=\sum _{n}^h_{\psi }[n]{\sqrt {2}}\varphi (2t-n)$
Here, $h_{\varphi }[n]$ is the discrete low-pass filter, and $h_{\psi }[n]$ is the discrete high-pass filter. The filter length is usually expressed in terms of the size of support.
From the expression $H_{\varphi }(e^{j\omega })={\sqrt {2}}\left({\frac {1+e^{j\omega }}{2}}\right)^{p}L(e^{j\omega })$, we can observe that:
Choosing a higher number of vanishing moments $p$ results in $H_{\varphi }(e^{j\omega })$ being a polynomial function with higher powers of $e^{j\omega }$. Consequently, the corresponding $h_{\varphi }[n]$ will have a longer filter length.
In general, there is a trade-off between having a higher number of vanishing moments and a shorter filter length; both cannot be achieved simultaneously.
Thus, when designing the wavelet mother function for continuous wavelet transforms, considerations should include not only the number of vanishing moments but also the corresponding filter length.