1 Introduction

The well-known regularized long-wave (RLW) equation

$$\begin{aligned} u_t-u_{xxt}+u_x+uu_x=0, \end{aligned}$$
(1.1)

and its counterpart, the Korteweg–de Vries (KdV) equation

$$\begin{aligned} u_t+u_{xxx}+u_x+ uu_x=0, \end{aligned}$$
(1.2)

were both proposed as model problems for long waves in nonlinear dispersive media. Equation (1.1) was originally introduced to describe the behavior of the undular bore (Peregrine 1966). It has also been derived from the study of water waves and ion acoustic plasma waves. An analytical solution for the RLW equation was found under the restricted initial and boundary conditions in Benjamin et al. (1972). The same for the KdV equation, it is found naturally il all kinds of models. Among them, there are internal gravity waves in a stratified fluid (highly relevant for geophysics), waves in an astrophysical plasma, electrical transmission line behavior and even blood pressure. Waves-soliton solutions of the KdV equation explain why our pulse, coming from a localized pressure wave in our arteries, is detectable all over our body and persists despite changes in local conditions and artery geometry in the circulation system.

In the recent years, several numerical methods for the solution of the RLW equation have been developed, including the finite difference (FD) method (Kutluay and Esen 2006; Berikelashvili and Mirianashvili 2011; Rashid 2005; Talha et al. 2006), the Fourier pseudospectral (PS) method (Guo and Cao 1988), the B-spline finite element method (FEM), Sinc-collocation techniques (Saka and Dag 2008; Gardner et al. 1997; Mokhtari and Mohammadi 2010) and the variational iteration method (VIM) (Manel and Khaled 2011). Furthermore, focusing on a meshless context, Shokri and Dehghan (2010) presented an approach for solving the RLW equation with radial basis functions (RBFs). In addition, Islam et al. (2009) also applied a meshfree method for solving problem (1.1). Achouri and Omrani (2010) proposed some numerical simulation of the modified RLW equation by the homotopy perturbation method (HPM). The RLW and Rosenau–Kawahara–RLW equations were well studied numerically in the literature. Readers can refer to Dehghan et al. (2015), Dehghan and Salehi (2011), Ayadi and Mohamed (2013), Ahlem and Tlili (2016), He (2016), and Dongdong and Kejia (2015).

In this work, we establish a high-order conservative difference scheme for a model of nonlinear dispersive equations: RLW–KdV and prove that the scheme is unconditionally stable and convergent with the convergence of \(O(h^4+k^2)\) in the discrete \(L^\infty \)-norm. Therefore, we shall approximate numerically, by a periodic code, solutions of the initial-value problem that decay to zero as \(|x|\rightarrow \infty \). Such solutions include the solitary waves of RLW–KdV equation on the real line and by products of their interactions. Hence, by taking the interval \([-L, L]\) large enough in each numerical experiment, so that the solution remains sufficiently small at the endpoints, we can approximate in a satisfactory manner the generation and interaction of real line solitary waves for finite time intervals.

We consider the initial value and 2L-periodic boundary value problems for the RLW–KdV equation; thus we seek a real-valued function u(xt), 2L-periodic in x, that satisfies

$$\begin{aligned} u_t-u_{xxt}+\alpha u_{xxx}+u_x+\beta uu_x= & {} 0, \quad (x,t)\in \Omega \times [0,T], \end{aligned}$$
(1.3)
$$\begin{aligned} u(x,0)= & {} u_0(x),\quad x\in \bar{\Omega }, \end{aligned}$$
(1.4)

where \(u_0\) is a given smooth 2L-periodic function on \(\Omega =(-L, L)\), describing the initial form of the wave, \(0<T<\infty , \alpha \) and \(\beta \) are given real constants.

Computing the inner product of (1.3) with 2u, the conservation law is obtained as:

$$\begin{aligned} \forall t\in [0,T],\,\, E(t)= & {} ||u(\cdot ,t)||_{L^2}^2+||u_x(\cdot ,t)||_{L^2}^2\nonumber \\= & {} ||u_0||^2_{L^2}+||(u_{0})_x||^2_{L^2}=E(0). \end{aligned}$$
(1.5)

The remainder of the present paper is arranged as follows: in Sect. 2, a nonlinear conservative difference scheme is derived. The discrete conservation laws of the difference scheme are discussed in Sect. 3. In Sect. 4, some priori estimates for numerical solutions are given. In Sect. 5, existence and uniqueness are shown. The \(L^{\infty }\)-convergence for the difference scheme is proved in Sect. 6. In the last section, some numerical experiments are given to justify our theoretical results.

Throughout this article, C represents a generic positive constant which is independent of the discretization parameters h and k, but it can have different values at different places.

2 High-order conservative difference scheme

In this section, we propose a two-level nonlinear Crank–Nicolson finite difference scheme for the problem (1.1)–(1.3). For convenience, the following notations are used. For a positive integer N, let the time-step \(k = \frac{T}{N} , t^n = nk, n = 0,1,\dots ,N\) and for a positive integer J such that \(J \ge 6\), let space-step \(h=\frac{2L}{J}, x_j=-L+jh, j=0,\dots , J\), and let

$$\begin{aligned} \mathbb {R}_{per}^J=\{V=(V_j)_{\,j \in \mathbb {Z}}/ V_j\in \mathbb {R}\quad \text{ and } \quad V_{j+J}=V_j, \quad j\in \mathbb {Z}\}. \end{aligned}$$

For a function \(V^n\in \mathbb {R}^n_{per}\) define the difference operators as:

$$\begin{aligned} ( V_j^n)_x= & {} \frac{V^n_{j+1}-V_{j}^n}{h}, \quad (V_j^n)_{\bar{x}}=\frac{V^n_{j}-V_{j-1}^n}{h},\quad ( V_j^n)_{\hat{x}}=\frac{V^n_{j+1}-V_{j-1}^n}{2h},\\ ( V_j^n)_{{\mathop {x}\limits ^{..}}}= & {} \frac{V^n_{j+2}-V_{j-2}^n}{4h}, \quad (V_j^n)_t=\frac{V^{n+1}_{j}-V_{j}^n}{k}, \quad V_j^{n+\frac{1}{2}}=\frac{V^{n+1}_{j}+V_{j}^n}{2}. \end{aligned}$$

For any functions \(V^n,W^n\in \mathbb {R}_{per}^J\), we present the discrete \(L^2\) inner product in \(\mathbb {R}_{per}^{J}\).

$$\begin{aligned} \big <V^n,W^n\big >= h\sum \limits _{j=1}^{J}V^n_jW^n_j. \end{aligned}$$

The discrete \(L^2\)-norm \(||V^n||\), the discrete semi-norms \(||V_x^n||, ||V_{\hat{x}}^n||, ||V_{{\mathop {x}\limits ^{..}}}^n||, ||V_{\overline{x}}^n||\) and the discrete \(L^{\infty }\)-norm \(||V^n||_{\infty }\) are defined, respectively, as follows:

$$\begin{aligned} ||V^n||= & {} \sqrt{h\sum \limits _{j=1}^{J}\big (V_j^n\big )^2}, \quad ||V^n_x||=\sqrt{h\sum \limits _{j=1}^{J}\Big ( (V^n_j)_{x}\Big )^2}, \quad ||V^n_{\hat{x}}||=\sqrt{h\sum \limits _{j=1}^{J}\Big ( (V^n_j)_{\hat{x}}\Big )^2},\\ ||V^n_{{\mathop {x}\limits ^{..}}}||= & {} \sqrt{h\sum \limits _{j=1}^{J} \Big ((V^n_j)_{{\mathop {x}\limits ^{..}}}\Big )^2}, \quad ||V^n_{\bar{x}}||=\sqrt{h\sum \limits _{j=1}^{J} \Big ((V^n_j)_{\bar{x}}\Big )^2}, \quad ||V^n||_{\infty }=\max _{1\le j\le J}|V^n_j|. \end{aligned}$$

