Peaks and jumps reconstruction with B-splines scaling functions

Peaks and jumps reconstruction with B-splines scaling functions

Luis Ortiz-Gracia Centre de Recerca Matemàtica, Campus de Bellaterra, Edifici C, 08193 Bellaterra (Barcelona), Spain  and  Josep J. Masdemont Departament de Matemàtica Aplicada I, Universitat Politècnica de Catalunya, Diagonal 647, 08028 Barcelona, Spain
October 2012

We consider a methodology based in B-splines scaling functions to numerically invert Fourier or Laplace transforms of functions in the space . The original function is approximated by a finite combination of order B-splines basis functions and we provide analytical expressions for the recovered coefficients. The methodology is particularly well suited when the original function or its derivatives present peaks or jumps due to discontinuities in the domain. We will show in the numerical experiments the robustness and accuracy of the method.

1. Introduction

Fourier and Laplace transforms are useful in a wide number of applications in science and engineering. As it is well known, the Fourier transform is closely related to the Laplace transform for zero value funcions on the negative time axis. There is a strong interest in the efficient numerical inversion of Laplace transforms ([1],[2]) and Fourier transforms, due to the fact that the solutions to some problems are known in the transform domain rather than in the original domain. An increasing number of papers have recently appeared to invert Fourier transforms with wavelets, like [8] and [9] with coiflets wavelets and [10] with Mexican, Morlet, Poisson and Battle-Lemarié wavelets. In particular in the Financial Engineering context, [11] inverts a Laplace transform by means of B-splines wavelets of order .

Recently, a new method called the COS method developed in [7] for solving the inverse Fourier integral is capable to accurately recover a function from its Fourier transform in a short CPU time being as well of very easy implementation. However, when the function to be recovered presents discontinuities or it is highly peaked, a lot of terms in the expansion must be considered to reduce the approximation error.

In this paper we present a novel approximation based on B-splines scaling functions to numerically invert Fourier transforms that it is particularly suited for functions that exhibit peaks and/or jumps in its domain. There are some properties that, at first glance, make these basis functions particularly suited to approximate such non-smooth functions. B-splines are the most regular scaling functions with the shortest support for a given polynomial degree. Another important fact is the explicit formulation in the time (or space) domain as well as in the frequency domain. However a slight drawback of these basis functions is that the system that they form is semi-orthogonal, i.e., the scaling functions are orthogonal among different scales but not necessarily at the same scale.

In previous work [14] the authors numerically inverted the Laplace transform of a distribution function in the interval making use of the Haar scaling functions. Now, in the present paper, we consider the problem of inverting the Fourier transform to recover an function by approximating it by a finite sum of B-splines scaling functions of order (where is the particular case of the Haar system). We also provide a list of the different errors accumulating within the numerical procedure. So, here, the Fourier inversion is carried out with B-splines scaling functions rather than with wavelet functions ([10]) or a combination of both ([8],[9]). We fix the scale parameter in the wavelet expansion and only remaining is the translation parameter, facilitating the inversion procedure. Furthermore, we provide an analytical expression for the coefficients of the approximation.

As will be shown in the section devoted to numerical examples, the Wavelet Approximation (WA) that we present is well capable to detect jumps or peaks produced by discontinuities in the function itself or in first derivatives. On the contrary, the COS method is better to approximate analytical functions.

The paper is organized as follows. In Section 1.1 we give a short literature review regarding the Laplace transform inversion. Section 2 gives a brief introduction concerning multiresolution analysis and B-splines scaling functions. In Section 3 we present the Wavelet Approximation method to recover functions from its Fourier transform by means of B-splines scaling functions. Section 4 is devoted to the COS method, while numerical experiments, comparing the Wavelet Approximation and the COS method are shown in Section 5. Finally, Section 6 concludes.

1.1. Laplace transform inversion

Suppose that is a real- or complex-valued function of the variable and is a real or complex parameter. We define the Laplace transform of as,


whenever the limit exists (as a finite number).

We state the inverse transform as a theorem (see [6] for a detailed proof).

Theorem 1.

(Bromwich inversion integral) If the Laplace transform of exists, then,


where for some positive real number and is any other real number such that .

