1 Introduction

In this article, we pay our attention to the numerical solution of solving second-order Volterra integro-differential equation

$$\begin{aligned}&a_{2}u''(x)+a_{1}u'(x)+a_{0}u(x)+ \int _{a}^{x}K(x,t)u(t)\mathrm{d}t=f(x), \quad x \in (a,b);\\ \nonumber&u(a) = u_0 \ \ u'(a) = u'_0, \end{aligned}$$
(1)

where \(a_{2},a_{1},a_{0},a_{2}\ne 0 \) are constant, K(xt) are the continuous function on \([a,b]\times [a,b]\) and f(x) are continuous functions.

Second-order Volterra integro-differential equation has been paid much attention because of its great importance in engineering and science. There are lots of physical phenomenon such as population dynamics of biological applications, electrostatics, potential theory, mechanics and so on. As it is difficult to solve second-order Volterra integro-differential equation analytically, numerical method is needed to be presented. Several numerical methods (Maleknejad and Aghazadeh 2005; Delves and Mohamed 1985; Ortiz and Samara 1981; Pour-Mahmoud et al. 2005; Hosseini and Shahmorad 2003; Razzaghi and Yousefi 2005; Yalcinbas et al. 2009; Bayramov and Kraus 2015), for examples, collocation and spectral collocation methods, Runge–Kutta methods, linear multistep methods, and block boundary value methods, the successive approximation method, the Adomian decomposition method, the Chebyshev and Taylor collocation method, Haar Wavelet method, Wavelet–Galerkin method have been used. There are some advantages such as without dividing elements, simple formulas, no integrals and easy programming of the collocation method (Bayramov and Kraus 2015; Shen et al. 2011). The barycentric formula is obtained by the Lagrange interpolation formula (Berrut et al. 2014; Berrut and Klein 2014; Cirillo and Hormann 2019) and has been used to solve Volterra equation and Volterra Integro-Differential equation (Ali et al. 2001; Berrut et al. 2011). In general, the interpolation nodes of Lagrange interpolation with barycentric center are dense at both ends of the interval and sparse in the middle of the interval. The special distributed nodes are usually the zeros of the spectral function or its derivative, such as the Chebyshev points of the second kind. To get the equidistant node of the barycentric formula, Floater et al. (2007, 2012a, b) have proposed a rational interpolation scheme which has high numerical stability and interpolation accuracy on both equidistant and special distributed nodes. In Garey and Shaw (1991), one-step methods of the Runge–Kutta type methods are presented for a class of second-order Volterra integro-differential equations in reference Abdi and Hossseint (2019), linear barycentric rational interpolation is used to derive a difference-quadrature scheme for solving first-order Volterra integro-differential equations. In recent papers, Wang et al. (2012, 2015, 2018, 2018) successfully applied the collocation method to solve initial value problems, plane elasticity problems, incompressible plane problems and non-linear problems which have expanded the application fields of the collocation method.

In this paper, the linear barycentric rational collocation method for solving second-order Volterra integro-differential equation is presented, which not only possess accurate numerical results but also have excellent stability properties. Following the barycentric interpolation method of Lagrange polynomial and Chebyshev polynomial, the matrix form of the collocation method is also obtained which can be easy to programming. With the help of the convergence rate of the linear barycentric rational interpolation, the convergence rate of linear barycentric rational collocation method for solving second-order Volterra integro-differential equation is proved. At last, several numerical examples are provided to validate our theoretical analysis.

This paper is organized as following: In Sect. 2, the differentiation matrices and collocation scheme for second-order Volterra integro-differential equation are presented and the matrix form of collocation scheme is obtained. In Sect. 3, the convergence rate is presented. At last, some numerical examples are listed to illustrated our theorem.

2 Differentiation matrices and algorithm for second-order Volterra integro-differential equation

Let the interval [ab] be partitioned into n uniform part with \(h=(b-a)/n\) and \(x_{0},x_{1},\dots ,x_{n}\) with its related function \(u(x_{i}),i=0,1,\dots ,n\). For any \(0\le d \le n\), with \(p_{i}(x),i=0,1,\dots ,n-d\) to be the interpolation function at the point \(x_{i},x_{i+1},\dots ,x_{i+d}\), then we have \(p_{i}(x_{k})=u(x_{k}),k=i,i+1,\dots ,i+d\) and the rational barycentric interpolation function as Berrut et al. (2014)