Denote as \(H^m_{per}(\Omega )\) the periodic Sobolev space of order m. We discretize the problem (1.3)–(1.4) by the following Crank–Nicolson type finite difference scheme where we approximate \(u_j^n\in \mathbb {R}_{per}^{J}, u_j^n:=u(x_j,t_n)\), by \(U_j^n\in \mathbb {R}_{per}^{J}\).

$$\begin{aligned}&(U^n_j)_t-\frac{4}{3}(U_j^n)_{x\bar{x}t}+\frac{1}{3}(U_j^n)_{\hat{x}\hat{x}t}+\frac{3\alpha }{2}\left( U^{n+\frac{1}{2}}_j\right) _{x\bar{x}\hat{x}}-\frac{\alpha }{2}\left( U^{n+\frac{1}{2}}_j\right) _{x\bar{x}{\mathop {x}\limits ^{..}}}\nonumber \\&\quad +\frac{4}{3}\left( U_j^{n+\frac{1}{2}}\right) _{\hat{x}}-\frac{1}{3}\left( U_j^{n+\frac{1}{2}}\right) _{{\mathop {x}\limits ^{..}}}\nonumber \\&\quad +\frac{4}{3}\varphi _1\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right) -\frac{1}{3} \varphi _2\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right) =0 , \quad j=1,\dots ,J,\quad n=0,\dots N-1,\nonumber \\ \end{aligned}$$
(2.1)
$$\begin{aligned}&U_{j}^n=U^n_{j+J},\quad j=1,\dots , J, \quad \,n=0,\dots ,N, \end{aligned}$$
(2.2)
$$\begin{aligned}&U_j^0=u_0(x_j),\quad j=1,\dots , J, \end{aligned}$$
(2.3)

where

$$\begin{aligned} \varphi _1\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right)= & {} \frac{\beta }{3} \left\{ \left( U_j^{n+\frac{1}{2}}\right) \left( U_j^{n+\frac{1}{2}}\right) _{\hat{x}}+\left[ \left( U_j^{n+\frac{1}{2}}\right) ^{2}\right] _{\hat{x}}\right\} ,\end{aligned}$$
(2.4)
$$\begin{aligned} \varphi _2\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right)= & {} \frac{\beta }{3} \left\{ \left( U_j^{n+\frac{1}{2}}\right) \left( U_j^{n+\frac{1}{2}}\right) _{{\mathop {x}\limits ^{..}}}+\left[ \left( U_j^{n+\frac{1}{2}}\right) ^{2}\right] _{{\mathop {x}\limits ^{..}}}\right\} . \end{aligned}$$
(2.5)

Next, we need the following lemma, which is a consequence of the well-known formulas of summations by parts and related periodicity conditions.

Lemma 1

For any discrete functions \(V,W\in \mathbb {R}_{per}^{J}\) we have:

$$\begin{aligned} \big< V_x,W\big>= & {} -\big <V,W_{\bar{x}}\big >, \end{aligned}$$
(2.6)
$$\begin{aligned} \big<V_{\hat{x}},W\big>= & {} -\big <V,W_{\hat{x}}\big > , \end{aligned}$$
(2.7)
$$\begin{aligned} \big<V_{{\mathop {x}\limits ^{..}}},W\big>= & {} -\big <V,W_{{\mathop {x}\limits ^{..}}}\big >, \end{aligned}$$
(2.8)
$$\begin{aligned} \big < V_{x\bar{x}},V\big >= & {} -||V_x||^2, \end{aligned}$$
(2.9)
$$\begin{aligned} \big < V_{\hat{x}\hat{x}},V\big >= & {} -||V_{\hat{x}}||^2, \end{aligned}$$
(2.10)
$$\begin{aligned} \big < V_{\hat{x}},V\big >= & {} 0, \end{aligned}$$
(2.11)
$$\begin{aligned} \big < V_{{\mathop {x}\limits ^{..}}},V\big >= & {} 0, \end{aligned}$$
(2.12)
$$\begin{aligned} \big < V_{x\bar{x}\hat{x}},V\big >= & {} 0, \end{aligned}$$
(2.13)
$$\begin{aligned} \big < V_{x\bar{x}{\mathop {x}\limits ^{..}}},V\big >= & {} 0, \end{aligned}$$
(2.14)
$$\begin{aligned} \big < \varphi _1(V,V),V\big >= & {} 0, \end{aligned}$$
(2.15)
$$\begin{aligned} \big < \varphi _2(V,V),V\big >= & {} 0. \end{aligned}$$
(2.16)

The following Lemma will be used frequently in this paper.

Lemma 2

For any discrete function \(V\in \mathbb {R}_{per}^{J}\)

$$\begin{aligned} ||V_{{\mathop {x}\limits ^{..}}}||^2\le ||V_{\hat{x}}||^2\le ||V_{x}||^2. \end{aligned}$$
(2.17)

Proof

From the properties of finite differences and the boundary conditions (2.2), we obtain

$$\begin{aligned} ||V_x||^2=||V_{\bar{x}}||^2. \end{aligned}$$
(2.18)

From summation by parts, we obtain for \(V\in \mathbb {R}^J_{per}\)

$$\begin{aligned} ||V_{\hat{x}}||^2&=h\sum \limits ^{J}_{j=1}\Big (\frac{V_{j+1}-V_{j-1}}{2h}\Big )^2\\&=h\sum \limits ^{J}_{j=1}\Big (\frac{V_{j+1}-V_{j}}{2h}+\frac{V_{j}-V_{j-1}}{2h}\Big )^2\\&\le 2h\sum \limits ^{J}_{j=1}\Big (\frac{V_{j+1}-V_{j}}{2h}\Big )^2+2h\sum \limits ^{J}_{j=1}\Big (\frac{V_{j}-V_{j-1}}{2h}\Big )^2\\&=\frac{1}{2}||V_x||^2+\frac{1}{2}||V_{\bar{x}}||^2. \end{aligned}$$

It follows from (2.18) that

$$\begin{aligned} ||V_{\hat{x}}||^2\le ||V_x||^2. \end{aligned}$$
(2.19)

Similarly for \(V\in \mathbb {R}^J_{per}\), we have

$$\begin{aligned} ||V_{{\mathop {x}\limits ^{..}}}||^2&=h\sum \limits ^{J}_{j=1}\Big (\frac{V_{j+2}-V_{j-2}}{4h}\Big )^2\\&=h\sum \limits ^{J}_{j=1}\Big (\frac{V_{j+2}-V_{j}}{4h}+\frac{V_{j}-V_{j-2}}{4h}\Big )^2\\&\le 2h\sum \limits ^{J}_{j=1}\Big (\frac{V_{j+2}-V_{j}}{4h}\Big )^2+2h\sum \limits ^{J}_{j=1}\Big (\frac{V_{j}-V_{j-2}}{4h}\Big )^2\\&=\frac{1}{2}||V_{\hat{x}}||^2+\frac{1}{2}||V_{\hat{x}}||^2\\&=||V_{\hat{x}}||^2. \end{aligned}$$

This, together with (2.19), gives (2.17). \(\square \)

3 Discrete conservative laws

We can show here that the difference scheme (2.1)–(2.3) has the property of conservation of mass and energy.

3.1 Conservation of mass

Theorem 1

Let \(U^n\) be a solution of (2.1)–(2.3). Then the conservation of mass holds:

$$\begin{aligned} Q^n=Q^{n-1}=\cdots =Q^0, \end{aligned}$$
(3.1)

where \(Q^n=\sum \nolimits _{j=1}^{J} U_j^n\).

Proof

Multiplying (2.1) by h and summing from \(j=1,\dots ,J\), in view of difference properties and the boundary conditions (2.2) we obtain

$$\begin{aligned} h\sum \limits _{j=1}^{J}\left( {U^{n+1}_j-U^n_j}\right) =0. \end{aligned}$$
(3.2)

Thus, (3.1) holds. \(\square \)

