1 Introduction

We consider in this paper developing efficient quadrature methods for an integral whose integrand is a product of a smooth function and the Gaussian function with a small standard deviation. Gaussian functions [2, 15, 23, 29, 30] arise in many areas of mathematics, physics and engineering, especially in the fields of statistics, probability theory [9, 10], image and signal processing [2, 11, 14, 20, 31]. Design of numerical quadrature formulas for the integral is important for numerical analysis for the aforementioned applications. When the standard deviation is small, high order derivatives of the Gaussian function oscillate dramatically near the position of the peak of the curve of the Gaussian function, and decay rapidly away from that position. Standard numerical quadratures of such an integral normally lead to poor accuracy due to the rapid change in the derivatives of its integrand when the standard deviation is small. We identified this computational challenge while we worked on a project of image processing whose results were presented in [20]. Computing integrals of this type requires special effort.

Quadrature schemes that we design for computing the integral is based on graded meshes constructed according to the standard deviation so that the resulting quadrature errors on the subintervals are approximately equal. The integral in each of the subintervals is then computed by considering the Gaussian function as a weight function and interpolating the smooth factor of the integrand at the Chebyshev points of the first kind. We establish accuracy of exponential and polynomial orders for the proposed quadrature schemes according to the regularity of the smooth factor of the integrand. We present numerical results to confirm the accuracy estimates.

In the literature, quadrature formulas for the integrals involved the Gaussian function were designed according to properties of the Gaussian function. The well-known Gauss–Hermite quadrature [1, 8] in numerical analysis was designed for the integrals with the Gaussian weight in an unbounded integration interval. The weights of the quadrature formulas can be computed exactly, which are integrals with the integrand defined by a product of a polynomial and the Gaussian function. We call these integrals the moments, and their computation in a bounded integration interval can be found in [27]. A numerical quadrature for higher dimensional integration with the Gaussian weight was developed in [19]. However, quadrature formulas for integrals involved the Gaussian function are inadequate in the literature for the case when the standard deviation of the Gaussian function is small. Such integrals require careful numerical treatment, since higher order derivatives of the Gaussian function have severe oscillation with large magnitude.

The purpose of this paper is to design efficient quadrature formulas for the integrals involved the Gaussian function for the case when the standard deviation is small. Motivated by the subdivision in nonuniform fashion for the singular integrals [3, 16, 25] and oscillatory integrals [21, 22], we shall divide the integration interval into subintervals according to the standard deviation of the Gaussian function, and approximate the integrals in each of the resulting subintervals by replacing the smooth factor of integrand by an interpolating polynomial. The interpolation nodes are chosen as the Chebyshev points of the first kind [5, 8, 26, 32]. The weights of the quadrature formulas are computed by utilizing the error function [1, 12, 18, 29]. The accuracy of these quadrature formulas increases as the standard deviation of the Gaussian function tends to zero and the computational complexity is independent of the standard deviation of the Gaussian function.

This paper is organized in six sections. We discuss in Sect. 2 properties of the Gaussian function to motivate the numerical integration for the integrals involved the Gaussian function with a small standard deviation. In Sect. 3, we establish a basic quadrature formula for computing the integrals involved the Gaussian function in a reference integration interval. We then propose in Sect. 4 two composite quadrature formulas based on dividing the integration interval into subintervals according to the standard deviation of the Gaussian function, and using the formula developed in the previous section to calculate the integrals in the subintervals. Orders of accuracy for the proposed quadrature formulas are presented in this section. A computation method of the weights for the quadrature formulas is provided in Sect. 5. We show in Sect. 6 numerical results to verify the theoretical accuracy estimate of the proposed quadrature formulas.

2 Integrals Involved the Gaussian Function

In this section, we first discuss intrinsic difficulties in numerical integration by using traditional quadrature schemes for an integral whose integrand is a product of a smooth function and the Gaussian function with a small standard deviation. This motivates us to design graded meshes of the integration interval according to the standard deviation of the Gaussian function.

We begin with recalling the definition of the Gaussian function. For three fixed real numbers \(c_0\), \(c_1\) and \(c_2\), a Gaussian function is of the form

$$\begin{aligned} G(x;c_0,c_1,c_2):=c_1\exp \left\{ -\dfrac{(x-c_2)^2}{2c_0^2}\right\} ,\quad \text {for}~x\in \mathbb {R}, \end{aligned}$$

where \(c_0>0\) is called the standard deviation, \(c_1>0\) is the maximum of G, and \(c_2\) is the position of the maximum of G occurring. The graph of G is a symmetric bell shaped curve. The parameter \(c_0\) controls the width of the bell, and \(c_1\) and \(c_2\) are respectively the height and the position of the peak of the bell. The Gaussian function with \(c_1:=1/(c_0\sqrt{2\pi })\) is the probability density function of a normally distributed random variable with expected value \(c_2\) and variance \(c_0^2\). Without loss of generality, we assume that \(c_1=1\). The behaviours of G and its derivatives are influenced by the standard deviation and the center of the peak in the graph of G. We simplify the parameters of G by

$$\begin{aligned} G_{\alpha ,\beta }(x):=\mathrm{e}^{-\alpha ^2(x-\beta )^2},\quad \text {for}~x\in \mathbb {R}, \end{aligned}$$
(2.1)

where \(\alpha >0\) and \(\beta \) is a real number. We let \(G_\alpha :=G_{\alpha ,0}\). Clearly, \(\alpha :=1/(\sqrt{2}c_0)\) is the \(1/\sqrt{2}\)-multiple of the reciprocal of the standard deviation of the Gaussian function. A small standard deviation corresponds to a large parameter \(\alpha \). Therefore, in the remaining part of this paper, we shall consider the integral involved \(G_{\alpha ,\beta }\) for a large \(\alpha \). Specifically, we shall study numerical integration for the integral having the form

$$\begin{aligned} \mathcal {I}_{\alpha }[f]:=\int _If(x)G_\alpha (x)\mathrm{d}x, \end{aligned}$$
(2.2)

where \(I:=[0,1]\), \(\alpha \gg 1\) and \(f\in C(I)\) is independent of \(\alpha \). The integrals involved \(G_{\alpha ,\beta }\) with \(\beta \ne 0\) may be treated by first splitting the integral interval into two subintervals, on each of which \(\beta \) is an end point, and then changing the integrals defined on the subintervals into the integrals defined on I having the form (2.2). The quadrature methods to be proposed for (2.2) can extend straightforward to the general case.

Fig. 1
figure 1

The derivatives of \(G_\alpha \). a\(m = 0\), b\(m = 10\)

Fig. 2
figure 2

The derivatives of \(G_\alpha \). a\(m = 15\), b\(m = 30\)

We first review properties of \(G_\alpha \) and its derivatives for \(\alpha >1\). Let \(\mathbb {N}:=\left\{ 1, 2,\ldots \right\} \) and \(\mathbb {N}_0:= \{0\}\cup \mathbb {N}\). For \(n\in \mathbb {N}_0\), we denote by \(H_n\) the Hermite polynomials [1]. For \(m\in \mathbb {N}_0\), the m-th derivative of \(G_\alpha \) is given by

$$\begin{aligned} G^{(m)}_\alpha (x)=(-1)^m\alpha ^mH_m(\alpha x)G_\alpha (x), \quad \text {for}~x\in \mathbb {R}. \end{aligned}$$
(2.3)

We plot in Figs. 1, 2 and 3 the graphs of \(G^{(m)}_\alpha \) with \(\alpha =50\) for different m in the interval \([-\,0.1,0.1]\), with \(m=0\), 10, 15, 30, 35 and 50. From the graph of \(G_{\alpha }\) shown in Fig. 1a, we see that it looks like a bell, with the center of the bell being zero and the height of the bell being one. However, in Figs. 1b, 2 and 3, the graph of the derivatives of \(G_{\alpha }\) oscillates rapidly near zero when m becomes large and the maximum of the derivatives increases fast as m gets large. For the special case that \(m\in \mathbb {N}_0\) is even, by introducing the Hermite number [17] given by

$$\begin{aligned} H_m(0)= (-1)^{m/2}2^{m/2}(m-1)!!, \end{aligned}$$

we observe that the maximum of the derivatives of \(G_\alpha \) grows in an exponential order of \(\alpha \), since \(G^{(m)}_\alpha (0)=\alpha ^mH_m(0)\). Meanwhile, the tail of the graph of the derivatives of \(G_{\alpha }\) falls off quickly on the both sides and approaches the x-axis. The high order derivatives of the Gaussian function behave like oscillatory functions near the position of the peak of its curve when \(\alpha \) is large.

Fig. 3
figure 3

The derivatives of \(G_\alpha \). a\(m = 35\), b\(m = 50\)

Fig. 4
figure 4

The AE of the approximation to the value of the integrals of \(G_\alpha \) with fixed n. a\(n = 100\), b\(n = 1000\)

We now discuss difficulties in computing the integral (2.2) by using a traditional quadrature scheme. As an example, we calculate the integral \(\mathcal {I}_\alpha [f]\) with \(f(x):=1\), \(x\in I\), for different choices of \(\alpha \), by employing the composite trapezoidal rule with n equidistant nodes. One might expect that the trapezoidal rule would produce satisfactory numerical results since the Gaussian function is infinitely differentiable. However, we obtain rather disappointing numerical results. We plot in Fig. 4 the absolute error (AE) of the computed integral value for (a) \(n=100\) and (b) \(n=1000\). From Fig. 4, we see that for a fixed number of quadrature nodes, the accuracy of the quadrature formula decreases as \(\alpha \) increases. We then plot in Fig. 5 the absolute error of the computed integral value with fixed \(\alpha \) for (a) \(\alpha =100\), (b) \(\alpha =1000\) and (c) \(\alpha =10000\). We observe that in order to have certain order of accuracy, the number of quadrature nodes should increase proportional to the value of \(\alpha \).

