1 Introduction

One of the first works in imaginary numbers was by the Persian mathematician Al-Khwarizmi. However, the first person who used them is Girolamo Cardano (1501–1576). Also, Paul Nahin gave a detailed description of imaginary numbers [1]. The symbol i instead of \(\sqrt{-1}\) was proposed by Euler (1707–1783). The interpretation of complex numbers as points in the plane was suggested by Carl Friedrich Gauss (1777–1855). Gauss also demonstrated that every polynomial equation of degree n with nonzero complex coefficients has n roots in complex numbers. The complex functions and their integrals were studied by Gauss and Simon Denis Poisson (1781–1840). August Louis Cauchy (1789–1857) published a large number of researches on the integral theorem and related concepts. George Bernhard Riemann (1826–1860) introduced the derivatives of functions of complex variables [2].

The complex numbers and functions have unbelievable properties, which are used to solve science and engineering problems such as contour integration, electrical engineering, digital filters, generating functions, physical problems, Fourier analysis, conformal mappings, mechanical problems, eigenvalues, and mechanical systems. Also, they are used in phasor transforms to analyze networks composed of resistors, capacitors, and inductors. For instance, in digital signal processing, complex Fourier, Laplace, and z-transforms are used; see [3].

We can solve integro-differential equations with some basis functions by the Haar and rationalized function methods [4,5,6,7,8], Adomian decomposition method [9], Legendre wavelets method [10], RBFs collocation method [11], and Genocchi polynomials and collocation method based on the Bernoulli operational matrix [12, 13]. Also, in [14], Volterra–Fredholm integro-differential equations of fractional order are solved by the sinc-collocation method.

So far, there are no any publications in the field of integro-differential equations in the complex plane by the finite element method. Recently, some work has been done by the rationalized Haar function method [15,16,17] and by the collocation method based on the Bernoulli operational [18].

Spline functions are a class of piecewise polynomials that satisfy continuity properties depending on the degree of the polynomials. They have highly desirable characteristics, which have made them a powerful mathematical tool for numerical approximations. Spline functions are a set of continuous combinations of B-splines used as trial functions in the Galerkin method [19,20,21,22,23].

This work is organized as follows. In Sect. 2, we use the of the finite element method, especially, the linear B-spline finite element method (LBS-FEM) and cubic B-spline finite element method (CBS-FEM) [19] to obtain an approximate solution of a linear Volterra integro-differential equation in the complex plane. The convergence analysis is given in Sect. 3, and numerical experiments are carried out in Sect. 4 to verify the theoretical results.

2 The proposed method

We consider the linear second-order Volterra integro-differential equations of the second kind in complex plane with boundary conditions \(u(0)=0\) and \(u(1)=0 \):

$$\begin{aligned} -u''(x)+b(x)u'(x)+c(x)u(x)=f(x)+ \mathsf{i} \int _{0}^{x} K(x,t) u(t)\,dt,\quad x \in [0,1], \end{aligned}$$
(1)

where \(u(x)\) is an unknown complex-valued function to be determined, and \(f(x)\) is a complex-valued function; in other words,

$$\begin{aligned} \textstyle\begin{array}{l@{\qquad }l} u:[0,1] \subseteq \mathbb{R} \rightarrow \mathbb{C} & f:[0,1] \subseteq \mathbb{R} \rightarrow \mathbb{C} \\ u(x)=u_{1}(x)+ \mathsf{i} u_{2}(x), & f(x)=f_{1}(x)+\mathsf{i} f_{2}(x), \\ u_{1}, u_{2} \in C^{2} \bigl([0,1]\bigr), & f_{1},f_{2} \in C\bigl([0,1]\bigr). \end{array}\displaystyle \end{aligned}$$
(2)

Moreover, \(b(x)\) and \(c(x)\) are nonnegative functions belonging to \(C^{1}([0,1])\), and \(K(x,t)\) is a known continuous function on \([0, 1] \times [0, 1]\). Using (2) in (1), we have

$$\begin{aligned} \begin{aligned} &{-}u_{1}''(x)+b(x)u_{1}'(x)+c(x) u_{1}(x)=f_{1}(x)- \int _{0}^{x} K(x,t) u_{2}(t)\,dt, \\ &{-}u_{2}''(x)+b(x)u_{2}'(x)+c(x) u_{2}(x)=f_{2}(x)+ \int _{0}^{x} K(x,t) u_{1}(t)\,dt. \end{aligned} \end{aligned}$$
(3)