3.2 Conservation of energy

Theorem 2

The difference scheme (2.1) admits the following invariant

$$\begin{aligned} \mathcal {E}^n=\mathcal {E}^{n-1}=\cdots =\mathcal {E}^0, \end{aligned}$$
(3.3)

where \(\mathcal {E}^n=||U^n||^2+\frac{4}{3}||U^n_{x}||^2-\frac{1}{3}||U^n_{\hat{x}}||^2\).

Proof

Taking the inner product of (2.1) with \(2\, U^{n+\frac{1}{2}}\), according to periodic boundary condition and Lemma 1, we have

$$\begin{aligned} \big (||U^n||^2\big )_{t}+\frac{4}{3} \big (|| U^n_x||^2\big )_t-\frac{1}{3} \big (|| U^n_{\hat{x}}||^2\big )_t=0. \end{aligned}$$

Therefore,

$$\begin{aligned} \left( ||U^{n+1}||^2-||U^{n}||^2\right) +\frac{4}{3}\left( ||U^{n+1}_x||^2-||U^{n}_x||^2\right) -\frac{1}{3}(||U^{n+1}_{\hat{x}}||^2-||U^{n}_{\hat{x}}||^2)=0. \end{aligned}$$

This completes the proof. \(\square \)

4 A priori estimates for the difference scheme solution

Lemma 3

(Discrete Sobolev’s inequality Zhou 1990) There exist two constants \(C_1\) and \(C_2\) such that

$$\begin{aligned} ||U^n||_{\infty }\le C_1||U^n||+C_2||U^n_x||. \end{aligned}$$
(4.1)

Theorem 3

Suppose that \(u_0\in H^1_{per}(\Omega )\). Then the solution of the difference scheme (2.1)–(2.3) is estimated as follows:

$$\begin{aligned} ||U^{n}||_{\infty }\le C, \end{aligned}$$
(4.2)

where C is a positive constant independent of h and k.

Proof

It follows from Theorem 2 and Lemma 2 that

$$\begin{aligned} ||U^n||^2+||U^n_{x}||^2\le & {} \mathcal {E}^n=||U^n||^2+\frac{4}{3}||U^n_{x}||^2-\frac{1}{3}||U^n_{\hat{x}}||^2\\= & {} ||U^0||^2+\frac{4}{3}||U^0_{x}||^2-\frac{1}{3}||U^0_{\hat{x}}||^2\le C\left( ||U^0||^2+||U^0_{x}||^2\right) . \end{aligned}$$

Thus,

$$\begin{aligned} ||U^n||\le C,\,\quad ||U^n_{x}||\le C. \end{aligned}$$

Applying Lemma 3, we obtain that

$$\begin{aligned} ||U^{n}||_{\infty }\le C. \end{aligned}$$

\(\square \)

5 Existence and uniqueness

5.1 Existence

To demonstrate the existence of the approximate solution \(U^1, U^2, \dots U^N\) for the difference scheme (2.1)–(2.3), we shall use the following Brouwer fixed point theorem the proof of which is in Browder (1965).

Lemma 4

Let H be a finite dimensional Hilbert space with inner product \(\big <\cdot \,,\,\cdot \big>\) and induced norm \(||\cdot ||\). Further, let g be a continuous mapping from H to it self and be such that \(\big <g(\chi ),\chi \big>>0\) for all \(\chi \in H\) with \(||\chi ||=\lambda >0\). Then there exists \(\chi ^*\in H\) with \(||\chi ^*||\) such that \(g(\chi ^*)=0.\)

Theorem 4

The approximate solution of the difference scheme (2.1)–(2.3) exists.

Proof

To prove the theorem by mathematical induction, we assume that \(U^0, U^1, \dots , U^n\) exist. For a fixed n,  it follows that the difference scheme (2.1)–(2.3) can be written as:

$$\begin{aligned}&2\left( U_j^{n+\frac{1}{2}}-U_j^{n}\right) -\frac{8}{3}\left( U_j^{n+\frac{1}{2}}-U_j^{n}\right) _{x\bar{x}}+\frac{2}{3}\left( U_j^{n+\frac{1}{2}}-U_j^{n}\right) _{\hat{x}\hat{x}}\nonumber \\&\quad +\frac{3k\alpha }{2}\left( U_j^{n+\frac{1}{2}}\right) _{x\bar{x}\hat{x}}-\frac{k\alpha }{2}\left( U_j^{n+\frac{1}{2}}\right) _{x\bar{x}{\mathop {x}\limits ^{..}}}+ \frac{4k}{3}\left( U_j^{n+\frac{1}{2}}\right) _{\hat{x}}\\&\quad -\frac{k}{3}\left( U_j^{n+\frac{1}{2}}\right) _{{\mathop {x}\limits ^{..}}} +\frac{4k}{3}\varphi _1\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right) -\frac{k}{3} \varphi _2\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right) =0,\quad \, j=1,\dots ,J. \end{aligned}$$

Let \(g:\mathbb {R}_{per}^{J}\longrightarrow \mathbb {R}_{per}^{J} \) defined by:

$$\begin{aligned} g(V)= & {} 2(V-U^{n})-\frac{8}{3}(V-U^{n})_{x\bar{x}}+\frac{2}{3}(V-U^{n})_{\hat{x}\hat{x}}+\frac{3k\alpha }{2} V_{x\bar{x}\hat{x}}- \frac{k\alpha }{2} V_{x\bar{x}{\mathop {x}\limits ^{..}}}\nonumber \\&+\frac{4k}{3}V_{\hat{x}}-\frac{k}{3}V_{{\mathop {x}\limits ^{..}}}+\frac{4k}{3}\varphi _1(V,V)-\frac{k}{3}\varphi _2(V,V). \end{aligned}$$
(5.1)

Then, the map g acts on a finite dimensional space and each of its components is quadratic in the components of V (h is fixed). Thus, g is continuous.

Taking the inner product of (5.1) with V and using Lemma 1 we obtain:

$$\begin{aligned} \big<g(V),V\big>=2||V||^2-2\big<U^n,V\big>+\frac{8}{3}||V_x||^2-\frac{8}{3}\big<U^n_x,V_x\big>-\frac{2}{3}||V_{\hat{x}}||^2 +\frac{2}{3}\big <U^n_{\hat{x}},V_{\hat{x}}\big >. \end{aligned}$$

It follows from Lemma 2 and Young’s inequality that

$$\begin{aligned} \big <g(V),V\big >\ge & {} 2||V||^2-\big ( ||U^n||^2+||V||^2\big )+\frac{8}{3}||V_x||^2-\frac{4}{3}\big (||U^n_x||^2+||V_x||^2\big )-\frac{2}{3}||V_{\hat{x}}||^2 \\&-\frac{1}{3}\big (||U^n_{\hat{x}}||^2+||V_{\hat{x}}||^2\big )\\\ge & {} ||V||^2-||U^n||^2+\frac{1}{3}||V_x||^2-\frac{4}{3}||U^n_x||^2-\frac{1}{3}||U^n_{\hat{x}}||^2\\\ge & {} ||V||^2-\left( ||U^n||^2+\frac{4}{3}||U^n_x||^2+\frac{1}{3}||U^n_{\hat{x}}||^2\right) . \end{aligned}$$

Hence for \(||V||^2= ||U^n||^2+\frac{4}{3}||U^n_x||^2+\frac{1}{3}||U^n_{\hat{x}}||^2+1\), obviously \(\big <g(V),V\big> >0\) and from Lemma 4 we deduce the existence of \( V^*\in \mathbb {R}_{per}^{J}\) such that \(g(V^*)=0\). It is easily seen that \(U^{n+1}=2V^*-U^n\) satisfies the difference scheme (2.1)–(2.3). \(\square \)

5.2 Uniqueness

Below, the following lemma will be required to show the uniqueness of the approximate solution of the difference scheme (2.1)–(2.3).

Lemma 5