The usual way of evaluating this integral is via the residues method taking a closed contour, often called the Bromwich contour.

In this section we present some numerical algorithms to invert the Laplace transform. A natural starting point for the numerical inversion of Laplace transforms is the Bromwich inversion integral stated in Theorem 1. If we choose a specific contour and perform the change of variables in (2), we obtain an integral of a real valued function of a real variable. Then, after algebraic manipulation and after applying the Trapezoidal Rule we obtain,


where denotes the real part of . A detailed analysis of the errors can be found in [2].

As pointed out in [2], the Bromwich inversion integral is not the only inversion formula and there are quite different numerical inversion algorithms. We refer the readers to the Laguerre series representation given in [1], which is known to be an efficient method for smooth functions. However, if is not smooth at just one value of , then the Laguerre method has difficulties at any value of .

In the context of numerical Laplace inversion, [8] recovers the function with a procedure based on wavelets. They consider in expression (2), where is a real variable and is a real constant that fulfills , assuming that when . Then, equation (1) can be rewritten as,



where denotes the Fourier transform of . The authors expand in terms of Coiflets wavelets,


where , , being and the scaling and wavelet functions respectively.

The next step consists in inverting the expression (5) by means of the Fourier inversion formula. Finally, considering the expression (4), the formulae of Laplace inversion become,

One drawback of this approximation is that the wavelet approach involves an infinite product of complex series and the computation of the Fourier transform of some scaling functions. This can look intimidating for practical applications and may also take relatively long computational time.

Based on operational matrices and Haar wavelets, the author in [4] presents a new method for performing numerical inversion of the Laplace transform where only matrix multiplications and ordinary algebraic operations are involved. However, the essential step in the method consists in expressing the Laplace transform in terms of , which is impossible when we just know numerically the transform. Another drawback of this method is that the matrices become very large for larger scales.

2. Multiresolution analysis and cardinal B-splines

A natural and convenient way to introduce wavelets is following the notion of multiresolution analysis (MRA). Here we provide the basic definitions and properties regarding MRA and B-spline wavelets, for further information see [13, 5].

Definition 1.

A countable set of a Hilbert space is a Riesz basis if every element of the space can be uniquely written as , and there exist positive constants and such that,

Definition 2.

A function is called a scaling function, if the subspaces of , defined by,

where , satisfy the properties,

  1. .

  2. .

  3. .

  4. For each , is a Riesz (or unconditional) basis of .

We also say that the scaling function generates a multiresolution analysis of .

The order cardinal -spline function, , is defined recursively by a convolution:



We note that cardinal -spline functions are compactly supported, since the support of the order -spline function is , and they have as the Fourier transform,

In this paper we consider as the scaling function which generates a MRA (see Figure 1). Clearly, for we have the scaling function of the Haar wavelet system. We also remark that from the previous discussions, for every function , there exists a unique sequence , such that,

Figure 1. Cardinal B-splines of orders .

3. The wavelet approximation method

Let us now consider a function and its Fourier transform, whenever it exists:

Since we can expect that decays to zero, so it can be well approximated in a finite interval by,


Let us approximate for all , where,


with convergence in -norm. Note that we are not considering the left and right boundary scaling functions (we refer the reader to Section 3 in [12] for a detailed description of scaling functions on a bounded interval).

The main idea behind the Wavelet Approximation method is to approximate by and then to compute the coefficients by inverting the Fourier Transform. Proceeding this way,

Introducing the change of variables , gives us,

Finally, taking into account that and performing the change of variables , we have,

If we consider,

then, according to the previous formula, we have,


Since is a polynomial, it is (in particular) analytic inside a disc of the complex plane for . We can obtain expressions for the coefficients by means of the Cauchy’s integral formula. This is,

where denotes a circle of radius , , about the origin.

Considering now the change of variables , , gives us,


where , and and stand for the real and imaginary parts of , respectively.

Note that if then we can further expand the expression above by considering,


On the other side, since , we have,


and it has a pole at . Finally, making use of (8) and taking into account the former observation, we can exchange by in (9) and (10) to obtain, respectively,




where is a positive real number.

In practice, both integrals in (12) and (13) are computed by means of the Trapezoidal Rule, and we can define,