In this work, we use the linear B-spline (LBS) and cubic B-spline (CBS) functions as the basis functions of the subspace \(V_{h}\).

If \(\pi : 0=x_{0} < x_{1} <\cdots < x_{M}=1\) is a grid with \(M+1\) points in the interval \([0,1]\), where \(x_{i} = ih\) for \(i=0,1,\ldots , M\), and \(x_{0}=0\), \(x_{M}= 1\), and \(\Delta x = h = \frac{1}{M}\), then, for \(i=0, \dots , M\), the LBS is defined as

$$\begin{aligned} \phi _{i}(x) = \frac{1}{h} \textstyle\begin{cases} (x-x_{i-1}), &x \in [x_{i-1},x_{i}], \\ (x_{i+1}-x), &x \in [x_{i},x_{i+1}], \\ 0 &\text{otherwise}. \end{cases}\displaystyle \end{aligned}$$

Thus \(\phi _{i}(x_{i}) = 1\), and the value of ϕ in the other nodes is equal to zero. The CBS is defined upon an increasing set of \(M + 1\) knots over the problem domain plus six additional knots outside the problem as

$$ x_{-3} < x_{-2} < x_{-1} < x_{0} \quad \text{and}\quad x_{M} < x_{M+1} < x_{M+2} < x_{M+3}. $$

In other words, the cubic B-splines for \(i=-1, 0, \ldots , M+1\) are defined as

$$\begin{aligned} Q_{i}(x) = \frac{1}{h^{3}} \textstyle\begin{cases} (x-x_{i-2})^{3}, & x \in [x_{i-2},x_{i-1}], \\ (x-x_{i-2})^{3}-4(x-x_{i-1})^{3}, & x \in [x_{i-1},x_{i}], \\ (x_{i+2}-x)^{3}-4(x_{i+1}-x)^{3}, & x \in [x_{i},x_{i+1}], \\ (x_{i+2}-x)^{3}, & x \in [x_{i+1},x_{i+2}], \\ 0 &\text{otherwise}. \end{cases}\displaystyle \end{aligned}$$

Thus

$$\begin{aligned} Q_{i}(x_{j}) = \textstyle\begin{cases} \frac{1}{4},& j=i-1, \\ 1, & j=i, \\ \frac{1}{4}, & j=i+1, \\ 0 & \text{in the other nodes}, \end{cases}\displaystyle \end{aligned}$$

and thus \(Q_{2}, Q_{3}, \ldots , Q_{M-2}\) satisfy the zero boundary conditions, but \(Q_{-1}\), \(Q_{0}\), \(Q_{1}\), \(Q_{M-1}\), \(Q_{M}\), and \(Q_{M+1}\) do not. Therefore we modify cubic B-spline basis functions for handling the Dirichlet boundary conditions. The modified cubic B-spline (MCBS) basis functions are defined as follows:

$$\begin{aligned} \phi _{i}(x) = Q_{i}(x), \quad i=2,3,\ldots , M-2, \end{aligned}$$

and

$$\begin{aligned} &\phi _{0}(x) = Q_{0}(x)- 4 Q_{-1} (x),\qquad \phi _{1}(x) = Q_{1}(x)-Q_{-1}(x), \\ &\phi _{M-1}(x) = Q_{M-1}(x)-Q_{M+1}(x),\qquad \phi _{M}(x) = Q_{M}(x)-4 Q_{M+1}(x). \end{aligned}$$

By this definition of MCBS, \(\phi _{i} (x)\) satisfy the boundary condition, that is, \(\phi _{0}(0)=\phi _{1}(0)=\phi _{M-1}(1)=\phi _{M} (1)=0\) [19]. The main purpose of this paper is to use the finite element method to find an approximate solution of (1); to this end, we must obtain a weak and variational form of equation (1). Set \(\varOmega =[0,1] \subset \mathbb{R}\). First, we define \(\mathcal{V}= \mathcal{H}^{1}_{0}(\varOmega )\) as an infinite-dimensional space and \(\mathcal{B}:\mathcal{V}\times \mathcal{V} \rightarrow \mathbb{R}\) as a bilinear form. So we have