For any two mesh functions \(X,Y\in \mathbb {R}^{J}_{per}\), if \(||X||_{\infty }\) is bounded then there exists a positive constant C such that

$$\begin{aligned} |\big <\varphi _1(X,X)-\varphi _1(Y,Y),X-Y\big >|\le & {} C\big (||X-Y||^2+||X-Y||_{\hat{x}}^2\big ), \end{aligned}$$
(5.2)
$$\begin{aligned} |\big <\varphi _2(X,X)-\varphi _2(Y,Y),X-Y\big >|\le & {} C\big (||X-Y||^2+||X-Y||_{{\mathop {x}\limits ^{..}}}^2\big ). \end{aligned}$$
(5.3)

Proof

Let \(Z=X-Y, X^2-Y^2=(X-Y)(X+Y)=2XZ-Z^2\). Noting

$$\begin{aligned} \big<(X^2)_{\hat{x}}-(Y^2)_{\hat{x}},Z\big>=2\big<(XZ)_{\hat{x}},Z\big>-\big <(Z^2)_{\hat{x}},Z\big >, \end{aligned}$$

and

$$\begin{aligned} \big<X(X)_{\hat{x}}-Y(Y)_{\hat{x}},Z\big>=-\big<Z(Z)_{\hat{x}},Z\big>+\big<Z(X)_{\hat{x}},Z\big>+\big <X(Z)_{\hat{x}},Z\big >. \end{aligned}$$

Consequently,

$$\begin{aligned} \big<\varphi _1(X,X)-\varphi _1(Y,Y),Z\big>=-\big<\varphi _1(Z,Z),Z\big>-\frac{\beta }{3}\big<X(Z)_{\hat{x}},Z\big>+\frac{\beta }{3}\big <Z(X)_{\hat{x}},Z\big >. \end{aligned}$$
(5.4)

Since \(||X||_{\infty }\) is bounded, then there exists constant C such that

$$\begin{aligned} -\big <X(Z)_{\hat{x}},Z\big >\le C||Z_{\hat{x}}||\,.\,||Z||. \end{aligned}$$
(5.5)

From proprieties of finite differences and periodic boundary conditions, we have

$$\begin{aligned} \big <Z(X)_{\hat{x}},Z\big >&=h\sum \limits _{j=1}^{J}Z_j^2(X_j)_{\hat{x}}\\&=-h\sum \limits _{j=1}^{J}X_j(Z_j^2)_{\hat{x}}\\&=-h\sum \limits _{j=1}^{J}X_j(Z_{j+1}+Z_{j-1})(Z_j)_{\hat{x}}. \end{aligned}$$

Similarly, using the boundedness of \(||X||_{\infty }\) we easily derive the following estimate

$$\begin{aligned} \big <Z(X)_{\hat{x}},Z\big >\,\le C ||Z_{{\hat{x}}} ||. ||Z||. \end{aligned}$$
(5.6)

Substituting (5.5) and (5.6) into (5.4) and using (2.15), we get

$$\begin{aligned} |\big <\varphi _1(X,X)-\varphi _1(Y,Y),X-Y\big >|\le C\big (||X-Y||^2+||X-Y||_{\hat{x}}^2\big ). \end{aligned}$$

Similarly we have

$$\begin{aligned} |\big <\varphi _2(X,X)-\varphi _2(Y,Y),X-Y\big > |\le C\big (||X-Y||^2+||X-Y||_{{\mathop {x}\limits ^{..}}}^2\big ). \end{aligned}$$

This completes the proof. \(\square \)

Lemma 6

(Discrete Gronwall inequality Zhou 1990) Assume \(\{G^n/ n\ge 0\}\) is a non-negative sequence and satisfies

$$\begin{aligned} G^0\le A,\quad G^n\le A+Bk\sum \limits _{i=0}^{n-1}G^i \quad n=1, 2, \dots , \end{aligned}$$

where A and B are non-negative constants. Then G satisfies

$$\begin{aligned} G^n\le Ae^{Bnk},\quad n=0,1,2,\dots . \end{aligned}$$

Theorem 5

Suppose that \(u_0\in H^1_{per}(\Omega )\). For k sufficiently small, the approximate solution \(U^n\) of (2.1)–(2.3) is unique.

Proof

We suppose that \(V^0=u_0\) and let \(V^n\) be another solution of (2.1)–(2.3). That is \(V^n\) satisfies

$$\begin{aligned}&(V^n_j)_t-\frac{4}{3}(V_j^n)_{x\bar{x}t}+\frac{1}{3}(V_j^n)_{\hat{x}\hat{x}t}+\frac{3\alpha }{2}\left( V_j^{n+\frac{1}{2}}\right) _{x\bar{x}\hat{x}}\nonumber \\&\quad -\frac{\alpha }{2}\left( V_j^{n+\frac{1}{2}}\right) _{x\bar{x}{\mathop {x}\limits ^{..}}} +\frac{4}{3}\left( V_j^{n+\frac{1}{2}}\right) _{\hat{x}}-\frac{1}{3}\left( V_j^{n+\frac{1}{2}}\right) _{{\mathop {x}\limits ^{..}}}\nonumber \\&\quad +\frac{4}{3}\varphi _1\left( V_j^{n+\frac{1}{2}},V_j^{n+\frac{1}{2}}\right) -\frac{1}{3} \varphi _2\left( V_j^{n+\frac{1}{2}},V_j^{n+\frac{1}{2}}\right) =0,\quad j=1, \dots , J, \quad \nonumber \\&\quad n=0, \dots , N-1. \end{aligned}$$
(5.7)

Let \(E^n=U^n-V^n\), where \(n=0, \dots , N\). Then using (2.1) and (5.7), we get

$$\begin{aligned}&(E^n_j)_t-\frac{4}{3}(E_j^n)_{x\bar{x}t}+\frac{1}{3}(E_j^n)_{\hat{x}\hat{x}t}+\frac{3\alpha }{2}\left( E_j^{n+\frac{1}{2}}\right) _{x\bar{x}\hat{x}}\nonumber \\&\quad -\frac{\alpha }{2}\left( E_j^{n+\frac{1}{2}}\right) _{x\bar{x}{\mathop {x}\limits ^{..}}} +\frac{4}{3}\left( E_j^{n+\frac{1}{2}}\right) _{\hat{x}}- \frac{1}{3}\left( E_j^{n+\frac{1}{2}}\right) _{{\mathop {x}\limits ^{..}}}\nonumber \\&\quad +\frac{4}{3}\Bigg [\varphi _1\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right) -\varphi _1\left( V_j^{n+\frac{1}{2}},V_j^{n+\frac{1}{2}}\right) \Bigg ]\nonumber \\&\quad -\frac{1}{3} \Bigg [\varphi _2\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right) -\varphi _2\left( V_j^{n+\frac{1}{2}},V_j^{n+\frac{1}{2}}\right) \Bigg ]=0. \end{aligned}$$
(5.8)

Taking in (5.8) the inner product with \(2E^{n+\frac{1}{2}}\) and using Lemma 1, we have

$$\begin{aligned}&||E^n||^2_t+\frac{4}{3} ||E^n_{x}||^2_t-\frac{1}{3}|| E^n_{\hat{x}}||^2_t+\frac{8}{3}\Bigg<\varphi _1\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right) -\varphi _1\left( V_j^{n+\frac{1}{2}},V_j^{n+\frac{1}{2}}\right) ,E^{n+\frac{1}{2}}\Bigg>\nonumber \\&\quad -\frac{2}{3}\Bigg <\varphi _2\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right) -\varphi _2\left( V_j^{n+\frac{1}{2}},V_j^{n+\frac{1}{2}}\right) ,E^{n+\frac{1}{2}}\Bigg >=0. \end{aligned}$$
(5.9)

From Lemma 5 and (4.2) we get that