where and for all . Proceeding this way we find,


where .

Let us summarize four sources of error in our procedure to compute the numerical Fourier transform inversion using cardinal B-splines wavelets. These are:

  1. Truncation of the integration range,

  2. The approximation error at scale ,

  3. The discretization error, which results when approximating the integral by using the trapezoidal rule. We can apply the formula for the error of the compound trapezoidal rule considering,

    and assuming that . Then,

  4. The roundoff error. If we can calculate the sum in expression (14) with a precision of , then the roundoff error after multiplying by a factor is approximately . Then, the roundoff error increases when approaches to 0.

3.1. Choice of the parameter

As mentioned before, the choice of the parameter may have influence in both, the discretization and the roundoff errors. In this section we present a detailed analysis of the errors listed before in order to determine the optimum value. To do this, let us consider a step function defined in , where represents the indicator function, and its Fourier transform .

Due to the shape of it seems that the best B-splines basis to perform the approximation is based in the Haar scaling functions (B-splines of order ). In this particular case and its derivatives up to order can be computed relatively straightforwardly, so that we will be able to calculate the optimal value of the parameter in order to minimize the discretization and the roundoff errors. We also demonstrate that the approximation error (type (B)) is in this case. To do so, we consider,

where , and,

Now, we must choose an appropriate value to control both the discretization and the round-off errors. First of all, we consider the discretization error which can be estimated by means of expression (15). We note that since,

So we have,



where the last approximation holds for suitably small values of the parameter . For sake of simplicity, we consider only the terms with smaller exponents in the parameter for the expressions and . Then,




where and are polynomials in with degree greater than , and the approximations in (17) and (18) hold for suitably small values of the parameter . Finally, taking into account expressions (15),(16),(17) and (18) we have,

We note that as while the roundoff error is increasing in as approaches to zero.

Then, the total error should be approximately minimized when the two estimates are equal. This leads to the equation,

After algebraic manipulation, we find,


As mentioned before, the roundoff error arises when multiplying the sum in expression (14) by the pre-factor . Let us consider , then the of interest is which is the greatest value that this parameter can take (small values of do not cause roundoff errors).

The left plot of Figure 2 represents the pre-factor for values of , while the right plot shows the pre-factor values for . We also display in Table 1 the pre-factor values for different values of and scales , and .

Figure 2. Pre-factor for , and scales , and .
Table 1. Pre-factor for , and scales , and .

On the one hand, it is clear that we must concentrate in this second interval in order to get a reasonable roundoff error and on the other hand, the discretization error grows when is close to . Later, in the numerical examples section, we will confirm the theory developed above for the step function.

Since is compactly supported, we have .

Note that in the case that ,

where, is the Haar basis (orthonormal) system in . Then,


since . Then, the approximation error depends on the length of the interval and the detail coefficients,


Furthermore, since the detail coefficients (21) are zero, then we have also that and the approximation is exact at any scale level .

4. The COS method

For completeness, we present here the methodology developed in [7] for solving the inverse Fourier integral111In order to maintain the notation used by the authors, here (22) represents the characteristic function, and hence the Fourier transform of a density function .. The main idea is to reconstruct the whole integral from its Fourier-cosine series expansion extracting the series coefficients directly from the integrand. Fourier-cosine series expansions usually give an optimal approximation of functions with a finite support [3]. In fact, the cosine expansion of in equals the Chebyshev series expansion of in .

For a function supported on , the cosine expansion reads,

with . For functions supported on any other finite interval , the Fourier-cosine series expansion can easily be obtained via a change of variables,

It then reads,



Since any real function has a cosine expansion when it is finitely supported, the derivation starts with a truncation of the infinite integration range in (22). Due to the conditions for the existence of a Fourier transform, the integrands in (22) have to decay to zero at and we can truncate the integration range in a proper way without losing accuracy.

Suppose is chosen such that the truncated integral approximates the infinite counterpart very well, i.e.,


Here, denotes a numerical approximation.

Comparing equation (24) with the cosine series coefficients of on in (23), we find that,

where denotes the real part of the argument. It then follows from (24) that with,

We now replace by in the series expansion of on , i.e.,


and truncate the series summation such that,