$$\begin{aligned} B(u,v) ={} & \int _{\varOmega } u'(x) v'(x)\,dx + \int _{\varOmega } b(x) u'(x) v(x)\,dx + \int _{\varOmega } c(x) u(x) v(x)\,dx \\ &{} - \mathsf{i} \int _{\varOmega } v(x) \biggl( \int _{0}^{x} K(x,t) u(t)\,dt \biggr)\,dx. \end{aligned}$$
(4)

Also, for all arbitrary functions \(v(x) \in \mathcal{V}\), we have \(\mathcal{B}(u,v) = \mathcal{L}(v)\), where \(\mathcal{L}:\mathcal{V} \rightarrow \mathbb{R}\) is the linear functional given by

$$\begin{aligned} L(v) = \int _{\varOmega } f(x)v(x)\,dx. \end{aligned}$$

The space \(\mathcal{V}\) is infinite-dimensional, and thus we introduce a finite-dimensional subspace \(\mathcal{V}_{h}\) of \(\mathcal{V}\). So the problem is converted to find \(u_{h}=(u_{1,h}, u_{2,h}) \in \mathcal{V}_{h}\) such that

$$ \mathcal{B}(u_{h}, v_{h}) = \mathcal{L} (v_{h}) \quad \text{for all } v_{h} \in \mathcal{V}_{h}. $$

Using the LBS and MCBS functions for \(u_{h}(x)\) and \(v_{h}(x)\), we have

u h (x)= ( u 1 , h ( x ) u 2 , h ( x ) ) = ( i = 1 M 1 α i ϕ i ( x ) i = 1 M 1 β i ϕ i ( x ) ) , v h (x)= ( ϕ j ( x ) ϕ j ( x ) ) .
(5)

Hence by substituting (5) into the variational formulation we have

$$\begin{aligned} \begin{aligned} & \sum_{i=1}^{M-1} \alpha _{i} \biggl( \int _{\varOmega } \phi _{i} ' (x) \phi _{j} '(x)\,dx + \int _{\varOmega } b(x) \phi _{i} '(x) \phi _{j} (x)\,dx + \int _{\varOmega } c(x) \phi _{i} (x) \phi _{j} (x)\,dx \biggr) \\ &\quad {} + \sum_{i=1}^{M-1} \beta _{i} \biggl( \int _{\varOmega } \phi _{j} (x) \biggl( \int _{0}^{x} K(x,t) \phi _{i} (t)\,dt \biggr)\,dx \biggr) = \int _{ \varOmega } f_{1}(x) \phi _{j} (x)\,dx, \\ & \sum_{i=1}^{M-1} \beta _{i} \biggl( \int _{\varOmega } \phi _{i} ' (x) \phi _{j} '(x)\,dx + \int _{\varOmega } b(x) \phi _{i} '(x) \phi _{j} (x)\,dx + \int _{\varOmega } c(x) \phi _{i} (x) \phi _{j} (x)\,dx \biggr) \\ &\quad {} - \sum_{i=1}^{M-1} \alpha _{i} \biggl( \int _{\varOmega } \phi _{j} (x) \biggl( \int _{0}^{x} K(x,t) \phi _{i} (t)\,dt \biggr)\,dx \biggr) = \int _{ \varOmega } f_{2}(x) \phi _{j} (x)\,dx, \end{aligned} \end{aligned}$$
(6)

or, more concisely,

$$\begin{aligned} C X = F, \end{aligned}$$
(7)

where

$$\begin{aligned} \begin{aligned} &X = [\alpha _{1},\alpha _{2}, \ldots ,\alpha _{M-1},\beta _{1},\beta _{2},\ldots , \beta _{M-1} ]^{T}, \\ &F = \biggl[ \int _{\varOmega } f_{1}(x) \phi _{1} (x)\,dx, \int _{\varOmega } f _{1}(x) \phi _{2}(x)\,dx, \ldots , \int _{\varOmega } f_{1}(x) \phi _{M-1} (x)\,dx, \\ &\hphantom{F =} \int _{\varOmega } f_{2}(x) \phi _{1} (x)\,dx, \int _{\varOmega } f_{2}(x) \phi _{2} (x)\,dx, \ldots , \int _{\varOmega } f_{2}(x) \phi _{M-1} (x)\,dx \biggr]^{T}, \end{aligned} \end{aligned}$$
(8)

and C in the \(2(M-1)\times 2(M-1)\)-dimensional matrix given by