$$\begin{aligned} \Bigg <\varphi _1\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right) -\varphi _1\left( V_j^{n+\frac{1}{2}},V_j^{n+\frac{1}{2}}\right) ,E^{n+\frac{1}{2}}\Bigg >\le C\Bigg [||E^{n+\frac{1}{2}}||^2+||\left( E^{n+\frac{1}{2}}\right) _{\hat{x}}||^2\Bigg ].\nonumber \\ \end{aligned}$$
(5.10)

Similarly, we have that

$$\begin{aligned} \Bigg <\varphi _2\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right) -\varphi _2\left( V_j^{n+\frac{1}{2}},V_j^{n+\frac{1}{2}}\right) ,E^{n+\frac{1}{2}}\Bigg >\le C\Bigg [||E^{n+\frac{1}{2}}||^2+||\left( E^{n+\frac{1}{2}}\right) _{{\mathop {x}\limits ^{..}}}||^2\Bigg ].\nonumber \\ \end{aligned}$$
(5.11)

It follows from (5.9)–(5.11) that

$$\begin{aligned} ||E^n||^2_t+\frac{4}{3}||E^n_{x}||^2_t-\frac{1}{3}|| E^n_{\hat{x}}||^2_t\le C\Bigg ( ||E^{n+\frac{1}{2}}||^2+ || E^{n+\frac{1}{2}}_{\hat{x}}||^2+||E^{n+\frac{1}{2}}_{{\mathop {x}\limits ^{..}}}||^2\Bigg ). \end{aligned}$$

According to (2.17), we obtain

$$\begin{aligned}&||E^n||^2_t+\frac{4}{3} ||E^n_{x}||^2_t-\frac{1}{3} || E^n_{\hat{x}}||^2_t\nonumber \\&\quad \le C\big ( ||E^{n+1}||^2+||E^{n}||^2+ || E^{n+1}_{{x}}||^2+||E^{n}_{{x}}||^2\big ). \end{aligned}$$
(5.12)

Let \(A^n=||E^n||^2+\frac{4}{3} ||E^n_{x}||^2-\frac{1}{3} || E^n_{\hat{x}}||^2\) and summing up (5.12) from 0 to \(n-1,\) we have

$$\begin{aligned} A^n\le A^0+ Ck\sum \limits _{i=0}^{n}\Big (||E^i||^2+||E^i_x||^2\Big ). \end{aligned}$$
(5.13)

Note that from (2.17)

$$\begin{aligned} ||E^n||^2+||E^n_x||^2\le A^n=||E^n||^2+\frac{4}{3} ||E^n_{x}||^2-\frac{1}{3} || E^n_{\hat{x}}||^2. \end{aligned}$$
(5.14)

Using (5.13) and (5.14), we obtain that

$$\begin{aligned} ||E||^2+||E_x||^2\le A^0+ Ck\sum \limits _{i=0}^{n}\Big (||E^i||^2+||E^i_x||^2\Big ). \end{aligned}$$
(5.15)

Now letting \(G^n=||E^n||^2+||E^n_x||^2\) and using the above inequality, we find

$$\begin{aligned} G^n\le A^0+Ck\sum \limits _{i=0}^{n}G^i. \end{aligned}$$

Therefore,

$$\begin{aligned} (1-Ck)G^n\le A^0+Ck\sum \limits _{i=0}^{n-1}G^i. \end{aligned}$$

For k sufficiently small such that \((1-Ck) > 0\), we have

$$\begin{aligned} G^n\le C A^0+Ck\sum \limits _{i=0}^{n-1}G^i. \end{aligned}$$

Applying Lemma 6 with \( A^0 = 0\), we obtain

$$\begin{aligned} ||E^n||^2+ ||E^n_x||^2=0. \end{aligned}$$
(5.16)

This completes the proof of uniqueness of solutions for (2.1)–(2.3). \(\square \)

6 Convergence and stability of the finite difference scheme

To get the convergence of the difference scheme (2.1)–(2.3), we need the following lemma which is obtained according to Taylor expansion.

Lemma 7

For any smooth function \(\psi \), we have

$$\begin{aligned} \frac{4}{3}(\psi _j)_{\hat{x}}-\frac{1}{3}(\psi _j)_{{\mathop {x}\limits ^{..}}}= & {} \frac{\mathrm{d}\psi }{\mathrm{d}x}(x_j)+O(h^4), \end{aligned}$$
(6.1)
$$\begin{aligned} \frac{4}{3}(\psi _j)_{{x}\bar{x}}-\frac{1}{3}(\psi _j)_{\hat{x}\hat{x}}= & {} \frac{\mathrm{d}^2\psi }{\mathrm{d}x^2}(x_j)+O(h^4), \end{aligned}$$
(6.2)
$$\begin{aligned} \frac{3}{2}(\psi _j)_{{x}\bar{x}\hat{x}}-\frac{1}{2}(\psi _j)_{{x}\bar{x}{\mathop {x}\limits ^{..}}}= & {} \frac{\mathrm{d}^3\psi }{\mathrm{d}x^3}(x_j)+O(h^4). \end{aligned}$$
(6.3)

Next, we are going to show that the approximate solution of (2.1)–(2.3) converges to the exact solution \(u^n\) of (1.3)–(1.4).

Theorem 6

Suppose that the solution u(xt) of (1.3)–(1.4) belongs to \(C^{7,3}([-L,L]\times [0,T]).\) Then the solution to difference scheme (2.1)–(2.3) converges to the solution of the problem (1.3)–(1.4) in the discrete \(L^{\infty }\)-norm and the rate of convergence is of order \(O(h^4 +k^2)\) when h and k are small. More precisely, if we denote

$$\begin{aligned} e^n_j = u^n_j-U^n_j ,\quad j=1,\dots ,J,\quad n=0,\dots , N, \end{aligned}$$

then, there exists a positive constant C independent of h and k such that

$$\begin{aligned} ||e^n||_{\infty }\le C(h^4 + k^2), \quad 0\le n \le N. \end{aligned}$$

Proof

Let \(r^n\in \mathbb {R}_{per}^{J}\) be the consistency of the difference scheme (2.1)–(2.3)

$$\begin{aligned} r_j^n= & {} (u^n_j)_t-\frac{4}{3}(u_j^n)_{x\bar{x}t}+\frac{1}{3}(u_j^n)_{\hat{x}\hat{x}t} +\frac{3\alpha }{2}\left( u_j^{n+\frac{1}{2}}\right) _{x\bar{x}\hat{x}}\nonumber \\&-\frac{\alpha }{2}\left( u_j^{n+\frac{1}{2}}\right) _{x\bar{x}{\mathop {x}\limits ^{..}}} +\frac{4}{3}\left( u_j^{n+\frac{1}{2}}\right) _{\hat{x}}-\frac{1}{3}\left( u_j^{n+\frac{1}{2}}\right) _{{\mathop {x}\limits ^{..}}}\nonumber \\&+\frac{4}{3}\varphi _1\left( u_j^{n+\frac{1}{2}},u_j^{n+\frac{1}{2}}\right) -\frac{1}{3} \varphi _2\left( u_j^{n+\frac{1}{2}},u_j^{n+\frac{1}{2}}\right) ,\quad j = 1,\dots ,J, \quad n=0,\dots , N-1, \nonumber \\ \end{aligned}$$
(6.4)
$$\begin{aligned} u_{j}^n= & {} u^n_{j+J},\quad j=1,\dots , J, \quad \,n=0,\dots ,N, \end{aligned}$$
(6.5)
$$\begin{aligned} u_j^0= & {} u_0(x_j),\quad j=1,\dots , J. \end{aligned}$$
(6.6)

Using the Taylor expansion and Lemma 7, then there exists a positive constant C independent of h and k such that

$$\begin{aligned} \max _{j,n}|r_j^n|\le C(h^4+k^2). \end{aligned}$$
(6.7)

Subtracting (6.4)–(6.6) from (2.1)–(2.3), we have

