# Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world.

## Wavelet Transforms

#### Synopsis

```#include <boost/math/quadrature/wavelet_transforms.hpp>

template<class F, typename Real, int p>
class daubechies_wavelet_transform
{
public:
daubechies_wavelet_transform(F f, int grid_refinements = -1, Real tol = 100*std::numeric_limits<Real>::epsilon(),
int max_refinements = 12) {}

daubechies_wavelet_transform(F f, boost::math::daubechies_wavelet<Real, p> wavelet, Real tol = 100*std::numeric_limits<Real>::epsilon(),
int max_refinements = 12);

auto operator()(Real s, Real t)->decltype(std::declval<F>()(std::declval<Real>())) const;

};
}
```

The wavelet transform of a function f with respect to a wavelet ψ is

For compactly supported Daubechies wavelets, the bounds can always be taken as finite, and we have

which also defines the s=0 case.

The code provided by Boost merely forwards a lambda to the trapezoidal quadrature routine, which converges quickly due to the Euler-Maclaurin summation formula. However, the convergence is not as rapid as for infinitely differentiable functions, so the default tolerances are modified.

A basic usage is

```auto psi = daubechies_wavelet<double, 8>();
auto f = [](double x) {
return sin(1/x);
};
auto Wf = daubechies_wavelet_transform(f, psi);

double w = Wf(0.8, 7.2);
```

An image from this function is shown below. Copyright © 2006-2021 Nikhar Agrawal, Anton Bikineev, Matthew Borland, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert Holin, Bruno Lalande, John Maddock, Evan Miller, Jeremy Murphy, Matthew Pulver, Johan Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg, Daryle Walker and Xiaogang Zhang Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)