C= ( C 1 | C 2 C 3 | C 4 ) ,
(9)

where four tridiagonal submatrices \(C_{1}\), \(C_{2}\), \(C_{3}\), \(C_{4}\) are

$$\begin{aligned} &(C_{1})_{i,j} = \int _{0}^{1} \phi ^{\prime }_{i} (x) \phi ^{\prime }_{j}(x)\,dx + \int _{0}^{1} b(x) \phi ^{\prime }_{i} (x) \phi _{j}(x)\,dx + \int _{0}^{1} c(x) \phi _{i} (x) \phi _{j}(x)\,dx, \\ &(C_{2})_{i,j} = \int _{0}^{1} \biggl( \int _{0}^{x} K (x,t) \phi _{i}(t)\,dt \biggr) \phi _{j}(x)\,dx , \\ &(C_{3})_{i,j} = - \int _{0}^{1} \biggl( \int _{0}^{x} K (x,t) \phi _{i}(t)\,dt \biggr) \phi _{j}(x)\,dx , \\ &(C_{4})_{i,j} = \int _{0}^{1} \phi ^{\prime }_{i} (x) \phi ^{\prime }_{j}(x)\,dx + \int _{0}^{1} b_{2}(x) \phi _{i}^{\prime } (x) \phi _{j}(x)\,dx + \int _{0} ^{1} c_{2} (x) \phi _{i} (x) \phi _{j}(x)\,dx . \end{aligned}$$

By solving system (7) we obtain the coefficients \(\alpha _{i}\), \(\beta _{i}\), and the approximate solution \(u_{h}\) can be found from (5).

3 Convergence analysis

In this section, we present the error analysis theorems for the proposed method. For this purpose, let \(\mathcal{V}\) be a Hilbert space, and let \(\mathcal{B}\) be a symmetric \(\mathcal{V}\)-elliptic bilinear form. Then the inner product energy is \(( \cdot , \cdot ) : \mathcal{V} \times \mathcal{V} \rightarrow \mathbb{R}\) defined by \((u,v)_{\mathcal{B}} = \mathcal{B} (u,v)\). Additionally, the energy norm is

$$\begin{aligned} \Vert u \Vert _{E}^{2} = (u,u)_{\mathcal{B}}. \end{aligned}$$

Definition 3.1

For an operator \(\varPi : \mathcal{V} \rightarrow \mathcal{V}_{h}\), the projection operators are defined as

$$\begin{aligned} &\varPi u= \tilde{u}_{h} = \sum_{i=1}^{n} \tilde{a}_{i} \phi _{i} (x). \end{aligned}$$

Theorem 3.2