$$\begin{aligned}&(e^n_j)_t-\frac{4}{3}(e_j^n)_{x\bar{x}t}+\frac{1}{3}(e_j^n)_{\hat{x}\hat{x}t}+ +\frac{3}{2}\alpha \left( e_j^{n+\frac{1}{2}}\right) _{x\bar{x}\hat{x}}\nonumber \\&\quad -\frac{\alpha }{2}\left( e_j^{n+\frac{1}{2}}\right) _{x\bar{x}{\mathop {x}\limits ^{..}}} +\frac{4}{3}\left( e_j^{n+\frac{1}{2}}\right) _{\hat{x}}-\frac{1}{3}\left( e_j^{n+\frac{1}{2}}\right) _{{\mathop {x}\limits ^{..}}}\nonumber \\&+\frac{4}{3}\left[ \varphi _1\left( u_j^{n+\frac{1}{2}},u_j^{n+\frac{1}{2}}\right) -\varphi _1\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right) \right] \nonumber \\&\quad -\frac{1}{3} \left[ \varphi _2\left( u_j^{n+\frac{1}{2}},u_j^{n+\frac{1}{2}}\right) -\varphi _2\left( U_j^{n+\frac{1}{2}},U_j^{n+\frac{1}{2}}\right) \right] =r_j^n, \nonumber \\&j = 1,\dots ,J, \quad n=0,\dots , N-1, \end{aligned}$$
(6.8)
$$\begin{aligned}&e_{j}^n=e_{j+J}^{n},\quad j=1,2,\dots , J, \quad n=0,\dots , N, \end{aligned}$$
(6.9)
$$\begin{aligned}&e_j^0=0, \quad j=1,2,\dots , J. \end{aligned}$$
(6.10)

Taking the inner product of (6.8) with \(2e^{n+\frac{1}{2}}\) and using Lemma 1, we get

$$\begin{aligned}&|| e^n||^2_t+\frac{4}{3} ||e^n_{{x}}||^2_t-\frac{1}{3} || e^n_{\hat{x}}||^2_t+\frac{8}{3} \big< \varphi _1\left( u^{n+\frac{1}{2}},u^{n+\frac{1}{2}}\right) -\varphi _1\left( U^{n+\frac{1}{2}},U ^{n+\frac{1}{2}}\right) ,e^{n+\frac{1}{2}}\big>\nonumber \\&\quad -\frac{2}{3}\big< \varphi _2\left( u^{n+\frac{1}{2}},u^{n+\frac{1}{2}}\right) -\varphi _2\left( U^{n+\frac{1}{2}},U ^{n+\frac{1}{2}}\right) ,e^{n+\frac{1}{2}}\big>=2<r^n,e^{n+\frac{1}{2}}>. \end{aligned}$$
(6.11)

Applying Lemma 5 and Theorem 3, we obtain

$$\begin{aligned} \big < \varphi _1\left( u^{n+\frac{1}{2}},u^{n+\frac{1}{2}}\right) -\varphi _1\left( U^{n+\frac{1}{2}},U ^{n+\frac{1}{2}}\right) ,e^{n+\frac{1}{2}}\big > \le C\left( ||e^{n+\frac{1}{2}}||^2+|| e^{n+\frac{1}{2}}_{\hat{x}}||^2\right) , \end{aligned}$$
(6.12)

and

$$\begin{aligned} \big < \varphi _2\left( u^{n+\frac{1}{2}},u^{n+\frac{1}{2}}\right) -\varphi _2\left( U^{n+\frac{1}{2}},U ^{n+\frac{1}{2}}\right) ,e^{n+\frac{1}{2}}\big > \le C\left( ||e^{n+\frac{1}{2}}||^2+|| e^{n+\frac{1}{2}}_{{\mathop {x}\limits ^{..}}}||^2\right) . \end{aligned}$$
(6.13)

It follows from (6.11)–(6.13) that

$$\begin{aligned} || e^n||^2_t+\frac{4}{3} ||e^n_{{x}}||^2_t-\frac{1}{3} || e^n_{\hat{x}}||^2_t\le C\Bigg [||e^{n+\frac{1}{2}}||^2+|| e^{n+\frac{1}{2}}_{\hat{x}}||^2+|| e^{n+\frac{1}{2}}_{{\mathop {x}\limits ^{..}}}||^2 \Bigg ]+||r^n||^2. \end{aligned}$$

Again it follows from (2.17)

$$\begin{aligned} || e^n||^2_t+\frac{4}{3} ||e^n_{{x}}||^2_t-\frac{1}{3} || e^n_{\hat{x}}||^2_t\le C\Big [||e^{n+\frac{1}{2}}||^2+|| e^{n+\frac{1}{2}}_{{x}}||^2 \Big ]+||r^n||^2. \end{aligned}$$

Therefore,

$$\begin{aligned} || e^n||^2_t+\frac{4}{3} ||e^n_{{x}}||^2_t-\frac{1}{3} || e^n_{\hat{x}}||^2_t\le C\Big [||e^{n+1}||^2+||e^{n}||^2+|| e^{n+1}_{{x}}||^2 +|| e^{n}_{{x}}||^2\Big ]+||r^n||^2.\nonumber \\ \end{aligned}$$
(6.14)

Let \(B^n=||e^n||^2+\frac{4}{3}||e^n_x||^2-\frac{1}{3}||e^n_{\hat{x}}||^2\) and summing up (6.14) from 0 to \(n-1\), we then have

$$\begin{aligned} B^n\le B^0+Ck\sum \limits _{l=0}^{n-1} ||r^l||^2+Ck\sum \limits _{l=0}^{n}\big (||e^l||^2+||e^l_x||^2\big ). \end{aligned}$$
(6.15)

It follows from (2.17) that

$$\begin{aligned} ||e^n||^2+||e^n_x||^2\le B^n=||e^n||^2+\frac{4}{3}||e^n_x||^2-\frac{1}{3}||e^n_{\hat{x}}||^2. \end{aligned}$$
(6.16)

Now letting \(G^n=||e^n||^2+||e^n_x||^2\), we obtain from (6.15)–(6.16),

$$\begin{aligned} G^n\le B^0+Ck\sum \limits _{l=0}^{n-1} ||r^l||^2+Ck\sum \limits _{l=0}^{n}G^l. \end{aligned}$$
(6.17)

Using (6.7), we get

$$\begin{aligned} k\sum \limits _{l=0}^{n-1}||r^l||^2\le nk \max _{0\le l\le n-1}||r^l||^2\le C(T)(k^2+h^4)^2. \end{aligned}$$
(6.18)

Combining (6.10), (6.17) and (6.18), we have

$$\begin{aligned} G^n\le C(T)(k^2+h^4)^2+Ck\sum \limits _{l=0}^{n}G^l. \end{aligned}$$

Hence

$$\begin{aligned} (1-Ck) G^n\le C(k^2+h^4)^2+Ck\sum \limits _{l=0}^{n-1}G^l. \end{aligned}$$

For k sufficiently small such that \((1-Ck) > 0\), we obtain

$$\begin{aligned} G^n\le C(k^2+h^4)^2+Ck\sum \limits _{l=0}^{n-1}G^l. \end{aligned}$$

Applying Lemma 6, we may deduce

$$\begin{aligned} G^n\le (h^4+k^2)^2e^{CT} \le C(T)(h^4+k^2)^2. \end{aligned}$$

Consequently,

$$\begin{aligned} ||e^n||\le C (h^4+k^2) ,\quad ||e^n_x||\le C (h^4+k^2). \end{aligned}$$
(6.19)

Then according to Lemma 3, we have:

$$\begin{aligned} ||e^n||_{\infty }\le C(h^4+k^2). \end{aligned}$$

This completes the proof. \(\square \)

Similarly, we can prove the stability of the difference solution.

Theorem 7

Under the conditions of Theorem 6, the solution to difference scheme (2.1)–(2.3) is stable for initial data by the norm \(||\,.\,||_{\infty }\).

7 Numerical experiments