Fig. 5
figure 5

The AE of the approximation to the value of the integrals of \(G_\alpha \) with fixed \(\alpha \). a\(\alpha = 100\), b\(\alpha = 1000\), c\(\alpha = 10000\)

The numerical phenomena shown in the above numerical example can be well explained by the error representation of the quadrature formula. We now recall the error of the composite quadratures \(\mathcal {I}_n^m[G_\alpha ]\), for computing \(\mathcal {I}_\alpha [f]\), where we subdivide I into n equal subintervals and use the closed Newton–Cotes formula with \(m+1\) quadrature nodes to calculate the integrals defined on each subinterval. From the error of the Newton–Cotes formula [13] together with (2.3), we see that there exists \(\xi \in I\) such that

$$\begin{aligned}&\left| \mathcal {I}_n^m[G_\alpha ]-\mathcal {I}_\alpha [f]\right| =c_{m}G_\alpha (\xi ) \left| H_{m+\gamma }(\alpha \xi )\right| \left( \frac{\alpha }{n}\right) ^{m+\gamma }, \nonumber \\&\quad \ \ \gamma =1\ \text {for odd} \ m \ \text {and}\ \gamma =2\ \text {for even} \ m \end{aligned}$$
(2.4)

where \(c_m\) are defined by

$$\begin{aligned} c_m:=\frac{1}{(m+1)!m^{m+2}} {\left\{ \begin{array}{ll} J_m, &{}\quad \text {if} \ m \ \text {is odd},\\ (m(m+2))^{-1}J_m, &{}\quad \text {if} \ m \ \text {is even}, \end{array}\right. } \end{aligned}$$

with

$$\begin{aligned} J_m:= {\left\{ \begin{array}{ll} \left| \int _0^m\prod \nolimits _{j=0}^m(t-j)\mathrm{d}t\right| , &{}\quad \text {if} \ m \ \text {is odd},\\ \left| \int _0^mt\prod \nolimits _{j=0}^m(t-j)\mathrm{d}t\right| , &{}\quad \text {if} \ m \ \text {is even}. \end{array}\right. } \end{aligned}$$

We introduce a complex number \(q_m:=(-\mathrm{i})^m2^m/\sqrt{\pi }\) and a complex-valued function by

$$\begin{aligned} E_m(t):=\int _{-\infty }^{+\infty }\mathrm{e}^{-s^2+\mathrm{i}2ts}s^m\mathrm{d}s, \ \text {for}\ t\in \mathbb {R}, \end{aligned}$$

where \(\mathrm{i}\) denotes the imaginary unit, see [1]. We then write

$$\begin{aligned} H_m(t)=q_m\mathrm{e}^{t^2}E_m(t), \quad \text {for}\ t\in \mathbb {R}. \end{aligned}$$

By the definition of \(G_\alpha \), we have that

$$\begin{aligned} G_\alpha (\xi )H_m(\alpha \xi )=q_mE_m(\alpha \xi ). \end{aligned}$$

Substituting the equation above into (2.4) yields

$$\begin{aligned} \left| \mathcal {I}_n^m[G_\alpha ]-\mathcal {I}_\alpha [f]\right| =c_m|q_m E_{m+\gamma }(\alpha \xi )|\left( \frac{\alpha }{n}\right) ^{m+\gamma }, \ \ \gamma =1\ \text {for odd}\ m \ \text {and}\ \gamma =2 \ \text {for even} \ m. \end{aligned}$$

The error formula above shows that for the quadrature rule to converge, we have to choose n larger than \(\alpha \). This will result in large computation costs to compute the integral when \(\alpha \) is large. This explains the reason why the trapezoidal rule applied to computing the integral of the Gaussian function does not converge when \(\alpha \) is larger than n.

We conclude from the analysis above that using traditional quadrature formulas to calculate integrals involved the Gaussian function becomes expensive to obtain satisfactory numerical results if \(\alpha \) is large. One reason is that the maximum (which occurs near zero) of the high order derivative of \(G_\alpha \) is large. We are required to add more number of quadrature nodes in order to improve accuracy of the numerical integration. However, the values of the high order derivatives of \(G_\alpha \) decay rapidly when moving away from zero and have high oscillation near zero. Clearly, adding more quadrature nodes uniformly in the integral interval increases computational costs. It is therefore important to utilize the property of the Gaussian function to design efficient quadrature formulas for computing these integrals.

To close this section, we describe the main idea to be used in this paper in designing efficient quadrature formulas for computing (2.2). Inspired by the quadrature formulas proposed in [3, 4, 16, 25] for weakly singular integrals and in [21, 22] for highly oscillatory integrals, we shall develop quadrature formulas for (2.2) as follows. We fix a positive integer n, independent of the parameter \(\alpha \). Design a graded mesh of n subintervals according to \(\alpha \). Choose a basic quadrature formula to be used for integration on each of the subintervals associated with the graded mesh. The graded mesh is designed in the way that the resulting integration errors on all the subintervals are approximately equal. We shall show that the accuracy of the proposed quadrature formulas for (2.2) increases as \(\alpha \) increases and the number of functional evaluations of the integrand used in the quadrature formula is independent of \(\alpha \).

In the remaining sections of this paper, we shall complete the following three tasks:

  1. (i)

    Propose a quadrature formula for integrals involved \(G_{\alpha ,\beta }\) on the interval \([-\,1,1]\), where the Chebyshev points of the first kind are used as the quadrature nodes. This formula will serve as a basic quadrature formula for developing composite formulas for computing the integrals (2.2).

  2. (ii)

    Design a partition with a fixed number n of subintervals of the integral interval I, with the break-points of the partition being distributed according to both the parameter \(\alpha \) and the number n. Develop composite quadrature formulas for computing the integrals (2.2), one with accuracy of a polynomial order for a smooth factor f having differentiability of a finite order, and another with accuracy of an exponential order for f having infinite differentiability.

  3. (iii)

    Develop a method for computing exactly the moments of the basic quadrature formula with the help of the error function.

3 A Basic Quadrature Formula

We describe in this section a basic quadrature formula for computing the integral

$$\begin{aligned} \mathcal {I}_{\alpha ,\beta }[f]:=\int _{\hat{I}}f(x)G_{\alpha ,\beta }(x)\mathrm{d}x, \end{aligned}$$
(3.1)

with \(\hat{I}:=[-1,1]\), where \(f\in C(\hat{I})\) is independent of \(\alpha \) and \(G_{\alpha ,\beta }\) is defined by (2.1) for \(\alpha >1\). The quadrature formula is designed by interpolating f at the Chebyshev points of the first kind [5, 8, 26, 32] and calculating the weights of the resulting formula exactly. The advantage of interpolating at the Chebyshev points is to avoid the well-known Runge phenomenon. The quadrature formula will be used as a basic rule to design the composite quadrature formula for the integral \(\mathcal {I}_\alpha [f]\) defined by (2.2) in the following section.

The basic numerical quadrature formula for computing the integral (3.1) is derived by replacing the function f in the integral by its Lagrange interpolation polynomial. For a fixed positive integer \(m\in \mathbb {N}\), we denote by \(p_m\) the Lagrange interpolation polynomial of degree m, which interpolates f at the Chebyshev points of the first kind

$$\begin{aligned} t_j:=\cos \left( (2j+1)\pi /(2m+2)\right) ,\quad \text{ for }\quad j\in \mathbb {Z}_{m}:=\left\{ 0,1,\ldots ,m\right\} . \end{aligned}$$

By replacing the function f in the integral (3.1) with \(p_m\), we obtain the quadrature formula

$$\begin{aligned} \mathcal {Q}^{\alpha ,\beta }_m[f]:=\mathcal {I}_{\alpha ,\beta }[p_m] \end{aligned}$$
(3.2)

for computing an approximate value of the integral (3.1). We now express the Lagrange polynomial \(p_m\) in terms of the Chebyshev polynomials of the first kind \(T_n\) for \(n\in \mathbb {N}_0\). Namely,

$$\begin{aligned} p_m(x)=\mathop {{\sum }'}_{ j\in \mathbb {Z}_m}c_j(f)T_j(x),\quad \text {for}\quad x\in I, \end{aligned}$$

where the prime denotes a sum whose first term is halved and for \(j\in \mathbb {Z}_m\)

$$\begin{aligned} c_j (f):=\dfrac{2}{m+1}\sum _{k\in \mathbb {Z}_m}f(t_k)T_j(t_k). \end{aligned}$$

The formula (3.2) is rewritten as

$$\begin{aligned} \mathcal {Q}^{\alpha ,\beta }_m[f]:=\mathop {{\sum }'}_{ j\in \mathbb {Z}_m}c_j(f)\mathcal {I}_{\alpha ,\beta }[T_j]. \end{aligned}$$

Upon introducing the numbers

$$\begin{aligned} A_{j,k}:=(-1)^k\frac{(j-k-1)!}{k!(j-2k)!}2^{j-2k-1}, \end{aligned}$$

we have that

$$\begin{aligned} T_n(x)=n\sum _{k\in \mathbb {Z}_{\left\lfloor \frac{n}{2}\right\rfloor }}A_{n,k} x^{n-2k}, ~\text {for}~n\in \mathbb {N}, \end{aligned}$$

where \(\lfloor a \rfloor \) denotes the biggest integer not larger than a, see [24]. Let \(q_j(x):=x^j\), for \(x\in \hat{I}\), \(j\in \mathbb {Z}_{m}\). We introduce the moments

$$\begin{aligned} w_{\alpha ,\beta ,j}:=\mathcal {I}_{\alpha ,\beta }[q_j], \quad \text {for}\quad j\in \mathbb {Z}_{m}. \end{aligned}$$
(3.3)

Formula (3.2) may be re-expressed in terms of the moments \(w_{\alpha ,\beta ,j}\) as

$$\begin{aligned} \mathcal {Q}^{\alpha ,\beta }_m[f]=\dfrac{c_0(f)w_{\alpha ,\beta ,0}}{2}+\mathop {{\sum }}_{ j\in \mathbb {Z}_m^+}jc_j(f)\sum _{k\in \mathbb {Z}_{\left\lfloor \frac{j}{2}\right\rfloor }}A_{j,k}w_{\alpha ,\beta ,j-2k}. \end{aligned}$$
(3.4)

An approximate value of the integral may be computed according to formula (3.4) once the moments \(w_{\alpha ,\beta ,j}\) are available. We postpone the computation of the moments \(w_{\alpha ,\beta ,j}\) until Sect. 5. Formula (3.4) is the basic quadrature formula we shall use in each of the subintervals determined by the mesh to be proposed in the next section.

In the next lemma, we present an estimate of the error of the basic quadrature formula

$$\begin{aligned} \mathcal {E}^{\alpha ,\beta }_m[f]:=\left| \mathcal {I}_{\alpha ,\beta }[f]-\mathcal {Q}^{\alpha ,\beta }_m[f]\right| . \end{aligned}$$

We let \(\left\| \varphi \right\| _\infty :=\max \left\{ \left| \varphi (x)\right| : x\in \Omega \right\} \) for a bounded function \(\varphi \) defined in \(\Omega \).

Lemma 3.1

If \(f\in C^{m+1}(\hat{I})\) for some \(m\in \mathbb {N}\) and \(\alpha >1\), then

$$\begin{aligned} \mathcal {E}^{\alpha ,\beta }_{m}[f]\le \dfrac{\sqrt{\pi }}{2^m(m+1)!\alpha }\left\| f^{(m+1)}\right\| _{\infty }. \end{aligned}$$

Proof

By the definition of the error \(\mathcal {E}^{\alpha ,\beta }_{m}[f]\), we observe that

$$\begin{aligned} \mathcal {E}^{\alpha ,\beta }_{m}[f]\le \left\| f-p_m\right\| _{\infty }\mathcal {I}_{\alpha ,\beta }[g] \end{aligned}$$
(3.5)

with \(g(x):=1\) for \(x\in \hat{I}\). According to [12], we have that

$$\begin{aligned} \mathcal {I}_{\alpha ,\beta }[g]\le \int _{-\infty }^{\infty }G_{\alpha ,\beta }(x)\mathrm{d}x= \sqrt{\pi }/\alpha . \end{aligned}$$
(3.6)

We recall that the error of the Lagrange interpolating of degree \(m\in \mathbb {N}\) at the Chebyshev points of the first kind for a function \(f\in C^{m+1}(\hat{I})\) is bounded by

$$\begin{aligned} \left\| f-p_m\right\| _{\infty }\le \dfrac{1}{2^m(m+1)!}\left\| f^{(m+1)}\right\| _{\infty }. \end{aligned}$$
(3.7)

Substituting both (3.6) and (3.7) into the right hand side of (3.5) yields the desired estimate. \(\square \)

To close this section, we comment on the relationship between the parameter \(\alpha \) and \(\mathcal {I}_\alpha [f]\) defined by (2.2) for a bounded function f. From (3.6), we see that \(\mathcal {I}_\alpha [f]\) decays to zero not slower than \(\mathcal {O}(\alpha ^{-1})\) as \(\alpha \rightarrow \infty \). Hence, if we approximate the integral \(\mathcal {I}_\alpha [f]\) simply by the number zero, its error is bounded by \(\mathcal {O}(\alpha ^{-1})\). We may say that any approximation to \(\mathcal {I}_\alpha [f]\) is less accurate than simply using the number zero is useless. We are required to design quadrature formulas for computing \(\mathcal {I}_\alpha [f]\) with accuracy better than the zero.

4 Quadrature Formulas Based on the Graded Mesh

We develop in this section composite quadrature formulas for computing the integrals (2.2) for the case \(f\in C(I)\) is independent of \(\alpha \) and \(\alpha >1\) (that is, the standard deviation \(c_0\) of the Gaussian function is less than \(1/\sqrt{2}\)). The composite quadrature formulas are developed based on graded meshes determined by \(\alpha \) and the number n of the subintervals to be designed. Two types of composite quadrature formulas are proposed, one with accuracy of a polynomial order for a smooth factor f having smoothness of a finite order, and the other with accuracy of an exponential order for f having smoothness of the infinite order.

We first motivate the design of the graded mesh of the integral interval I. Ideally, the break-points of the graded mesh should be distributed so that the resulting quadrature formula has equal errors on all the subintervals determined by the mesh. Specifically, we let \(n\in \mathbb {N}\) and suppose that I is partitioned by \(0=x_0<x_1<\cdots < x_n=1\) with the break-points \(x_j\) to be determined. By \(E_j\) we denote the error of the quadrature formula on the subinterval \(I_j:=[x_{j-1}, x_j]\), \(j\in \mathbb {Z}_{n}^+:=\{1,2, \ldots , n\}\). That is,

$$\begin{aligned} E_j=\int _{-1}^{1}\left| h_jf(h_jx/2+(x_j+x_{j+1})/2)/2-p_m(x)\right| G_\alpha (h_jx/2+(x_j+x_{j+1})/2)\mathrm{d}x, \end{aligned}$$

where \(h_j:=x_{j}-x_{j-1}\) and \(p_m(x)\) is the Lagrange interpolation polynomial of degree \(m\in \mathbb {N}\) at the Chebyshev points of the first kind which approximates \(h_jf(h_jx/2+(x_j+x_{j+1})/2)/2\) for \(x\in \hat{I}\). The best choice of the break-points of the graded-mesh would ensure that the errors \(E_j\) are all equal. However, it is not possible to have the explicit form of \(x_j\). We then appeal to conservative upper bounds of \(E_j\). From (3.7) we obtain upper bounds of the error on all subintervals

$$\begin{aligned} E_j\le \dfrac{G_\alpha (x_j)h_j^{m+2}}{2^{2m+1}(m+1)!}\left\| f^{(m+1)}\right\| _{\infty }, \quad \text {for}~j\in \mathbb {Z}_{n}^+. \end{aligned}$$
(4.1)

One strategy to choose the break-points of the graded-mesh is to solve the following system of equations for \(x_j\)

$$\begin{aligned} G_\alpha (x_j)h_j^{m+2}=G_\alpha (x_{j+1})h_{j+1}^{m+2}, \quad \text {for}~j\in \mathbb {Z}_{n-1}^+. \end{aligned}$$
(4.2)

Again, it is difficult to solve the system explicitly. Instead of solving (4.2) exactly, motivated by the idea proposed in [21, 22] for computing an oscillatory integral, we propose a strategy to partition the interval I. Specifically, for \(n\in \mathbb {N}\) with \(n>1\), we partition the interval I with the break-points defined by

$$\begin{aligned} x_0=0,~x_j=\alpha ^{(j-1)/(n-1)-1}, \quad \text {for}~j\in \mathbb {Z}_n^+. \end{aligned}$$
(4.3)

This choice of the break-points ensures that Eq. (4.2) are approximately satisfied.

The proposed quadrature formulas are constructed by employing the graded-mesh (4.3) with a transformation mapping each of the subintervals \([x_{j-1}, x_{j}]\) onto \(\hat{I}:=[-\,1,1]\) and using the basic quadrature formula to compute the resulting integrals on \(\hat{I}\). Specifically, we use the affine transformation \(x\mapsto h_jx/2+(x_{j-1}+x_j)/2\) to map \([x_{j-1},x_j]\) onto \(\hat{I}\). Accordingly, the integral (2.2) may be written as

$$\begin{aligned} \mathcal {I}_\alpha [f]=\sum _{j\in \mathbb {Z}_n^+}\mathcal {I}_{\alpha _j,\beta _j}[f_j], \end{aligned}$$
(4.4)

where for \(j\in \mathbb {Z}_n^+\),

$$\begin{aligned} \alpha _j&:=\alpha h_j/2, \end{aligned}$$
(4.5)
$$\begin{aligned} \beta _j&:=-(x_{j-1}+x_j)/h_j, \end{aligned}$$
(4.6)

and

$$\begin{aligned} f_j(x):=\frac{h_j}{2}f\left( \frac{h_j}{2}x+\frac{x_{j-1}+x_j}{2}\right) , ~~ \text {for}~ x\in \hat{I}. \end{aligned}$$
(4.7)

Computing the integral (2.2) is then reduced to calculate the integrals \(\mathcal {I}_{\alpha _j,\beta _j}[f_j]\) for \(j\in \mathbb {Z}_n^+\) in (4.4), which have the form of (3.1). Approximate values of these integrals will be computed by using formula (3.2).

We now develop two composite quadrature formulas for computing the integral (4.4) by using the quadrature formula (3.2) to calculate the integrals \(\mathcal {I}_{\alpha _j,\beta _j}[f_j]\) for \(j\in \mathbb {Z}_n^+\). In the first method, we use the same number of quadrature nodes in all of the subintervals. Selecting a fixed positive integer m, we use \(\mathcal {Q}^{\alpha _j,\beta _j}_m[f_j]\) as defined in (3.2) to approximate the integral \(\mathcal {I}_{\alpha _j,\beta _j}[f_j]\) for \(j\in \mathbb {Z}_n^+\). The integral (4.4) is then approximated by

$$\begin{aligned} \mathcal {Q}^{\alpha }_{n,m}[f]:=\sum _{j\in \mathbb {Z}_{n}^+}\mathcal {Q}^{\alpha _j,\beta _j}_m[f_j]. \end{aligned}$$
(4.8)

We next analyze the accuracy order of the quadrature formula (4.8). To this end, in the following lemma we estimate the error

$$\begin{aligned} \mathcal {E}^{\alpha _j,\beta _j}_{m}[f_j]:=\left| \mathcal {I}_{\alpha _j,\beta _j}[f_j]-\mathcal {Q}^{\alpha _j,\beta _j}_{m}[f_j]\right| , \ \ j\in \mathbb {Z}_n^+. \end{aligned}$$

Lemma 4.1

If \(f\in C^{m+1}(I)\) and \(\alpha >1\), then for \(j\in \mathbb {Z}_n^+\)

$$\begin{aligned} \mathcal {E}^{\alpha _j,\beta _j}_{m}[f_j]\le \dfrac{\sqrt{\pi }h_j^{m+1}}{2^{2m+1}(m+1)!\alpha }\left\| f^{(m+1)}\right\| _{\infty }. \end{aligned}$$

Proof

We prove this lemma by applying Lemma 3.1 to integral \(\mathcal {I}_{\alpha _j,\beta _j}[f_j]\). According to the definition (4.5) of \(\alpha _j\), we have for \(j\in \mathbb {Z}_n^+\) that

$$\begin{aligned} \mathcal {E}^{\alpha _j,\beta _j}_{m}[f_j]\le \dfrac{\sqrt{\pi }}{2^{m}(m+1)!\alpha _j}\left\| f_j^{(m+1)}\right\| _{\infty } \le \dfrac{\sqrt{\pi }}{2^{m-1}(m+1)!\alpha h_j}\left\| f_j^{(m+1)}\right\| _{\infty }. \end{aligned}$$

By the chain rule, we obtain for \(x\in \hat{I}\) that

$$\begin{aligned} f_j^{(m+1)}(x)=\left( \dfrac{h_j}{2}\right) ^{m+2}f^{(m+1)}\left( \frac{h_j}{2}x+\frac{x_{j-1}+x_j}{2}\right) , \end{aligned}$$

where \(f_j\) is defined by (4.7). This together with the inequality above yields the desired estimate. \(\square \)

We are now ready to provide the error estimate for the quadrature formula (4.8). For m, \(n\in \mathbb {N}\) with \(n>1\), we define

$$\begin{aligned} \mathcal {E}^{\alpha }_{n,m}[f]:=\left| \mathcal {I}_{\alpha }[f]-\mathcal {Q}^{\alpha }_{n,m}[f]\right| , \end{aligned}$$

and denote by \(\mathcal {N}(\mathcal {Q}^{\alpha }_{n,m}[f])\) the number of the quadrature nodes used in \(\mathcal {Q}^{\alpha }_{n,m}[f]\).

Theorem 4.2

For \(\alpha >1\) and \(n\in \mathbb {N}\) with \(n>1\), let \(\eta :=\max \left\{ 1/\alpha ,1-\alpha ^{-1/(n-1)}\right\} \). If \(f\in C^{m+1}(I)\) for some \(m\in \mathbb {N}\), then

$$\begin{aligned} \mathcal {E}^{\alpha }_{n,m}[f]\le \dfrac{\sqrt{\pi }\eta ^{m}}{2^{2m+1}(m+1)!\alpha }\left\| f^{(m+1)}\right\| _{\infty }, \end{aligned}$$

and

$$\begin{aligned} \mathcal {N}\left( \mathcal {Q}^{\alpha }_{n,m}[f]\right) =(m+1)n. \end{aligned}$$

Proof

The proof of this theorem is done by applying Lemma 4.1 on each of the subintervals. This leads to the estimate that for \(j\in \mathbb {Z}_n^+\)

$$\begin{aligned} \mathcal {E}^{\alpha _j,\beta _j}_{m}[f_j]\le \dfrac{\sqrt{\pi }h_j^{m+1}}{2^{2m+1}(m+1)!\alpha }\left\| f^{(m+1)}\right\| _{\infty }. \end{aligned}$$
(4.9)

Note that \(h_1=x_1-x_0=1/\alpha \le \eta ,\) and for \(j\in \mathbb {Z}_n^+\) with \(j>1\),

$$\begin{aligned} h_j=x_j-x_{j-1}=x_j\left( 1-\alpha ^{-1/(n-1)}\right) \le x_j\eta \le \eta . \end{aligned}$$

Substituting these bounds into the right-hand side of (4.9) and summing the resulting inequalities over \(j\in \mathbb {Z}_n^+\), we obtain the desired estimate for \(\mathcal {E}^{\alpha }_{n,m}[f]\).

It remains to estimate the number of the quadrature nodes used in the quadrature formula. According to the quadrature formula (4.8), we have that

$$\begin{aligned} \mathcal {N}\left( \mathcal {Q}^{\alpha }_{n,m}[f]\right) =\sum _{j\in \mathbb {Z}_n^+}(m+1) = (m+1)n, \end{aligned}$$

proving the desired result. \(\square \)

We remark on the parameter \(\eta \) that appears in Theorem 4.2. When n is sufficiently large, for a fixed \(\alpha \), the number \(\alpha ^{-\frac{1}{n-1}}\) is close to 1 and thus, \(1-\alpha ^{-\frac{1}{n-1}}\le \frac{1}{\alpha }\). Hence \(\eta =\frac{1}{\alpha }\). Theorem 4.2 then ensures that when n is sufficiently large, the accuracy order of the quadrature formula (4.8) is \({\mathcal O}(1/\alpha ^{m+1})\).

We next develop the second method to approximate the integral (2.2) for f having smoothness of the infinite order. This method uses the same graded-mesh (4.3) for the interval I but variable numbers of quadrature points in the subintervals. The numbers of the quadrature nodes used in each of the subintervals are chosen to obtain the exponential order of accuracy for the resulting quadrature formulas. Specifically, for \(n\in \mathbb {N}\) with \(n>1\) and for the partition of I chosen as (4.3), we let

$$\begin{aligned} m_j:=\left\lceil \frac{n(n-1)}{n+1-j}\right\rceil , ~~\text {for} ~~j\in \mathbb {Z}_{n}^+, \end{aligned}$$
(4.10)

where \(\lceil a\rceil \) denotes the smallest integer not less than a. For each \(j\in \mathbb {Z}^{+}_{n}\), we use \(\mathcal {Q}^{\alpha _j,\beta _j}_{m_j}[f]\) to approximate \(\mathcal {I}_{\alpha _j,\beta _j}[f_j]\). Integral \(\mathcal {I}_\alpha [f]\) defined by (4.4) is then approximated by the quadrature formula

$$\begin{aligned} \mathcal {Q}^{\alpha }_{n}[f]:=\sum _{j\in \mathbb {Z}_n^+}\mathcal {Q}^{\alpha _j,\beta _j}_{m_j}[f_j]. \end{aligned}$$
(4.11)

We next estimate the error

$$\begin{aligned} \mathcal {E}^{\alpha }_{n}[f]:=\left| \mathcal {I}_\alpha [f]-\mathcal {Q}^{\alpha }_{n}[f]\right| \end{aligned}$$

of the quadrature formula \(\mathcal {Q}^{\alpha }_{n}[f]\) defined by (4.11). To this end, we recall the inequality

$$\begin{aligned} n!\ge \sqrt{2\pi n}\left( n/\mathrm{e}\right) ^n, \ \ \text{ for }\ \ n\in \mathbb {N}, \end{aligned}$$
(4.12)

which is obtained from the Stirling formula [1], and establish the following technical lemma.

Lemma 4.3

There exists a positive constant c such that for all \(\alpha >1\), for all \(n\in \mathbb {N}\) satisfying

$$\begin{aligned} (n-1)(\ln {(n+1+\mathrm{e})}-1)\ge \ln {\alpha }, \end{aligned}$$
(4.13)

and for all \(j\in \mathbb {Z}_n^+\) with \(j>1\), the inequality holds

$$\begin{aligned} \frac{\left( \alpha ^{1/(n-1)}-1\right) ^{m_j+1}}{(m_j+1)!}\le c(n+1)^{-1/2}. \end{aligned}$$
(4.14)

Proof

Since \(\alpha >1\), condition (4.13) implies that \(n>1\). By inequality (4.12), there exists a positive constant c such that for all \(n\in \mathbb {N}\) with \(n>1\) and \(j\in \mathbb {Z}_n^+\) with \(j>1\),

$$\begin{aligned} \frac{1}{(m_j+1)!}\le c (m_j+1)^{-1/2}\left( \frac{\mathrm{e}}{m_j+1}\right) ^{m_j+1}. \end{aligned}$$

By definition (4.10) of \(m_j\), we see that \(m_j+1\ge n+1\) for \(j>1\). Using this result in the right-hand side of the above inequality yields

$$\begin{aligned} \frac{1}{(m_j+1)!}\le c (n+1)^{-1/2} \left( \frac{\mathrm{e}}{n+1}\right) ^{m_j+1}. \end{aligned}$$
(4.15)

Multiplying both sides of inequality (4.15) by \((\alpha ^{1/(n-1)}-1)^{m_j+1}\), we obtain that

$$\begin{aligned} \frac{\left( \alpha ^{1/(n-1)}-1\right) ^{m_j+1}}{(m_j+1)!} \le c(n+1)^{-1/2}\left( \frac{\mathrm{e}\left( \alpha ^{1/(n-1)}-1\right) }{n+1}\right) ^{m_j+1}. \end{aligned}$$
(4.16)

Moreover, condition (4.13) is equivalent to that

$$\begin{aligned} \frac{\mathrm{e}\left( \alpha ^{1/(n-1)}-1\right) }{n+1}\le 1. \end{aligned}$$

Using this inequality in the right-hand side of (4.16), we find that there exists a positive constant c such that for all \(\alpha >1\), \(n\in \mathbb {N}\) satisfying (4.13) and \(j\in \mathbb {Z}_n^+\) with \(j>1\), the desired estimate (4.14) holds. \(\square \)

We are now ready to establish the estimate for \(\mathcal {E}^{\alpha }_{n}[f]\). For a function \(\phi \in C^{\infty }(\Omega )\), we define

$$\begin{aligned} \left\| \phi \right\| _{n}:=\max \left\{ \left\| \phi ^{(j)}\right\| _\infty : j\in \mathbb {Z}_n\right\} ~\text {for} ~ n\in \mathbb {N}. \end{aligned}$$

Theorem 4.4

If \(f\in C^{\infty }(I)\), then there exists a positive constant c such that for all \(\alpha > 1\) and \(n\in \mathbb {N}\) satisfying (4.13),

$$\begin{aligned} \mathcal {E}^{\alpha }_{n}[f]\le c (n+1)^{-1/2}(2\alpha )^{-n-1}\left\| f\right\| _{(n-1)n+1}. \end{aligned}$$

For \(n\in \mathbb {N}\) with \(n>1\), there holds the estimate

$$\begin{aligned} \mathcal {N}\left( \mathcal {Q}^{\alpha }_{n}[f]\right) \le n(n-1)\ln {n}+n^2+n. \end{aligned}$$

Proof

We establish the error bound of this theorem by estimating the errors

$$\begin{aligned} \mathcal {E}^{\alpha _j,\beta _j}_{m_j}[f_j]:=\left| \mathcal {I}_{\alpha _j,\beta _j}[f_j]-\mathcal {Q}^{\alpha _j,\beta _j}_{m_j}[f_j]\right| \end{aligned}$$

for \(j\in \mathbb {Z}_{n}^+\), and then summing them over j. Applying Lemma 4.1 with \(m:=m_1\), we have that for \(j=1\)

$$\begin{aligned} \mathcal {E}^{\alpha _1,\beta _1}_{m_1}[f_1]\le \dfrac{\sqrt{\pi } \alpha ^{-n-1}}{n!2^{2n-1}}\left\| f^{(n)}\right\| _{\infty }. \end{aligned}$$

For \(j>1\), by applying Lemma 4.1 with

$$\begin{aligned} m:=m_j\quad \text{ and }\quad h_j:=\alpha ^{\frac{j-n-1}{n-1}}\left( \alpha ^{1/(n-1)}-1\right) , \end{aligned}$$

we obtain that

$$\begin{aligned} \mathcal {E}^{\alpha _j,\beta _j}_{m_j}[f_j]\le \dfrac{\sqrt{\pi }}{2^{2m_j+1}} \dfrac{\left( \alpha ^{1/(n-1)}-1\right) ^{m_j+1}}{(m_j+1)!}\alpha ^{\frac{j-n-1}{n-1}(m_j+1)-1} \left\| f^{(m_j+1)}\right\| _{\infty }. \end{aligned}$$
(4.17)

Applying the estimate in Lemma 4.3 to the right hand side of (4.17) yields that there exists a positive constant c such that for all \(\alpha >1\), for \(n\in \mathbb {N}\) satisfying (4.13), and for \(j\in \mathbb {Z}_{n}^+\) with \(j>1\),

$$\begin{aligned} \mathcal {E}^{\alpha _j,\beta _j}_{m_j}[f_j]\le c\dfrac{(n+1)^{-1/2}}{2^{2m_j+1}}\alpha ^{\frac{j-n-1}{n-1}(m_j+1)-1}\left\| f^{(m_j+1)}\right\| _{\infty }. \end{aligned}$$
(4.18)

Note that for \(j\in \mathbb {Z}_{n}^+\) with \(j>1\),

$$\begin{aligned} \dfrac{j-n-1}{n-1}(m_j+1)-1\le \dfrac{j-n-1}{n-1}\dfrac{n(n-1)}{n+1-j}-1=-n-1. \end{aligned}$$

Substituting this result into the right hand side of inequality (4.18), we obtain the estimate

$$\begin{aligned} \mathcal {E}^{\alpha _j,\beta _j}_{m_j}[f_j]\le c\dfrac{(n+1)^{-1/2}}{2^{2m_j+1}}\alpha ^{-n-1}\left\| f^{(m_j+1)}\right\| _{\infty }. \end{aligned}$$

Summing up the both sides of the above inequalities over \(j\in \mathbb {Z}_{n}^+\), we observe that there exists a positive constant c such that for all \(\alpha > 1\) and \(n\in \mathbb {N}\) satisfying (4.13)

$$\begin{aligned} \mathcal {E}^{\alpha }_{n}[f]\le & {} \dfrac{\sqrt{\pi }}{n!2^{2n-1}}\alpha ^{-n-1}\left\| f^{(n)}\right\| _{\infty }+c\alpha ^{-n-1} \left\{ \sum _{j=2}^{n}\dfrac{(n+1)^{-{1}/{2}}}{2^{2m_j+1}}\right\} \left\| f\right\| _{(n-1)n+1}\\\le & {} \dfrac{\sqrt{\pi }}{n!2^{2n-1}}\alpha ^{-n-1}\left\| f^{(n)}\right\| _{\infty }+\dfrac{cn}{2^{2n-1}} \alpha ^{-n-1}(n+1)^{-{1}/{2}}\left\| f\right\| _{(n-1)n+1}\\\le & {} \dfrac{4cn}{2^{n}} (2\alpha )^{-n-1}(n+1)^{-{1}/{2}}\left\| f\right\| _{(n-1)n+1} . \end{aligned}$$

Note that \(n/2^{n}<1\) for all \(n\in \mathbb {N}\). Using this in the last step of the above inequality leads to the first desired estimate.

It remains to estimate the number \(\mathcal {N}\left( \mathcal {Q}^{\alpha }_{n}[f]\right) \) of the quadrature nodes used in the quadrature formula (4.11). To this end, we note that

$$\begin{aligned} \mathcal {N}\left( \mathcal {Q}^{\alpha }_{n}[f]\right) \le \sum _{j\in \mathbb {Z}_n^+}\left\{ \left( \frac{n(n-1)}{n+1-j}+1\right) +1\right\} \le 2n+n(n-1) \sum _{j\in \mathbb {Z}_n^+}\frac{1}{n+1-j}. \end{aligned}$$

For \(n\in \mathbb {N}\), by using the following inequality in the above estimate

$$\begin{aligned} \sum _{j\in \mathbb {Z}_n^+}\frac{1}{j}\le \ln {n}+1, \end{aligned}$$

we have that

$$\begin{aligned} \mathcal {N}\left( \mathcal {Q}^{\alpha }_{n}[f]\right) \le 2n+n(n-1)(\ln {n}+1) = n(n-1)\ln {n}+n^2+n, \end{aligned}$$

which completes the proof. \(\square \)

From Theorems 4.2 and 4.4, we see that the quadrature formula (4.8) has accuracy of a polynomial order (in terms of \(\alpha \)) and the quadrature formula (4.11) achieves accuracy of an exponential order (in terms of \(\alpha \)). The number of the quadrature nodes used in the quadrature formula (4.8) is linear in n and the number of the quadrature nodes used in the quadrature formula (4.11) is quadratic in n. Moreover, these numbers for both quadrature formulas are independent of \(\alpha \). Specifically, the number of quadrature nodes used in \(\mathcal {Q}^{\alpha }_{n,m}[f]\) is \((m+1)n\) for m and that in \(\mathcal {Q}^{\alpha }_{n}[f]\) is \(n+\sum _{j\in \mathbb {Z}_n^+}m_j\), where \(m_j\) for \(j\in \mathbb {Z}_n^+\) are defined by (4.10).

5 Computation of the Moments

In this section, we propose a method to compute the exact values of the moments \(w_{\alpha ,\beta ,k}\), for \(k\in \mathbb {Z}_{m}\), defined as in (3.3). For this purpose, we first re-express the moments in terms of integrals involved \(G_\alpha \). We then provide a method to calculate these integrals exactly.

We begin with considering the representation of the moments \(w_{\alpha ,\beta ,k}\). To this end, we let \(k\in \mathbb {N}_0\) and for \(j\in \mathbb {Z}_k\), \(\alpha >0\) and \(b>0\), we define

$$\begin{aligned} \mathcal {M}_j[\alpha ,b]:=\int _0^bx^j\mathrm{e}^{-\alpha ^2x^2}\mathrm{d}x, \end{aligned}$$
(5.1)

and recall the binomial coefficients

$$\begin{aligned} C_k^j:=\dfrac{k!}{j!(k-j)!}. \end{aligned}$$

Proposition 5.1

Let \(k\in \mathbb {N}_0\). If \(\alpha >0\) and \(\beta \le 0\), then

$$\begin{aligned} w_{\alpha ,\beta ,k}= & {} \sum _{j\in \mathbb {Z}_k}C_k^j\beta ^{k-j}\left( \mathcal {M}_j[\alpha ,1-\beta ]+(-1)^{2k-j}\mathcal {M}_j[\alpha ,1+\beta ]\right) ~\text {for}~\beta >-\,1,\\ w_{\alpha ,\beta ,k}= & {} \sum _{j\in \mathbb {Z}_k}C_k^j\beta ^{k-j} \left( \mathcal {M}_j[\alpha ,1-\beta ]-\mathcal {M}_j[\alpha ,\left| 1+\beta \right| ]\right) ~\text {for}~\beta \le -\,1. \end{aligned}$$

Proof

We first derive forms of \(w_{\alpha ,\beta ,k}\) for different values of \(\beta \). By a change of variables \(x-\beta \mapsto x\) in (3.3), we obtain that

$$\begin{aligned} w_{\alpha ,\beta ,k}= & {} \int _{-1}^1x^ke^{-\alpha ^2(x-\beta )^2}\mathrm{d}x\nonumber \\= & {} \int _0^{1-\beta }(x+\beta )^k\mathrm{e}^{-\alpha ^2x^2}\mathrm{d}x +\int ^0_{-1-\beta }(x+\beta )^k\mathrm{e}^{-\alpha ^2x^2}\mathrm{d}x. \end{aligned}$$
(5.2)

For \(-1<\beta \le 0\), we make a change of variables \(x\mapsto -x\) in the second term of the right hand side of Eq. (5.2), which yields that

$$\begin{aligned} w_{\alpha ,\beta ,k}= & {} \int _0^{1-\beta }(x+\beta )^k\mathrm{e}^{-\alpha ^2x^2}\mathrm{d}x+ (-1)^k\int _0^{1+\beta }(x-\beta )^k\mathrm{e}^{-\alpha ^2x^2}\mathrm{d}x. \end{aligned}$$
(5.3)

For \(\beta \le -1\), from formula (5.2) we have that

$$\begin{aligned} w_{\alpha ,\beta ,k}= & {} \int _0^{1-\beta }(x+\beta )^k\mathrm{e}^{-\alpha ^2x^2}\mathrm{d}x- \int _0^{\left| 1+\beta \right| }(x+\beta )^k\mathrm{e}^{-\alpha ^2x^2}\mathrm{d}x. \end{aligned}$$
(5.4)

Applying the binomial formula to \((x+\beta )^k\), \((x-\beta )^k\) in (5.3) and \((x+\beta )^k\) in (5.4), we attain the assertions of this proposition. \(\square \)

We next describe a method to compute \(\mathcal {M}_k[\alpha ,b]\) defined as in (5.1) for \(k\in \mathbb {N}_0\), \(\alpha >0\) and \(b>0\). We first show an auxiliary equality. To this end, we denote by \(\mathcal {D}_\alpha \) the differentiation operator with respect to \(\alpha \).

Lemma 5.2

If \(j\in \mathbb {N}_0\), then

$$\begin{aligned} \mathcal {D}_\alpha M_j[\sqrt{\alpha }, b]=- M_{j+2}[\sqrt{\alpha }, b]. \end{aligned}$$

Proof

Note that

$$\begin{aligned} \mathcal {M}_j[\sqrt{\alpha },b]=\int _0^bx^j\mathrm{e}^{-\alpha x^2}\mathrm{d}x, \end{aligned}$$
(5.5)

for \(j\in \mathbb {N}_0\). Differentiating \(\mathcal {M}_j[\sqrt{\alpha },b]\) with respect to \(\alpha \), we obtain that

$$\begin{aligned} \mathcal {D}_\alpha M_j[\sqrt{\alpha }, b]=-\int _0^bx^{j+2}\mathrm{e}^{-\alpha x^2}\mathrm{d}x. \end{aligned}$$

This together with (5.5) by replacing j with \(j+2\) yields the desired formula. \(\square \)

According to Lemma 5.2, the computation of \(\mathcal {M}_k[\alpha ,b]\) may be done by considering two separate cases when k is an even number and when k is an odd number. We shall use the Leibniz formula for the k-th derivative of the product of two functions for \(k\in \mathbb {N}\),

$$\begin{aligned} \left( \phi \psi \right) ^{(k)}=\sum _{j\in \mathbb {Z}_k} C_k^j\phi ^{(j)}\psi ^{(k-j)}. \end{aligned}$$
(5.6)

We first consider the case when k is an odd number.

Proposition 5.3

If \(k=2j+1\) for \(j\in \mathbb {N}_0\), then

$$\begin{aligned} \mathcal {M}_{k}[\alpha ,b]=\dfrac{j!}{2}\left( 1-\mathrm{e}^{-b^2\alpha ^2 }\right) \alpha ^{-2-2j}- \dfrac{j!}{2}\mathrm{e}^{- b^2\alpha ^2}\sum _{l\in \mathbb {Z}_j^+}{b^{2l}\alpha ^{-2-2j+2l}}/{l!}. \end{aligned}$$

Proof

We first derive the form of \(\mathcal {M}_{k}[\sqrt{\alpha },b]\) for \(k=2j+1\) with \(j\in \mathbb {N}_0\). Repeatedly using Lemma 5.2, we obtain that

$$\begin{aligned} \mathcal {M}_{k}[\sqrt{\alpha },b]=(-1)^j\mathcal {D}_\alpha ^j \mathcal {M}_{1}[\sqrt{\alpha },b]. \end{aligned}$$

We shall make use of the above formula by differentiating \(\mathcal {M}_1[\sqrt{\alpha },b]\) with respect to \(\alpha \). By a direct computation, we have that

$$\begin{aligned} \mathcal {M}_{1}[\sqrt{\alpha },b]= \left( 1-\mathrm{e}^{-b^2\alpha }\right) /(2\alpha ). \end{aligned}$$

Hence, we find that

$$\begin{aligned} \mathcal {M}_{k}[\sqrt{\alpha },b]=\frac{(-1)^{j}}{2}\mathcal {D}_\alpha ^{j}\left[ \left( 1-\mathrm{e}^{-b^2\alpha }\right) /\alpha \right] . \end{aligned}$$
(5.7)

Note that for \(l\in \mathbb {Z}_j^+\)\(\mathcal {D}_\alpha ^{l}(1-\mathrm{e}^{-b^2\alpha })=(-1)^{l-1}b^{2l}\mathrm{e}^{-b^2\alpha }\) and \(\mathcal {D}_\alpha ^{l}(1/\alpha )=(-1)^ll!\alpha ^{-l-1}.\) Applying the Leibniz formula (5.6) with these two derivative formulas, we obtain that

$$\begin{aligned} \mathcal {D}_\alpha ^{j}\left[ \left( 1-\mathrm{e}^{-b^2\alpha }\right) /{\alpha }\right]= & {} (-\,1)^jj!\left( 1-\mathrm{e}^{-b^2\alpha }\right) \alpha ^{-1-j}\\&+\,(-\,1)^{j-1}\mathrm{e}^{- b^2\alpha }\sum _{l\in \mathbb {Z}_j^+}C_j^l(j-l)!b^{2l}\alpha ^{-1-j+l}. \end{aligned}$$

Substituting this equality into (5.7) yields that

$$\begin{aligned} \mathcal {M}_{k}[\sqrt{\alpha },b]=\dfrac{j!}{2}\left( 1-\mathrm{e}^{-b^2\alpha }\right) \alpha ^{-1-j}- \dfrac{j!}{2}\mathrm{e}^{- b^2\alpha }\sum _{l\in \mathbb {Z}_j^+}\dfrac{b^{2l}\alpha ^{-1-j+l}}{l!}. \end{aligned}$$

In the above equation, we replace \(\sqrt{\alpha }\) by \(\alpha \) and obtain the desired result of this proposition. \(\square \)

We next consider the case when k is an even number. We shall use the notation of the error function [1] defined by

$$\begin{aligned} \mathrm{erf}(x):=\dfrac{2}{\sqrt{\pi }}\int _0^x\mathrm{e}^{-s^2}\mathrm{d}s,\quad \text {for}~x\in \mathbb {R}^+. \end{aligned}$$
(5.8)

For more information about the error function, see for instance [18, 29]. We shall use \(\Gamma \) to denote the Gamma function and recall that for a constant \(c\in (-\,1,1)\) and \(n\in \mathbb {N}\),

$$\begin{aligned} \frac{\Gamma (c+n)}{\Gamma (c)}=c(c+1)\ldots (c+n-1). \end{aligned}$$

In particular, for \(c=1/2\), we have that \(\Gamma (1/2)=\sqrt{\pi }.\)

Proposition 5.4

If \(k=2j\) for \(j\in \mathbb {N}_0\), then

$$\begin{aligned} \mathcal {M}_{k}[\alpha ,b]= & {} \dfrac{\Gamma \left( \frac{1}{2}+j\right) }{2}\mathrm{erf}(b\alpha )\alpha ^{-1-2j}\\&-\,\frac{1}{2\pi } \sum _{l\in \mathbb {Z}_j^+}\sum _{i\in \mathbb {Z}_{l-1}} \dfrac{j!\Gamma \left( l-i-\frac{1}{2}\right) \Gamma \left( \frac{1}{2}+j-l\right) b^{2i+1}}{(j-l)!(l-i-1)!i!l}\mathrm{e}^{-b^2\alpha ^2}\alpha ^{-2j+2i}. \end{aligned}$$

Proof

The proof of this result is similar to that of Proposition 5.3. We first derive the form of \(\mathcal {M}_{k}[\sqrt{\alpha },b]\) for \(k=2j\) with \(j\in \mathbb {N}_0\). According to Lemma 5.2, we have that

$$\begin{aligned} \mathcal {M}_{k}[\sqrt{\alpha },b]=(-1)^j\mathcal {D}_\alpha ^j \mathcal {M}_{0}[\sqrt{\alpha },b]. \end{aligned}$$

A direct computation leads to

$$\begin{aligned} \mathcal {M}_{0}[\sqrt{\alpha },b]=\int _0^b\mathrm{e}^{-\alpha x^2}\mathrm{d}x =\frac{\sqrt{\pi }}{2\sqrt{\alpha }}\mathrm{erf}(b\sqrt{\alpha }). \end{aligned}$$

Differentiating the equation above j times with respect to \(\alpha \) yields that

$$\begin{aligned} \mathcal {M}_{k}[\sqrt{\alpha },b]=\frac{(-1)^{j}\sqrt{\pi }}{2} \mathcal {D}_\alpha ^{j}\left[ \frac{\mathrm{erf}(b\sqrt{\alpha })}{\sqrt{\alpha }}\right] . \end{aligned}$$
(5.9)

Using definition (5.8), we have that

$$\begin{aligned} \mathcal {D}_\alpha \left[ \mathrm{erf}(b\sqrt{\alpha })\right] =\frac{b}{\sqrt{\pi }}\frac{\mathrm{e}^{-b^2\alpha }}{\sqrt{\alpha }}. \end{aligned}$$
(5.10)

Note that

$$\begin{aligned} \mathcal {D}_\alpha ^{l}\left( \alpha ^{-\frac{1}{2}}\right) =(-1)^l\dfrac{\Gamma \left( \frac{1}{2}+l\right) }{\Gamma \left( \frac{1}{2}\right) }\alpha ^{-\frac{1}{2}-l}, \quad \text {for}\quad l\in \mathbb {Z}_j. \end{aligned}$$
(5.11)

Using formula (5.10) with the Leibniz formula (5.6) and the equation above yields that for \(l\in \mathbb {Z}_j^+\)

$$\begin{aligned} \mathcal {D}_\alpha ^{l}\left( \mathrm{erf}(b\sqrt{\alpha })\right) =\dfrac{(-1)^{l-1}}{\sqrt{\pi }} \sum _{i\in \mathbb {Z}_{l-1}}C_{l-1}^i\dfrac{\Gamma \left( l-i-\frac{1}{2}\right) b^{2i+1}}{\Gamma \left( \frac{1}{2}\right) }\mathrm{e}^{-b^2\alpha }\alpha ^{\frac{1}{2}-l+i}. \end{aligned}$$

Applying the Leibniz formula (5.6) with the equation above and (5.11), we obtain that

$$\begin{aligned} \mathcal {D}_\alpha ^{j}\left[ \frac{\mathrm{erf}(b\sqrt{\alpha })}{\sqrt{\alpha }}\right]\!=\! & {} \dfrac{\Gamma \left( \frac{1}{2}+j\right) }{\Gamma \left( \frac{1}{2}\right) }(-1)^j\mathrm{erf}(b\sqrt{\alpha })\alpha ^{-\frac{1}{2}-j}\\&+\,\!\frac{(-1)^{j-1}}{\sqrt{\pi }} \sum _{l\in \mathbb {Z}_j^+}\sum _{i\in \mathbb {Z}_{l-1}} \dfrac{j!\Gamma \left( l-i-\frac{1}{2}\right) \Gamma \left( \frac{1}{2}+j-l\right) b^{2i+1}}{(j-l)!(l-i-1)!i!l\left( \Gamma \left( \frac{1}{2}\right) \right) ^2}\mathrm{e}^{-b^2\alpha }\alpha ^{-j+i}. \end{aligned}$$

Substituting the equation above and \(\Gamma (\frac{1}{2})=\sqrt{\pi }\) into (5.9) gives that

$$\begin{aligned} \mathcal {M}_{k}[\sqrt{\alpha },b]= & {} \dfrac{\Gamma \left( \frac{1}{2}+j\right) }{2}\mathrm{erf}(b\sqrt{\alpha })\alpha ^{-\frac{1}{2}-j}\\&-\,\dfrac{1}{2\pi } \sum _{l\in \mathbb {Z}_j^+}\sum _{i\in \mathbb {Z}_{l-1}} \dfrac{j!\Gamma \left( l-i-\frac{1}{2}\right) \Gamma \left( \frac{1}{2}+j-l\right) b^{2i+1}}{(j-l)!(l-i-1)!i!l}\mathrm{e}^{-b^2\alpha }\alpha ^{-j+i}. \end{aligned}$$

In the equation above replacing \(\sqrt{\alpha }\) by \(\alpha \), we obtain the desired result of this proposition. \(\square \)

Combining formulas in Propositions 5.15.3 and 5.4 provides a method to compute the exact values of the moments \(w_{\alpha ,\beta ,k}\).

6 Numerical Experiments

In this section, we carry out five numerical experiments to confirm the accuracy estimates, established in Sect. 4, of the two quadrature formulas for (2.2). Specifically, we verify the relative errors (RE) and the accuracy orders (Order) of these formulas.

The numerical results presented below were all obtained by using Matlab in a modest desktop (a Core 2 Quad with 4GB of Ram memory). The error function (5.8) was computed by using erf of Matlab. Numerical methods for calculating the error function may be found in [6, 7, 28].

We present in the first example the numerical results of the quadrature formula (4.8) which we denote by QuadP. The numerical accuracy order of QuadP is computed by using the formula

$$\begin{aligned} \mathrm{Order}:=-\ln \left( \mathcal {E}_{n,m}^\alpha [f]\right) /\ln (\alpha ),~\text {for}~\alpha >1, \end{aligned}$$

for m, \(n\in \mathbb {N}\) with \(n>1\).

Example 6.1

This example is to verify the accuracy of the quadrature formula \(\mathcal {Q}^{\alpha }_{n,m}[f]\) defined as in (4.8). We consider the function \(f(x):=x^2\) for \(x\in I\). The exact value of the corresponding integral is

$$\begin{aligned} \mathcal {I}_\alpha [f]=\left( \sqrt{\pi }\mathrm{erf}(\alpha )/2-\alpha \mathrm{e}^{-\alpha ^2}\right) /(2\alpha ^3). \end{aligned}$$
Table 1 Relative errors and accuracy orders of QuadP for \(f(x):=x^2\)
Fig. 6
figure 6

Relative errors of the approximation to the values of the integrals with \(f(x):=x^2\). a Fixed \(\alpha \) (\(c_0=1.14\hbox {e}-2\)), b fixed n

We list in Table 1 the relative errors and the numerical accuracy orders of \(\mathcal {Q}^{\alpha }_{n,4}[f]\) for different values of \(\alpha \) and different choices of n. The relative errors of the quadrature formula \(\mathcal {Q}^{\alpha }_{n,4}[f]\) are depicted in Fig. 6a for fixed \(\alpha =50\) with n changing from 2 to 100 and in Fig. 6b for fixed \(n=20\) with \(\alpha \) changing from 10 to 500. Table 1 confirms the accuracy of the quadrature formula \(\mathcal {Q}^{\alpha }_{n,4}[f]\), since the accuracy orders of \(\mathcal {Q}^{\alpha }_{n,4}[f]\) are higher than the asymptotic order of the values of the integrals decaying to zero, which is \(\mathcal {O}(\alpha ^{-3})\) as \(\alpha \) tends to infinity. From Fig. 6, we observe that for a fixed \(\alpha \) the relative errors of the quadrature formula change modestly as n grows and for a fixed n they also change modestly as \(\alpha \) grows. This demonstrates that the quadrature formula (4.8) has accuracy of a high order.

In Table 2, we compare the relative errors of the formula \(\mathcal {Q}^{\alpha }_{n,2}[f]\) (Graded Mesh) with that of the standard composite formula (Uniform). The standard composite formula is constructed by subdividing the integration interval into n equal subintervals and using the Simpson rule to calculate the integrals on each of the resulting subintervals. We conclude that the accuracy order of \(\mathcal {Q}^{\alpha }_{n,2}[f]\) is much higher than the composite Simpson formula with a uniform partition.

Table 2 Relative errors of QuadP for \(f(x):=x^2\) with different partitions

We show in the next example the numerical results of the quadrature formula (4.11) which we denote by QuadE. As in the first example, we compute the numerical convergence order of QuadE by using the formula

$$\begin{aligned} \mathrm{Order}:=-\ln \left( \mathcal {E}_{n}^\alpha [f]\right) /\ln (2\alpha ),~\text {for}~\alpha >1, \end{aligned}$$

for \(n\in \mathbb {N}\) with \(n>1\).

Example 6.2

We verify in this example the theoretical accuracy estimate presented in Theorem 4.4 for the quadrature formula \(\mathcal {Q}^{\alpha }_{n}[f]\) defined by (4.11). We consider the function \(f(x):=\exp \left\{ -x^2\right\} \) for \(x\in I\). The exact value of the corresponding integral is

$$\begin{aligned} \mathcal {I}_\alpha [f]=\sqrt{\pi }\mathrm{erf}\left( \sqrt{\alpha ^2+1}\right) \big /\left( 2\sqrt{\alpha ^2+1}\right) . \end{aligned}$$
(6.1)
Table 3 Relative errors and accuracy orders of QuadE for \(f(x):=\exp \left\{ -x^2\right\} \)

Numerical results of this example are reported in Tables 3 and 4 and Fig. 7. Relative errors and accuracy orders of \(\mathcal {Q}^{\alpha }_{n}[f]\) for different values of \(\alpha \) and choices of \(n=3,4,5\) are listed in Table 3. We plot the relative errors of \(\mathcal {Q}^{\alpha }_{n}[f]\) for fixed \(\alpha =600\) in Fig. 7a with n ranging from 4 to 12. The absolute errors (AE) of \(\mathcal {Q}^{\alpha }_{n}[f]\) multiplied by \((2\alpha )^{n+1}\) are depicted in Fig. 7b for \(n=4\), where we choose \(\alpha \) ranging from 300 to 400. From Table 3 and Fig. 7a, we observe that for a fixed \(\alpha \), the accuracy of the quadrature formula improves as n grows and for a fixed n, it also improves as \(\alpha \) grows. From Fig. 7b we see that the asymptotic order of accuracy of \(\mathcal {Q}^{\alpha }_{n}[f]\) is \(\mathcal {O}((2\alpha )^{-5})\) for \(n=4\), which concurs with the theoretical estimate given in Theorem 4.4. In Table 4, we compare the RE of the formula \(\mathcal {Q}^{\alpha }_{n}[f]\) (Graded Mesh) with that of the composite Simpson formulas (Uniform) having n uniform subintervals. We see that the RE of \(\mathcal {Q}^{\alpha }_{n}[f]\) is much smaller (with fewer quadrature nodes) than that of the composite Simpson rule. The formulas defined by (4.11) enhance the approximation accuracy and as well as reduce the computational complexity.

Table 4 Relative errors of QuadE for \(f(x):=\exp \left\{ -x^2\right\} \) with different partitions
Fig. 7
figure 7

Relative errors of \(\mathcal {Q}^{\alpha }_{n}[f]\) with fixed \(\alpha \) and \(\mathcal {E}^{\alpha }_{4}[f]\) scaled by \(\alpha ^5\) for \(f(x):=\exp \left\{ -x^2\right\} \). a RE for fixed \(\alpha \), b\((2\alpha )^5\mathcal {E}^{\alpha }_{4}[f]\)

In the next two examples we test the accuracy of the quadrature formulas (4.8) and (4.11) for functions of less smoothness.

Example 6.3

We consider in this example the function

$$\begin{aligned} f(x):= {\left\{ \begin{array}{ll} 1,&{}\quad \text {for}~x\in [0, 1/2],\\ 1/2, &{}\quad \text {for}~x\in (1/2,1]. \end{array}\right. } \end{aligned}$$
(6.2)

The exact value of the corresponding integral is

$$\begin{aligned} \mathcal {I}_\alpha [f]=\sqrt{\pi }\left( \mathrm{erf}(\alpha )+\mathrm{erf}(\alpha /2)\right) /(4\alpha ). \end{aligned}$$

We list in Table 5 relative errors and accuracy orders of the quadrature formula \(\mathcal {Q}^{\alpha }_{n,4}[f]\), and in Table 6 those of the quadrature formula \(\mathcal {Q}^{\alpha }_{n}[f]\). According to the results reported in Tables 5 and 6, we confirm that the quadrature formulas proposed in this paper are highly accurate for the integrals defined as in (2.2), which is a piecewise continuous function, even though the standard deviation is very small.

Table 5 Relative errors and accuracy orders of QuadP for the function (6.2)
Table 6 Relative errors and accuracy orders of QuadE for the function (6.2)

Example 6.4

We consider in this example the function \(f(x):=x^{5/2}\) for \(x\in I\). The “true” values of the integral is evaluated by using the Matlab symbolic toolbox. Note that the function f is less smooth, with a singular third order derivative.

Numerical results of this example are presented in Tables 7, 8 and 9. In Table 7, we compare relative errors of the formula \(\mathcal {Q}^{\alpha }_{n,2}[f]\) with those of the standard composite Simpson’s formula for different n and \(\alpha \). We list in Table 8 relative errors and accuracy orders of the quadrature formula \(\mathcal {Q}^{\alpha }_{n,m}[f]\) for \(m=1, 4\), and in Table 9 those of the quadrature formula \(\mathcal {Q}^{\alpha }_{n}[f]\). From Table 7 we find that the formula \(\mathcal {Q}^{\alpha }_{n,2}[f]\) produces much more accurate results than the standard composite Simpson’s formula, when the same number of quadrature nodes are used in these two quadrature formulas. From Tables 7 and 8, we observe that the accuracy of the formula \(\mathcal {Q}^{\alpha }_{n,1}[f]\) is higher than that of the standard composite Simpson’s formula, and the asymptotic order of accuracy for \(\mathcal {Q}^{\alpha }_{n,1}[f]\) is higher than 3, which concurs with the theoretical estimate given in Theorem 4.2. The accuracy of the formula \(\mathcal {Q}^{\alpha }_{n,m}[f]\) improves as the number of the quadrature nodes increases. We conclude from Table 9 that the formula \(\mathcal {Q}^{\alpha }_{n}[f]\) is accurate for the less smooth function whose third order derivative has a singularity.

Table 7 Relative errors of QuadP for the function \(f(x):=x^{5/2}\) with \(m=2\)
Table 8 Relative errors and accuracy orders of QuadP for the function \(f(x):=x^{5/2}\) with \(m=1,4\)
Table 9 Relative errors of QuadE for the function \(f(x):=x^{5/2}\)

In the last example, we compare the performance of the proposed quadrature formulas with that of the treatment described in [20], where we first identified the computational challenge of computing integrals involved the Gaussian function with a small standard deviation. To this end, we recall the numerical treatment described in [20], where we treated integrals of this type as a weakly singular integral and employed the computational strategy proposed in [16]. Let \(\varepsilon >0\) be a given fixed number and n be a positive integer. Choosing \(\gamma \in (0,1)\), we introduce a partition of I with the nodes \(s_0:=0\) and \(s_j:=\gamma ^{n-j}\), for \(j\in \mathbb {Z}_{n}^+\). Let \(m_j:=\lfloor (j-1)\varepsilon \rfloor +1, ~ \text {for }~j\in \mathbb {Z}_{n}^+\), where \(\lfloor a\rfloor \) is the largest integer less than or equal to a. The quadrature formula for computing \(\mathcal {I}_\alpha [f]\) is designed by using the Gauss–Legendre quadrature with \(m_j\) nodes to approximate the integrals on the subinterval \([s_{j-1},s_{j}]\) for \(j\in \mathbb {Z}_{n}^+\). We denote this formula by \(\mathcal {P}_{n,\alpha }^{\gamma ,\varepsilon }[f]\).

Example 6.5

In this example, we compare accuracy of the quadrature formula \(\mathcal {Q}^{\alpha }_{n}[f]\) defined by (4.11) with that of \(\mathcal {P}_{n,\alpha }^{\gamma ,\varepsilon }[f]\) described above. We consider two functions

$$\begin{aligned} f_1(x):=x^{7/2}\ \ \text{ and }\ \ f_2(x):=\exp \left\{ -x^2\right\} , \ \ \text{ for }\ \ x\in I, \end{aligned}$$

where \(f_1\) has smoothness of a finite order and \(f_2\) has smoothness of the infinite order. The true values of the integral with \(f_1\) is evaluated by using the Matlab symbolic toolbox, and that of the integral with \(f_2\) is given by (6.1).

Table 10 Relative errors of QuadE for the function \(f_1(x):=x^{7/2}\)

We report in Table 10 relative errors for \(f_1\) of the two quadrature formulas \(\mathcal {Q}^{\alpha }_{n}[f_1]\) and \(\mathcal {P}_{n,\alpha }^{\gamma ,\varepsilon }[f_1]\) for different n and \(\alpha \), where the parameters in \(\mathcal {P}_{n,\alpha }^{\gamma ,\varepsilon }[f_1]\) are \(\gamma =0.2\) and \(\varepsilon =6\). We see from Table 10 that relative errors of \(\mathcal {Q}^{\alpha }_{n}[f_1]\) are smaller than those of \(\mathcal {P}_{n,\alpha }^{0.2,6}[f_1]\) for fixed n when \(\alpha \) is large.

Table 11 Relative errors of QuadE for the function \(f_2(x):=\exp \left\{ -x^2\right\} \)

Relative errors for \(f_2\) are listed in Table 11, where the parameters in \(\mathcal {P}_{n,\alpha }^{\gamma ,\varepsilon }[f]\) are \(\gamma =0.02\) and \(\varepsilon =6\). From Table 11, we confirm that \(\mathcal {Q}^{\alpha }_{n}[f_2]\) is more accuracy than \(\mathcal {P}_{n,\alpha }^{0.02,6}[f_2]\). Notice that the quadrature nodes used in \(\mathcal {Q}^{\alpha }_{n}[f_2]\) is less than that in \(\mathcal {P}_{n,\alpha }^{0.02,6}[f_2]\) for fixed n.

We finally remark the quadrature formulas proposed in this paper are robust, easy to implement and computationally inexpensive, when \(\alpha \) is large.