Let \(\mathcal{B}\) be the bilinear form defined by (4), and let \(M_{1} \leq c(x) \leq M_{2}\), \(P_{1} \leq b(x) \leq P_{2}\), and \(0 \leq b'(x) \leq T_{2}\). Then \(\mathcal{B}\) is a \(\mathcal{V}\)-ellipticity, (1) has a unique solution, and the order of convergence is \(O(h^{\zeta })\).

Proof

From (4) we have

$$\begin{aligned} \bigl\vert B(u,v) \bigr\vert ={} & \biggl\vert \int _{\varOmega } u'(x) v'(x)\,dx + \int _{ \varOmega } b(x) u'(x) v(x)\,dx \\ & {}+ \int _{\varOmega } c(x) u(x) v(x)\,dx -\mathsf{i} \int _{\varOmega } v(x) \biggl( \int _{0}^{x} K(x,t) u(t)\,dt\biggr)\,dx \biggr\vert . \end{aligned}$$

Using the Cauchy–Schwarz inequality and Sobolev norm, we have

$$\begin{aligned} \bigl\vert B(u,v) \bigr\vert &\leq \Vert u \Vert _{H^{1} } \Vert v \Vert _{H^{1} } + P_{2} \Vert u \Vert _{H^{1} } \Vert v \Vert _{H^{1} } + M_{2} \Vert u \Vert _{H^{1} } \Vert v \Vert _{H^{1} } + K R \Vert u \Vert _{H^{1} } \Vert v \Vert _{H^{1} } \\ & = (1+P_{2} + M_{2} +K R ) \Vert u \Vert _{H^{1} (\varOmega )} \Vert v \Vert _{H^{1} (\varOmega )}=C \Vert u \Vert _{H^{1} ( \varOmega )} \Vert v \Vert _{H^{1} (\varOmega )}, \end{aligned}$$

where \(C= (1+P_{2} + M_{2} +K R ) \), \(K =\max |K(x,t)|\), \(x\in [0,1]\), \(t\in [0,x]\), and \(R=\|1\|^{2}_{L^{2}(\varOmega )}\). Thus \(\mathcal{B}\) is continuous. Furthermore, we prove the \(\mathcal{V}\)-ellipticity of \(\mathcal{B}\). For this purpose, we have

$$\begin{aligned}& \int _{\varOmega } v'(x) v'(x)\,dx+ \int _{\varOmega } c(x) v(x) v(x)\,dx \geq \int _{\varOmega } \bigl({v'}(x) \bigr)^{2}\,dx \geq \frac{1}{1+c} \Vert v \Vert ^{2}_{H^{1}}, \end{aligned}$$
(10)
$$\begin{aligned}& \int _{\varOmega } b(x) v'(x) v(x)\,dx = \frac{-1}{2} \int _{0}^{1} b'(x) \bigl(v(x) \bigr)^{2}\,dx \geq \frac{-T_{2}}{2} \int _{0}^{1} \bigl(v(x)\bigr)^{2}\,dx\geq \frac{-T _{2}}{2} \Vert v \Vert ^{2}_{H^{1}}, \end{aligned}$$
(11)

and

$$\begin{aligned} - \mathsf{i} \int _{\varOmega } v(x) \biggl( \int _{0}^{x} K(x,t) v(t)\,dt\biggr)\,dx & \geq - \biggl\vert \int _{\varOmega } v(x) \biggl( \int _{0}^{x} K(x,t) v(t)\,dt\biggr)\,dx \biggr\vert \\ & \geq - K R \Vert v \Vert ^{2}_{L^{2}} \geq - K R \Vert v \Vert ^{2}_{H^{1}}. \end{aligned}$$
(12)

Thus

$$\begin{aligned} \mathcal{B}(v,v) \geq \biggl(\frac{1}{1+c} - \frac{T_{2}}{2} - K R \biggr) \Vert v \Vert ^{2}_{H^{1}}, \end{aligned}$$
(13)

or

$$\begin{aligned} B(v,v) \geq \eta \Vert v \Vert ^{2}_{H^{1}}, \end{aligned}$$
(14)

where \(\eta = ( \frac{1}{1+c} -\frac{T_{2}}{2} - K R )\), and c is the Poincaré constant. Thus \(\mathcal{B}\) is a \(\mathcal{V}\)-elliptic if \(\eta > 0 \). Therefore, by the Lax–Milgram theorem and the \(\mathcal{V}\)-ellipticity of \(\mathcal{B}\), equation (1) has a unique solution. Suppose that \(u_{h}\) is an approximate solution. Then we have

$$\begin{aligned} \mathcal{B}(u,v_{h}) = \mathcal{L}(v_{h}) \quad \forall v_{h} \in \mathcal{V}_{h} \end{aligned}$$
(15)

and

$$\begin{aligned} \mathcal{B}(u_{h} , v_{h}) = \mathcal{L} (v_{h}) \quad \forall v_{h} \in \mathcal{V}_{h}. \end{aligned}$$
(16)

If \(e=u-u_{h}\), where u is an exact solution of (1), then

$$\begin{aligned} \mathcal{B} (e, v_{h}) = 0\quad \forall v_{h} \in \mathcal{V}_{h}. \end{aligned}$$
(17)

By the relation between the inner product and energy norm, using the Schwarz inequality, we have

$$\begin{aligned} \bigl\vert \mathcal{B}(v ,w ) \bigr\vert \leq \Vert v \Vert _{E} \Vert w \Vert _{E}\quad \forall v,w \in \mathcal{V}. \end{aligned}$$
(18)

Since \((e, v_{h} )_{\mathcal{B}} = \mathcal{B} (e , v_{h}) = 0\), (17) yields that e is orthogonal to any \(v_{h}\). Also, for each particular \(\tilde{v}_{h}\) in \(\mathcal{V}_{h}\), \(\|u-u_{h} \|_{E} = \min \lbrace \| u-v_{h} \|_{E} ; v_{h} \in \mathcal{V}_{h} \rbrace \), and using Cea’s lemma [24], we have

$$ \inf \Vert u-v_{h} \Vert _{\mathcal{V}} \leq \Vert u- \tilde{v}_{h} \Vert _{ \mathcal{V}} $$

if \(\tilde{v}_{h}\) is equal to \(\tilde{u}_{h}\), and we get an upper bound for the interpolation error. Also,

$$ \Vert u-u_{h} \Vert _{\mathcal{V}} \leq c \Vert u - \tilde{u}_{h} \Vert _{ \mathcal{V}}\leq c M h^{\zeta },\quad \zeta >0, $$

where the constant c is independent of h. Therefore

$$ \Vert u-u_{h} \Vert _{\mathcal{V}} \leq \frac{C M}{\eta } h^{\zeta }. $$

Hence the norm of error tends to zero as \(h\rightarrow 0\), and the order of the method is \(O(h^{\zeta })\). □

4 Results and discussion

In this section, we solve two numerical examples with the proposed methods. In addition, we compare exact and numerical solutions of examples obtained by CBS-FEM and LBS-FEM for \(M=10\) and \(h= \frac{1}{M}\). Also, we present an algorithm on the basis of our discussions to solve Volterra integro-differential equations in the complex plane.

  • Algorithm:

    Step 1. Choose M collocation points in the finite domain \(\varOmega =[0,1]\);

    Step 2. Corresponding to each node, construct a basis function \(\lbrace \phi _{i}\rbrace _{i=1}^{M}\).

    Step 3. Compute the vector F and the matrix C by (8) and (9), respectively.

    Step 4. Compute the coefficients \(\alpha _{i}\) and \(\beta _{i}\) by solving system (7).

    Step 5. Compute the approximate solution \(u_{h}\) from equation (5).

Also, we show the ability and effectiveness of our method by obtaining the absolute error for the modules of \(u(x)\) as

$$ \vert \mathrm{error} \vert = \sqrt{ (\operatorname{Re}u- \operatorname{Re}u_{h} )^{2} + (\operatorname{Im}u - \operatorname{Im}u_{h} )^{2}}. $$

All the solutions are obtained by using symbolic computation software Maple 16 on a machine with Intel Core i5 Duo processor 2.6 GHz and 4 GB RAM.

Example 4.1

Consider the following linear complex Volterra integro-differential equation:

$$\begin{aligned} -u''(x)+u'(x)+2 u(x) = f(x) + \mathsf{i} \int _{0}^{x} x t u(t)\,dt, \quad 0< x\leq 1, \end{aligned}$$

where \(f(x)=f_{1} (x)+\mathsf{i}f_{2} (x)\), and

$$\begin{aligned} &f_{1} (x) = -11 \cos ( 3 x ) +1+\cos ( 3 ) +3 \sin ( 3 x ) -2 \bigl( 1-\cos ( 3 ) \bigr) x \\ &\hphantom{f_{1} (x) =}{} + \frac{1}{12} x \bigl( 4 \sin ( 2 ) {x}^{3}+6 \cos ( 2 x ) x-3 \sin ( 2 x ) \bigr), \\ &f_{2} (x) = -6 \sin ( 2 x ) +\sin ( 2 ) -2 \cos ( 2 x ) -2 \bigl( 1- \sin ( 2 ) \bigr) x+{\frac{17 x}{9}} \\ &\hphantom{f_{2} (x) =} {}- \frac{1}{3} \cos ( 3 ) {x}^{4}+ \frac{1}{3} {x} ^{4} + \frac{1}{3} \sin ( 3 x ) {x}^{2}- \frac{1}{2} {x}^{3}+\frac{1}{9} \cos ( 3 x ) x. \end{aligned}$$

The exact solution is \(u(x) = 1-\cos (3x) + \mathsf{i} (x-\sin (2x))\).

At first, transformation formulas should be used to convert the inhomogeneous boundary conditions to homogeneous boundary conditions. Diagrams of exact and numerical solutions and the graph of error for Example 4.1 with the cubic B-spline finite element method is showed in Fig. 1. Also, the comparison between exact and numerical solutions for \(M=10\) and \(M=20\) in Example 4.1 are presented in Tables 1 and 2, respectively.

Figure 1
figure 1

Diagrams of exact and numerical solutions and graph of error for modules of Example 4.1 with cubic B-spline finite element method for \(M=10\)

Figure 2
figure 2

Diagrams of exact and numerical solutions and graph of error for modules of Example 4.1 with cubic B-spline finite element method for \(M=20\)

Table 1 Comparison of exact and numerical solutions for Example 4.1
Table 2 Comparison of exact and numerical solutions for Example 4.1, \(M=20\)

Example 4.2

In this example, we consider the following linear Volterra integro-differential equation:

$$\begin{aligned} -u''(x)+ \sin (x) u'(x)+ x u(x) = f(x) + \mathsf{i} \int _{0}^{x} (x-t) u(t)\,dt,\quad 0< x\leq 1, \end{aligned}$$

where \(f(x)=f_{1} (x)+\mathsf{i}f_{2} (x)\) and

$$\begin{aligned} &f_{1} (x) = \frac{1}{12} \bigl( ( -6 x+4 ) \sinh ( 1 ) +3 \bigl( {\mathrm{e}^{-1}}+\mathrm{e} \bigr) ( x-1 ) \bigr) \sin ( 1 ) \\ &\hphantom{f_{1} (x) =}{} + \frac{1}{12} \bigl( \bigl( -12 {x}^{2}-12 \sin ( x ) \bigr) \sinh ( 1 ) + ( 3 x-6 ) {\mathrm{e}^{-1}}-3 x \mathrm{e} \bigr) \cos ( 1 ) \\ & \hphantom{f_{1} (x) =}{}+ \frac{1}{12} \bigl( 12 x\cos ( x ) +12 \bigl( \cos ( x ) \bigr) ^{2}-12 \bigr) \sinh ( x ) \\ &\hphantom{f_{1} (x) =}{} + \sin ( x ) \cosh ( x ) \cos ( x ) +2 \sin ( x ) \cosh ( x ) + \frac{1}{2} , \\ &f_{2} (x) = \frac{1}{12} \bigl( ( 6 x-4 ) \sinh ( 1 ) -3 \bigl( {\mathrm{e}^{-1}}+\mathrm{e} \bigr) ( x-1 ) \bigr) \cos ( 1 ) \\ & \hphantom{f_{2} (x) =}{}+\frac{1}{12} \bigl( \bigl( -12 {x}^{2}-12 \sin ( x ) \bigr) \sinh ( 1 ) + ( 3 x-6 ) {\mathrm{e}^{-1}}-3 x \mathrm{e} \bigr) \sin ( 1 ) \\ &\hphantom{f_{2} (x) =}{} +\frac{1}{12} \bigl( -12 \bigl( \cos ( x ) \bigr) ^{2}-24 \cos ( x ) +12 \bigr) \cosh ( x ) \\ &\hphantom{f_{2} (x) =}{} +\sin ( x ) \sinh ( x ) x+\sin ( x ) \sinh ( x ) \cos ( x ) + \frac{x}{2}. \end{aligned}$$

The exact solution is \(u(x) = \cos (x) \sinh (x) + \mathsf{i} (\sin (x) \sinh (x))\).

For \(M=10\) and \(M=20\), the results obtained by using CBS-FEM and LBS-FEM are presented in Tables 3 and 4 and Fig. 3.

Figure 3
figure 3

Diagrams of exact and numerical solutions and graph of error for modules of Example 4.2 with cubic B-spline finite element method for \(M=10\)

Figure 4
figure 4

Diagrams of exact and numerical solutions and graph of error for modules of Example 4.2 with cubic B-spline finite element method for \(M=20\)

Table 3 Comparison of exact and numerical solutions for Example 4.2
Table 4 Comparison of exact and numerical solutions for Example 4.2, \(M=20\)

5 Conclusions

In this work, we used the linear B-spline finite element method (LBS-FEM) and cubic B-spline finite element method (CBS-FEM) for solving and obtaining numerical solutions of Volterra integro-differential equations in the complex plane. So far, there are no any publications in this field in the complex plane by using the finite element method. The main purpose of this paper is to use the finite element method to find an approximate solution of (1). To this end, we must obtain a weak and variational form of equation (1). Also, the error and convergence of the method are discussed. The order of convergence is computed, and we showed that it is \(O(h^{\zeta })\). Furthermore, the efficiency of the proposed method is shown by two numerical examples. The paper concludes by tables and figures, which indicate the results in diagrams of exact and numerical solutions, and the graphs of errors for these examples with cubic B-spline finite element method.