In this section, we report some numerical experiments to justify our theoretical results given in the previous sections. For that purpose, we consider the homogeneous RLW–KdV equation as a first example to show the conservation laws of mass and energy for the scheme (2.1)–(2.3) and the inhomogeneous one as a second example to show the high-order accuracy of difference scheme (2.1)–(2.3). Then an application on the RLW Eq is given. Matlab was used to execute the algorithms that were used with the numerical examples.

7.1 Example 1 (conservation)

We consider the following homogeneous RLW–KdV equation with \(\alpha =\beta =1\):

$$\begin{aligned} u_t-u_{xxt}+ u_{xxx}+u_x+ uu_x= & {} 0, \quad x\in [0,100], \,\,t\in [0,10], \end{aligned}$$
(7.1)
$$\begin{aligned} u(x,0)= & {} A\, sech^2\Big (B\,(x-x_0)\Big ),\quad x\in [0,100], \end{aligned}$$
(7.2)

with \(c=0.3, A=3c, B=\sqrt{\frac{c}{4c+8}}\) and \(x_0=40\).

Note that the exact solution of problem (7.1)–(7.2) is:

$$\begin{aligned} u(x,t)=A\, sech^2\Big (B [x-x_0-(1+c)t]\Big ). \end{aligned}$$
(7.3)

We compute the numerical solution of this problem by the difference scheme (2.1) with \(h = {\frac{100}{J}}, k ={\frac{10}{N}}\).

7.1.1 Mass conservation

In Table 1, some values of discrete mass \(Q^n\) are given, where \(Q^n=\sum \nolimits _{j=1}^{J}U^n_j\), at various times \(t^n\) for \(k=0.1\) and \(h=0.1\). In this table, we can see the conservation of mass of the numerical solution for (7.1)–(7.2). This confirms the result found in Theorem 1.

Table 1 Some values of discrete mass \(Q^n\) at different times \(t^n\) calculated by scheme (2.1) with \(k=0.1\) and \(h=0.1\)
Table 2 Some values of discrete energy \(\mathcal {E}^n\) at different times \(t^n\) calculated by scheme (2.1) with \(k=0.1\) and \(h=0.1\)

7.1.2 Energy conservation

Also, in Table 2, we present some values of the discrete energy \(\mathcal {E}^n\), where \(\mathcal {E}^n=||U^n||^2+\frac{4}{3}||U^n_{x}||^2-\frac{1}{3}||U^n_{\hat{x}}||^2\), at various times \(t^n\) for \(k = 0.1\) and \(h = 0.1\). In this table, we can observe the conservation of energy of the numerical solution for (7.1)–(7.2). This supports the result obtained in Theorem 2.

7.2 Example 2 (order of convergence)

Consider the following periodic initial-value problem for the inhomogeneous RLW–KdV equation with \(\alpha =\beta =1\):

$$\begin{aligned} u_t-u_{xxt}+ u_{xxx}+u_x+ uu_x=g(x,t),\quad (x,t)\in [0,1]\times [0,1], \end{aligned}$$
(7.4)

with the initial data

$$\begin{aligned} u(x,0)=\sin \Big (2\pi x\Big ), \end{aligned}$$
(7.5)

where

$$\begin{aligned} g(x,t)= & {} \exp (-t)\Big [-\sin (2\pi x)\big (1+4\pi ^2\big )+\cos (2\pi x)\big (-8\pi ^3+2\pi \big )\nonumber \\&\quad +\pi \sin (4\pi x)\exp (-t)\Big ]. \end{aligned}$$
(7.6)

The exact solution of the problem (7.4)–(7.5) is

$$\begin{aligned} u(x,t)=e^{-t}\sin \Big (2\pi x\Big ). \end{aligned}$$
(7.7)

In this example, we shall compute the order of accuracy of the difference scheme (2.1)–(2.3). Let \(U^n_j(h,k)\) denote the numerical solution \(U^n_j\) with mesh-sizes h and k. Suppose that

$$\begin{aligned} \max _{0\le n\le N}\max _{1\le j\le J} \big |u(x_j,t^n)-U^n_j(h,k)\Big | =O(h^p)+O(k^q). \end{aligned}$$

If \(O(k^q)\) is sufficiently small, we have

$$\begin{aligned} \max _{1\le j \le J} \Big | u\left( x_j,t^N\right) -U^N_{2j}\left( \frac{h}{2},k\right) \Big | =O(h^p). \end{aligned}$$

Let

$$\begin{aligned} E(h)=\max _{1\le j \le J} \Big | u\left( x_j,t^N\right) -U^N_{2j}\left( \frac{h}{2},k\right) \Big |. \end{aligned}$$

Then

$$\begin{aligned} \log _2\Big (\frac{E(h)}{E(\frac{h}{2})}\Big )\simeq p. \end{aligned}$$

Some numerical results are recorded in Table 3.

If \(O(h^p)\) is sufficiently small, we have

$$\begin{aligned} \max _{1\le j \le J} \Big | u(x_j,t^N)-U^{2N}_{j}({h},\frac{k}{2})\Big | =O(k^q). \end{aligned}$$

Let

$$\begin{aligned} F(k)=\max _{1\le j \le J} \Big | u(x_j,t^N)-U^{2N}_{j}({h},\frac{k}{2})\Big |. \end{aligned}$$

Then

$$\begin{aligned} \log _2\left( \frac{F(k)}{F(\frac{k}{2})}\right) \simeq q. \end{aligned}$$

Some numerical results are recorded in Table 4.

From Tables 3 and 4, we conclude that the difference scheme (2.1)–(2.3) is convergent with a convergence rate of order \(O(h^4 + k^2)\), i.e., \( p = 4\) and \(q = 2\). This is in accordance with Theorem 6.

Table 3 Errors and order of convergence by the scheme (2.1)–(2.3) for the equations (7.4)–(7.5) for \(k = 0.0001\) and \(T=1\)
Table 4 Errors and order of convergence by the scheme (2.1)–(2.3) for the equations (7.4)–(7.5) when \(h = 0.001\) and \(T=1\)
Table 5 Invariants for single solitary wave: \(x_0=0,\,h=0.125,\,=k=0.1,c=0.1,x\in [-40,60]\)
Table 6 Invariants for single solitary wave: \(x_0=0, h=0.1,\,k=0.1,\ c=0.1\,,x\in [-40,60]\)
Table 7 Invariants for single solitary wave: \(c=0.03,h=0.125,\,k=0.1, \,x_0=0,\,x\in [-40,60]\)
Table 8 Invariants for single solitary wave: \(c=0.03,h=0.1,\,k=0.1, x_0=0,\,x\in [-40,60]\)

7.3 Example 3 (regularized long-wave (RLW) equation)

Consider the following RLW equation:

$$\begin{aligned} u_t -\mu u_{xxt}+ u_x + uu_x = 0, \end{aligned}$$
(7.8)

with the initial data

$$\begin{aligned} u(x,0) =3{c}\, sech^2\Big (k_0[x-x_0]\Big ), \end{aligned}$$
(7.9)

and the boundary conditions \(u\rightarrow 0\) as \(|x|\rightarrow +\infty \). Note that the exact solution of the problem (7.8)-(7.9) is

$$\begin{aligned} u(x,t) =3{c}\, sech^2\Big (k_0[x-(c+1)t-x_0]\Big ), \end{aligned}$$

where \(c,\,x_0\) are arbitrary constants and \(k_0=\frac{1}{2}\sqrt{\frac{c}{\mu (1+c)}}\).

We discretize the problem (7.8)–(7.9) by the following finite difference scheme:

$$\begin{aligned}&(U^n_j)_t-\frac{4\mu }{3}(U_j^n)_{x\bar{x}t}+\frac{\mu }{3}(U_j^n)_{\hat{x}\hat{x}t} +\frac{4}{3}\left( U_j^{n+\frac{1}{2}}\right) _{\hat{x}}-\frac{1}{3}\left( U_j^{n+\frac{1}{2}}\right) _{{\mathop {x}\limits ^{..}}}\nonumber \\&\quad +\frac{4\beta }{9} \Bigg \{\left( U_j^{n+\frac{1}{2}}\right) \left( U_j^{n+\frac{1}{2}}\right) _{\hat{x}}+\big [\left( U_j^{n+\frac{1}{2}}\right) ^{2}\big ]_{\hat{x}}\Bigg \}\\&\quad - \frac{\beta }{9} \Big \{\left( U_j^{n+\frac{1}{2}}\right) \left( U_j^{n+\frac{1}{2}}\right) _{{\mathop {x}\limits ^{..}}}+\big [\left( U_j^{n+\frac{1}{2}}\right) ^{2}\big ]_{{\mathop {x}\limits ^{..}}}\Big \}=0 , \quad j=1,\dots ,J,\,\, n=0,\dots ,N-1\\&U_j^0=u_0(x_j),\quad j=1,\dots , J. \end{aligned}$$

As is shown in Berikelashvili and Mirianashvili (2011), the RLW equation has three conservation laws which can be expressed in the following form:

$$\begin{aligned} I_1= & {} \int _{a}^{b}u \,\mathrm{d}x, \end{aligned}$$
(7.10)
$$\begin{aligned} I_2= & {} \int _{a}^{b}\left( u^2+\mu u_x^2\right) \mathrm{d}x, \end{aligned}$$
(7.11)
$$\begin{aligned} I_3= & {} \int _{a}^{b}(3u^2+u^3) \mathrm{d}x. \end{aligned}$$
(7.12)

We are going to test our numerical method via these invariants. For that we present some numerical experiments to assign the numerical solution of a single solitary wave. In addition, we determine the conservations laws for the solution of two interactions at different time levels.

Fig. 1
figure 1

Single solitary wave with \(c=0.1, h=0.125,\,k=0.1\) at times \(T=0, T=10\) and \(T=15\)

Fig. 2
figure 2

Single solitary wave with \(c=0.1, h=0.1, \,k=0.1\) at times \(T=0, T=10\) and \(T=15\)

Fig. 3
figure 3

Single solitary wave with \(c=0.03, h=0.125, \,k=0.1\) at times \(T=0, T=10\) and \(T=15\)

Fig. 4
figure 4

Single solitary wave with \(c=0.03, h=0.1, \,k=0.1\) at times \(T=0, T=10\) and \(T=15\)

7.3.1 Single solitary wave

To illustrate the validity of our scheme in case of a singleton soliton, the quantities \(I_1, I_2, I_3\) as well as \(L_{\infty }\)-norms are computed. For the single solitary wave we consider four cases in each one we choose different values of ch and k,  in order to compare it with the results of other methods. In the first case we choose: \(h=0.125,\, k=0.1,\,c=0.1\) and \(x\in [-40,60]\). The simulations are carried out up to \(t=20\) and recorded in Table 5.

In the second case we choose: \(h=0.1,\, k=0.1,\,c=0.1\) and \(x\in [-40,60]\). The simulations are carried out up to \(t=20\) and recorded in Table 6.

Table 9 Invariants for interactions of two solitary waves with \(h=0.3,\,k=0.1,\,k_1=0.4,\, k_2=0.3 \,,x\in [0,120]\)

In the third case we choose: \(x_0=0,\,h=0.125,\, k=0.1,\,c=0.03\) and \(x\in [-40,60]\). The simulations are carried out up to \(t=20\) and recorded in Table 7.

In the fourth case we choose: \(h=0.1,\, k=0.1,\,c=0.03\) and \(x\in [-40,60]\). The simulations are carried out up to \(t=20\) and recorded in Table 8.

As we can notice from Tables 5, 6, 7 and  8, the invariants \(I_1, I_2\) and \(I_3\) are changed by less than \(10^{-8}\) percent, by our method. Also for the \(L_{\infty }\) error, we can observe from Tables 5 and 6 that our scheme gives better error values. So the numerical results show good conservation and accuracy of the proposed scheme. The motion of the solitary wave is plotted, at different time levels, for each case in Figs. 1, 2, 3 and 4, respectively.

Fig. 5
figure 5

Interaction with two solitary waves with \(c_1=2,\,c_2=0.5, x_1=15,\,x_2=35,\,x_3=35, h=0.3,\,k=0.1\) and \(x\in [0,250]\) at times a \(T=0\),  b \(T=5,\)  c \(T=10\) d \(T=15\)e \(T=20,\) and f \(T=25\)

Table 10 Invariants for Maxwellian initial condition wave: \(h=k=0.1 \,x\in [0,30]\)

7.3.2 Interaction of two solitary waves

We consider, in this case, the RLW equation with initial condition given by the linear sum of two well separated solitary waves of various amplitudes

$$\begin{aligned} u(x,0)=\sum \limits _{i=1}^{2} 3c_i\, sech^2\Big (k_i(x-x_i)\Big ), \end{aligned}$$
(7.13)

where \(c_i={\frac{4k_i^2}{1-4k_i^2}},c_i\) and \(x_i\) are constants, \(i=1,2\) (see Berikelashvili and Mirianashvili 2011).

For this part, we have chosen \(k_1=0.4,\,k_2=0.3,\,x_1=15,\,x_2=35,\,h=0.3 \text { and}\,k=0.1\) with interval [0, 120]. The results of the conservation of the three laws for two solitary waves are given in Table 9. The invariant \(I_1\) changed by less than \(10^{-12}\) percent which gives stable results than the other two methods cited in Kutluay and Esen (2006) and Raslan (2005). For the two invariants \(I_2\) and \(I_3\), our scheme gives more stable values than those cited in Raslan (2005) and similar ones to those enlisted in Kutluay and Esen (2006). The interactions of these two solitary waves are plotted at different time levels and the phenomenon of collision of solitons which is discussed in Berikelashvili and Mirianashvili (2011) can be observed in Fig. 5.

Fig. 6
figure 6

a  \(\mu =0.04\),  b \(\mu =0.01\),  c, and \(\mu =0.001\)

7.3.3 The Maxwellian initial condition

In this last section, for various values of the parameter \(\mu \), we have explored the evolution of an initial Maxwellian pulse into solitary waves, using as initial condition the form:

$$\begin{aligned} u(x,0)=exp[-(x-7)^2]. \end{aligned}$$

In this case, the behavior of the solution depends on the values of the parameters \(\mu \). Therefore, the values \(\mu =0.04, \,\mu =0.01\) and \(\mu =0.001\) are picked. The values of the three invariants of motion for different \(\mu \) are presented in Table 10. These three invariants remain relatively more stable by our scheme than the scheme in Raslan (2005), as shown in Table 10. Also Fig. 6 illustrates the development of the Maxwellian condition into solitary waves. For \(\mu =0.04\), a single stable solution has appeared. When \(\mu =0.01\) two stable solitary waves occurred, and for \(\mu =0.001\) four stable solitary waves raised up. So we can figure out from these figures that, as the value of \(\mu \) decreases, the number of the stable solitary waves increases.

8 Conclusion

In the current paper, we present a nonlinear Crank–Nicolson type finite difference scheme for solving a model of nonlinear dispersive RLW-KdV equation. Using certain combinations of difference solutions with numerous grid parameters, we can reach higher-order accuracy. The existence, uniqueness and unconditional stability were demonstrated by the discrete energy method. Furthermore, the new conservative difference scheme is convergent at fourth-order in space and second-order in time. Numerical results have been reported and confirm the theoretical results. As a particular case we have studied the RLW equation, and we have investigated the conservation quantities \(I_1,\,I_2\) and \(I_3\) which were satisfactorily maintained. Furthermore, a Maxwellian initial condition has been employed and a liaison between \(\mu \) and the number of waves was explored. Results show the interaction of two solitons, with conservation laws adhered to satisfaction. Let us not forget to mention that our numerical results were compared to those obtained by other difference schemes and the numerical results have proved that our scheme gives more stable values in calculating the quantities \(I_1,\,I_2\) and \(I_3\).