$$\begin{aligned} \displaystyle {\tilde{u}}_{n}(x)=\sum _{j=0}^{n} L_{j}(x) u_{j}, \end{aligned}$$
(2)

where \( u_{j}=u(x_{j})\);

$$\begin{aligned} \displaystyle L_{j}(x)=\frac{\displaystyle \frac{w_{j}}{x-x_{j}}}{\sum _{k=0}^{n} \frac{w_{k}}{x-x_{k}}}, \end{aligned}$$
(3)

and

$$\begin{aligned} \displaystyle w_{k}=\sum _{i \in J_{k}}(-1)^{i} \prod _{j=i, j \ne k}^{i+d} \frac{1}{x_{k}-x_{j}}, \end{aligned}$$
(4)

and \(J_{k}=\{i \in I ; k-d \le i \le k\},I=\{0,1,2,\dots ,n-d \}\).

Numerical scheme is given as

$$\begin{aligned}&a_{2}\sum _{j=0}^{n} u_{j} L_{j}^{\prime \prime }(x)+ a_{1} \sum _{j=0}^{n} u_{j} L_{j}^{\prime }(x)+ a_{0}\sum _{j=0}^{n} u_{j} L_{j}(x)+ \int _{a}^{x}\left( K(x,t)\sum _{j=0}^{n} u_{j} L_{j}(t)\right) \mathrm{d}t \nonumber \\&\quad =f(x), \end{aligned}$$
(5)

taking the \(x_{i}\) at the Eq. (5), we have

$$\begin{aligned}&a_{2}\sum _{j=0}^{n} u_{j} L_{j}^{\prime \prime }(x_{i})+ a_{1} \sum _{j=0}^{n} u_{j} L_{j}^{\prime }(x_{i}) + a_{0}\sum _{j=0}^{n} u_{j} L_{j}(x_{i}) \nonumber \\&\quad + \int _{a}^{x_{i}}\left( K(x_{i},t)\sum _{j=0}^{n} u_{j} L_{j}(t)\right) \mathrm{d}t =f(x_{i}),\quad i=0,1,2,\dots ,n. \end{aligned}$$
(6)

For the term of equation (6) with the integration, we have

$$\begin{aligned}&\int _{a}^{x_{i}}\left( K(x_{i},t)\sum _{j=0}^{n} u_{j} L_{j}(t)\right) \mathrm{d}t =\int _{a}^{x_{i}}\left( \sum _{j=0}^{n}K(x_{i},t) u_{j} L_{j}(t)\right) \mathrm{d}t \nonumber \\&\quad =\int _{a}^{x_{i}}\sum _{j=0}^{n}\left( K(x_{i},t) u_{j} L_{j}(t)\right) \mathrm{d}t =\sum _{j=0}^{n}\left[ \int _{a}^{x_{i}}\left( K(x_{i},t) L_{j}(t) \right) \mathrm{d}t\right] u_{j}, \end{aligned}$$
(7)

Integral is written as

$$\begin{aligned} K_{j}(x_{i})=\int _{a}^{x_{i}}K(x_{i},t) L_{j}(t)\mathrm{d}t. \end{aligned}$$
(8)

Taking (8) into Eq. (6), we have

$$\begin{aligned}&\sum _{j=0}^{n}a_{2} u_{j} L_{j}^{\prime \prime }(x_{i})+ a_{1} \sum _{j=0}^{n} u_{j} L_{j}^{\prime }(x_{i}) + a_{0}\sum _{j=0}^{n} u_{j} L_{j}(x_{i}) \nonumber \\&\quad + \sum _{j=0}^{n} K_{j}(x_{i})u_{j} =f(x_{i}),\quad i=0,1,2,\dots ,n. \end{aligned}$$
(9)

Using the notation of differential matrix, the Eq. (9) is denoted as matrices equation in the form of

$$\begin{aligned} a_{2}\sum _{j=0}^{n} D_{i j}^{(2)} u_{j}+a_{1} \sum _{j=0}^{n} D_{i j}^{(1)} u_{j}+a_{0} \sum _{j=0}^{n} \delta _{i j} u_{j}+\sum _{j=0}^{n} K_{i j} u_{j}=f\left( x_{i}\right) , \end{aligned}$$
(10)