The resulting error in consists of two parts, a series truncation error from (25) to (26) and an error originated from the approximation of by . An error analysis that takes these different approximations into account is presented in [7].

The COS method performs well when approximating smooth functions, but many terms are needed in case that the function or its first derivative has discontinuities along the domain of approximation.

5. Numerical examples

The aim here is to show the accuracy of B-splines to invert Fourier transforms of extremely peaked or discontinuous functions with finite support. We will consider the B-splines scaling functions of order . We denote by WAi-j the Wavelet Approximation method with B-splines of order at scale , which involves coefficients and COS-N the COS approximation method with terms.

To compute the coefficients of the Fourier inversion in expression (14), we must set the parameters. For this purpose we consider , where is the order of the B-spline considered and is the scale parameter. Observe that if we take instead of in (14) this leads to the following expression,


for , so the computation time reduces for large scale approximations.

Finally, we set . Although we know that and , we must take into account the two types of errors (C) (discretization) and (D) (roundoff) listed previously, which may have influence on the computation of the coefficients. Due to the fact that the function is in general intractable from an analytical point of view, we carried out intensive simulations in order to understand the influence of parameter . We did these simulations considering the test functions and at different scale levels and used B-splines scaling functions of order . To show just an example, we have plotted the results for and B-splines of order at scale (Figure 3) and (Figure 4). The colors represent the magnitude of the logarithm of the absolute errors. As we can observe, the absolute error remains constant for values . When , the error increases for high values of (i.e. high values of the translation parameter ) and decreases for low values of (i.e. low values of the translation parameter ). It is worth mentioning that for high scales, the error grows very rapidly when (empirical findings demonstrate that , for this reason we take approximately the midpoint of the interval avoiding ), while this effect diminishes for shorter scales. In fact, as we will see later with the step function, the roundoff error almost disappears at very low scales (for instance ) and the discretization error tends to zero when tends to zero. These facts confirm the high impact of the roundoff error at high scale levels and only the impact of the discretization error at very low scales.

Figure 3. Logarithm of the absolute error for the approximation of the function () with B-splines of order at scale .
Figure 4. Logarithm of the absolute error for the approximation of the function () with B-splines of order at scale .

For comparison, we gave in Section 4 a brief overview of the COS method developed by Fang and Oosterlee ([7]) that is based on a Fourier-cosine series expansion and which usually gives optimal approximations of functions with finite support ([3]). The COS method is state of the art and has been applied to efficiently recover density functions from their Fourier transforms in order to solve important problems arising in Computational Finance.

Let us consider the step function presented before. Observe that if we take , there is almost no roundoff error and the only remaining error is the discretization error . If we assume that , then according to (19) , . The left plot of Figure 5 shows the approximation to the step function with the COS and the WA method with . The right plot of Figure 5 represents the absolute error of the approximation with the COS and the WA method with and the optimum computed with expression (19). Note that with just coefficients the WA method is capable to accurately approximate the step function, while the COS method suffers from the Gibbs phenomenon even if a lot of terms (we show up to ) are added to the COS expansion.

Note that if we consider the approximation to the step function at scale , then the values computed for the parameter are all of them in a neighborhood of in accordance with the massive simulations performed before.

The conclusion in that case is that the COS method performs poorly around the jump and exhibits the Gibbs phenomenon, while Haar wavelets are naturally capable to deal with this discontinuity.

Figure 5. Zoom of the approximation (left) and absolute error of the approximation (right) to the function .

5.1. Exponential function

Let us consider the exponential function, and its Fourier transform .

Observe that this function becomes extremely peaked when . We will test the inversion with and .

We consider the interval and . We carry out the comparison between both methods using approximately the same number of terms in the approximation. It is worth mentioning that the computation of wavelet coefficients is more time consuming than the calculation of COS coefficients. Moreover, the COS method is easier to implement. Results are reported in Table 2 and plotted in Figure 6. We observe that linear B-splines are the most suitable basis functions to approximate highly peaked functions like the exponential we are considering. While adding many more terms in the COS expansion improves only a bit the approximation, when we consider B-splines of order at higher scales the approximation error decays much more faster. The WA method with B-splines of order performs better than the WA method with B-splines of orders and .