where we have used \( L_{j}(x_{i})= \delta _{i j}=0,i\ne j,\delta _{i j}=1,i= j \) ,\(i=0,1,2, \dots , n\) and \(K_{i j} =K_{j}(x_{i})\) defined as (8). Equation (9) is written as matrices in the form of

$$\begin{aligned} \left[ a_{2} {\mathbf {D}}^{(2)}+ a_{1}{\mathbf {D}}^{(1)}+ a_{0}{\mathbf {I}}+{\mathbf {K}} \right] {\mathbf {u}}={\mathbf {f}}, \end{aligned}$$
(11)

where \({\mathbf {L}} :=a_{2}{\mathbf {D}}^{(2)}+a_{1} {\mathbf {D}}^{(1)}+a_{0} {\mathbf {I}}+{\mathbf {K}} , {\mathbf {u}}=\left[ u_{0},u_{1}, u_{2}, \dots , u_{n}\right] ^{\mathrm {T}}, {\mathbf {D}}^{(k)}=\left[ D_{i j}^{(k)}\right] _{(n+1)\times (n+1)}, \) and

$$\begin{aligned} D_{i j}^{(1)}=\left\{ \begin{array}{ll}{\displaystyle \frac{\omega _{j} / \omega _{i}}{x_{i}-x_{j}},} &{} {i \ne j,} \\ {\displaystyle -\sum _{k \ne i} D_{i k}^{(1)},} &{} {i=j,}\end{array} \quad D_{i j}^{(2)}=\left\{ \begin{array}{ll}{\displaystyle 2 D_{i j}^{(1)}\left( D_{i i}^{(1)}-\frac{1}{x_{i}-x_{j}}\right) ,} &{} {i \ne j} \\ {\displaystyle -\sum _{k \ne i} D_{i k}^{(2)},} &{} {i=j}\end{array}\right. \right. \end{aligned}$$
(12)

where \(\omega _{i}\) defined as (4).

3 Convergence and error analysis

In this part, the rational interpolation function (Wang and Li 2015) is presented as

$$\begin{aligned} \displaystyle r(x)= \displaystyle \frac{ \sum _{i=0}^{n-d} \lambda _{i}(x) p_{i}(x)}{ \sum _{i=0}^{n-d} \lambda _{i}(x)}, \end{aligned}$$
(13)

where

$$\begin{aligned} \displaystyle \lambda _{i}(x)=\frac{(-1)^{i}}{\left( x-x_{i}\right) \cdots \left( x-x_{i+d}\right) }, \end{aligned}$$
(14)

and

$$\begin{aligned} \displaystyle p_{i}(x)=\sum _{k=i}^{i+d} \prod _{j=i, j \ne k}^{i+d} \frac{x-x_{j}}{x_{k}-x_{j}} u_{k}. \end{aligned}$$
(15)

With the help of error function of difference formula

$$\begin{aligned} e(x) :=u(x)-r(x)=\left( x-x_{i}\right) \cdots \left( x-x_{i+d}\right) u\left[ x_{i}, x_{i+1}, \ldots , x_{i+d}, x\right] , \end{aligned}$$
(16)

where \(u[x_{i}, x_{i+1}, \ldots , x_{i+d}, x]\) denotes the divided difference of u at the points \(x_{i}, x_{i+1}, \ldots , x_{i+d}, x\), and

$$\begin{aligned} \displaystyle e(x) =\displaystyle \frac{\sum _{i=0}^{n-d} \lambda _{i}(x)\left( u(x)-p_{i}(x)\right) }{\sum _{i=0}^{n-d} \lambda _{i}(x)}=\frac{A(x)}{B(x)}=O(h^{d+1}); \end{aligned}$$
(17)

here,

$$\begin{aligned} A(x) :=\sum _{i=0}^{n-d}(-1)^{i}u\left[ x_{i}, \ldots , x_{i+d}, x\right] \end{aligned}$$
(18)

and

$$\begin{aligned} B(x) :=\sum _{i=0}^{n-d} \lambda _{i}(x). \end{aligned}$$
(19)

By taking the numerical scheme

$$\begin{aligned}&a_{2}\sum _{j=0}^{n} u_{j} L_{j}^{\prime \prime }(x_{i})+ a_{1} \sum _{j=0}^{n} u_{j} L_{j}^{\prime }(x_{i})+a_{0} \sum _{j=0}^{n} u_{j} \delta _{i j} + \int _{a}^{x_{i}}\left( K(x_{i},t)\sum _{j=0}^{n} u_{j} L_{j}(t) \right) \mathrm{d}t \nonumber \\&\quad =f(x_{i}), \quad i=0,1,2,\dots ,n. \end{aligned}$$
(20)

Combining (20) and (1), we have

$$\begin{aligned} Te(x):=a_{2}e^{\prime \prime }\left( x\right) +a_{1} e^{\prime }\left( x\right) +a_{0} e\left( x\right) + K(e(x)), \end{aligned}$$
(21)

and \(R_{f}(x)=f(x)-f(x_{k}),k=0,1,2,\dots ,n\).

The following Lemma has been proved in Jean–Paul Berrut Berrut et al. (2014).

Lemma 1

If \(y\in C^{d+2}[a,b]\),then

$$\begin{aligned} \left| e\left( x\right) \right| \le C h^{d+1}. \end{aligned}$$

If \(y\in C^{d+2}[a,b]\),then

$$\begin{aligned} \left| e^{\prime }\left( x\right) \right| \le C h^{d}. \end{aligned}$$

If \(y\in C^{d+3}[a,b]\),then

$$\begin{aligned} \left| e^{\prime \prime }\left( x\right) \right| \le C h^{d-1}. \end{aligned}$$

Let u(x) be the solution of (1) and \(u_{n}(x)\) is the numerical solution, then we have

$$\begin{aligned}Tu_{n}(x_{k})=f(x_{k}), \quad k=0,1,2,\dots ,n,\end{aligned}$$

and

$$\begin{aligned}\lim _{n\rightarrow \infty }u_{n}(x)=u(x),\end{aligned}$$

where \(Tu=:a_{2}u^{\prime \prime }\left( x\right) +a_{1} u^{\prime }\left( x\right) +a_{0} u\left( x\right) + K(u(x)).\)

Based on the above lemma, we get the following theorem.

Theorem 1

Let \(u_{n}(x):Tu_{n}(x)=f(x),u_{n}^{*}(x):Tu_{n}^{*}(x)=f^{*}(x)\), \(f(x)\in C[a,b]\) and assume matrix \({\mathbf {L}} :=a_{2}{\mathbf {D}}^{(2)}+a_{1} {\mathbf {D}}^{(1)}+a_{0} {\mathbf {I}}+{\mathbf {K}}\) is invertible , we have

$$\begin{aligned} |\tilde{u}_{n}(x)-\tilde{u}_{n}^{*}(x)|\le Ch^{d-1}. \end{aligned}$$

Proof

As

$$\begin{aligned} {\tilde{u}}_{n}(x)=\sum _{j=0}^{n} L_{j}(x) u_{j},\, \tilde{u}_{n}^{*}(x)=\sum _{j=0}^{n} L_{j}(x) u_{j}^{*}, \end{aligned}$$

where \(U_{n}=(u(x_{0}),u(x_{1}), \ldots , u(x_{n}))^{T}\), \(U_{n}^{*}=(u^{*}(x_{0}),u^{*}(x_{1}), \ldots , u^{*}(x_{n}))^{T}\). By

$$\begin{aligned} U_{n}-U_{n}^{*}={\mathbf {L}}^{-1}({\mathbf {L}}U_{n}-F_{n}^{*}), \end{aligned}$$

which means

$$\begin{aligned} {\tilde{u}}_{n}(x)-{\tilde{u}}_{n}^{*}(x)=\sum _{j=0}^{n} M_{j}(x)Te(x). \end{aligned}$$

Combining the Lemma 1 and Eq. (21), we have

$$\begin{aligned} |Te(x)|= & {} |a_{2}e^{\prime \prime }(x)+a_{1} e^{\prime }(x) +a_{0} e(x)+ K(e(x))| \nonumber \\ {}\le & {} |a_{2}e^{\prime \prime }(x)|+|a_{1} e^{\prime }(x)| +|a_{0} e(x)|+| K(e(x))| \nonumber \\ {}\le & {} Ch^{d-1}+Ch^{d}+Ch^{d+1}+Ch^{d+2} \nonumber \\ {}\le & {} Ch^{d-1}. \end{aligned}$$
(22)

As we have assumed that matrix \({\mathbf {L}}\) is invertible and \(M_{j}(x)\) is the element of matrix \({\mathbf {L}}^{-1}\),then we have

$$\begin{aligned} |{\tilde{u}}_{n}(x)-{\tilde{u}}_{n}^{*}(x)|\le |\sum _{j=0}^{n} M_{j}(x)| |Te(x)| \le Ch^{d-1}. \end{aligned}$$

The proof is completed. \(\square \)

4 Numerical example

In this part, numerical examples are presented to illustrate our theorem.

Example 1

Consider the second-order Volterra integro-differential equation

$$\begin{aligned} u^{\prime \prime }=\int _{0}^{x} x t u(t)\mathrm{d}t+u(x)+2-x^2-\frac{1}{4}x^5-x^2e^{x}+xe^{x}-x, \end{aligned}$$
(23)

with condition \( u(0)=1,u^{\prime }(0)=1\) and its analysis solution is

$$\begin{aligned}u=x^2+e^{x}.\end{aligned}$$
Table 1 Errors of the linear barycentric rational collocation methods with equidistant nodes
Table 2 Errors of the linear barycentric rational collocation methods with Chebyshev nodes

In this example, we test the linear barycentric rational with the equidistant nodes; Table 1 shows that the convergence rate is \(O(h^{d-1})\) with \(d=2,3,4,5\) which agrees with our theorem analysis. In Table 2, for the Chebyshev nodes, the convergence rate can reach \(O(h^{2d-2})\) with \(d=2,3,4,5\) which is out of our goal of this paper but will be presented in other papers. For \(n=160, 320,640\), because of the higher convergence rate and accumulation error of matlab, there is no convergence rate.

Example 2

In this example, we consider the second-order Volterra integro-differential equation with variable coefficient

$$\begin{aligned} u^{\prime \prime }(x)+\cos x u(x)= \sin \frac{x}{2}\int _{0}^{x}\cos ( t) u(t)\mathrm{d}t+f(x), \end{aligned}$$
(24)

where

$$\begin{aligned} f(x)= & {} \cos x-x\sin x+\cos (x) [x\sin (x)+\cos (x)]\nonumber \\&-\sin (\frac{x}{2})\left[ \frac{2}{9}\sin (3x)-\frac{x\cos (3x)}{6}+\frac{x\cos (x)}{2}\right] ; \end{aligned}$$
(25)

with \(u(0)=1,u^{\prime }(0)=0\) and its analysis solution is

$$\begin{aligned}u=x\sin (x)+\cos (x).\end{aligned}$$
Table 3 Errors of the linear barycentric rational collocation methods with equidistant nodes
Table 4 Errors of the linear barycentric rational collocation methods with Chebyshev nodes

In this example, we test the linear barycentric rational with the equidistant nodes; Table 3 shows that the convergence rate is \(O(h^{d-1})\) with \(d=2,3,4,5\) which agrees with our theorem analysis. In Table 4, for the Chebyshev nodes, the convergence rate can reach \(O(h^{2d-2})\) with \(d=2,3,4,5\) which is out of our goal of this paper but will be presented in other papers. For \(n=160, 320,640\), because of the higher convergence rate and accumulation error of matlab, there is no convergence rate.

5 Concluding remarks

In this paper, the numerical approximation of linear barycentric rational collocation method for solving the constant coefficient second-order Volterra integro-differential equation is presented. The matrix form of algorithm is obtained from the equation (1). With the help of error function of difference formula, the convergence rate of linear barycentric rational collocation method \(O(h^{d-1})\) with equidistant nodes agree with our theorem analysis, while for Chebyshev point, numerical results shows the convergence rate can reach \(O(h^{2d-2})\) which is out of our goal of this paper will be presented in other papers.

In Theorem 1, we have assumed that the matrix \({\mathbf {L}}\) is invertible. With the matrix equation of the linear barycentric rational collocation method, as there are the term of integral matrix \({\mathbf {K}}\), we have not presented the invertible properties of matrix \({\mathbf {L}}\) which will be given in other papers.”