1 Introduction

The Korteweg-de Vries equation (KdV) is a renowned dispersive evolution equation that was initially devised to propagate long waves with finite-small amplitudes in dispersive medium [1]. In fact, the KdV equation models weakly nonlinear long waves, integrating dispersion and leading order nonlinearity. The model is equally found to have immense applications in various areas of wave and fluid phenomena, including plasma physics [2], bubble-liquid mixtures [3], and anharmonic crystals [4], to mention a few. To more relevant works, we refer the readers to see [5,6,7,8,9,10,11].

Further, various exact solitary wave solutions for the KdV equation existed in the open literature through the utilization of many analytical approaches, see Gardner et al. [12] as an instance, where dissimilar exact analytical solutions were acquired, with the help of scattering theory. More so, different initial-boundary problems featuring the KdV equation were solved numerically to get hold of the corresponding numerical solutions using diverse proficient computational schemes, including finite difference method, spectral method, and finite element method [13,14,15] to mention a few. Also, all kinds of explicit solutions of the KdV equation were explored by Ma and You [16, 17]. In addition, the method of lines (MOL) is a universal numerical approach that tackles assorted classes of partial differential equations via the application of finite difference approximation on the related spatial derivatives; while the temporal derivatives are represented using ordinary differential equations (ODEs), for example see [18,19,20]. In particular, Schiesser [21] deployed MOL to examine a class KdV equations with central finite formula, while the resulting ODEs were solved with the help of Euler’s method.

This work aim to present the solution of KdV equation by applying modification of the method of lines. However, in the present study, we are set to devise efficient spatial discretization using the 5-point and 7-point non-central difference formulae incorporated in MOL to solve the class of the KdV equation. Indeed, we will be seeking the help of the Euler and RK4 numerical methods to solve the resulting ODEs. The stability of our proposal will be established using Fourier’s stability approach. Moreover, we will be examining the various factors to assess the suitability of our approaches, including, the percentage errors, absolute error differences, the error norms, and the invariants \(I_{k},\) for \(k=1,2,3,\) among others. Lastly, certain promising numerical approaches will be sought from the literature to validate the accuracy and efficiency of our proposed schemes.

The paper is arranged as follows: In Sect. 2, we describe non-central 5-point formula and 7-point formula in MOL. The stability analysis of the proposed formula is investigated in Sect. 3. Some numerical examples and comparisons are given in Sect. 4. Finally, the conclusion is displayed in Sect. 5.

2 Non-central m-point formula in MOL

The MOL is a universal approach for tackling diverse classes of partial differential equations (PDEs) through the application of finite difference approximation on the related spatial derivatives; while the temporal derivatives are represented using ODEs, read the known work by Schiesser in [21]. Indeed, MOL is a semi-discretization method that transforms the governing PDE to a coupled system of first-order ODEs and further approximates the spatial partial derivatives through finite difference relationships. In light of the finite difference method, a second-order finite difference approximation, which is often encountered, is utilized with a 3-point central difference, which at times necessitates the choice of the values of the dependent variable outside the endpoints.

Nevertheless, Hicks and Wei [22] introduced non-central difference approximations, which significantly improves the difference scheme. In this regard, a 5-point difference approximation was suggested, and further proven with regard to the MOL matrix to admit negative real eigenvalues, which guarantees the stability of the method. Further, in [23], Amr and Bakodah introduced a suitable spatial discretization that gave the best result with MOL. In the same vein, we recall the work by Bakodah [24] that applied yet a reliable spatial discretization with MOL; specifically, a non-central 7-point formula to a class of Burgers’ equation. Indeed, an efficient scheme was derived, which later revealed interesting computational results with high accuracy.

However, in this study, we shall simultaneously incorporate the non-central 5-point and non-central 7-point formulae into the MOL to solve the KdV equation. Remember that, the KdV equation is a real-valued dispersive evolution equation with vast applications in various areas of wave and fluid phenomena. Moreover, in the present study, we will be considering the KdV equation of the following form

$$\begin{aligned} u_{t}+\epsilon \,u\,u_{x}+\mu \,u_{xxx}=0, \end{aligned}$$
(1)

with \(\epsilon\) and \(\mu\) serving as positive real constants. Further, we prescribe the initial condition for (1) as follows

$$\begin{aligned} u(x,0)=f(x),\,\,\,\,\,\,\,\,a\,\le \,x\,\le \,b, \end{aligned}$$
(2)

together with the following 2-point boundary data

$$\begin{aligned} u(a,t)=0,\,\,\,\,\,\,\,u(b,t)=0,\,\,\,\,\,\,t\,>\,0, \end{aligned}$$
(3)

where f(x) is a given smooth function.

Moreover, to begin the MOL procedure, we start off by subdividing the rectangle \(a\le x\le b\), and \(0\le t \le T,\) into uniform (equal-sized) rectangular meshes by the lines \(x_{i}=i\,h,\,(i=1,2,3,...)\) and the lines \(t_{j}=j\,k,\,(j=1,2,3,...).\) Additionally, the spatial partial derivatives \(u_{x}\), and \(u_{xxx},\) the dispersion term, will be replaced with the non-central m-points as rightly deployed in [23].

2.1 5-point formula in MOL

We give the procedure of MOL in the presence of the non-central 5-point formula, to discretize the dispersion term, \(u_{xxx}\) and \(u_{x}\). For brevity, we refer to this method as MOL5, standing for MOL incorporating the non-central 5-point difference approximation. Therefore, on applying the non-central 5-point formula [23] to Eq. 1), a coupled system of ODEs in \(u_{i}\) as unknown functions in t is revealed as follows:

$$\begin{aligned} \begin{aligned} {d\,u_{1}\over {dt}}&={-\mu \over {4!\,h^3}}\,\left( -5\,u_{0}+18\,u_{1}-24\,u_{2}+14\,u_{3}-3\,u_{4}\right) \\&\qquad -{\epsilon \over {4!\,h}}\,\left( -25\,u_{0}^2+48\,u_{1}^2-36u_{2}^2+16u_{3}^2-3u_{4}^2\right) ,\\ {d\,u_{2}\over {dt}}&={-\mu \over {4!\,h^3}}\,\left( -3\,u_{1}+10\,u_{2}-12\,u_{3}+6\,u_{4}-\,u_{5}\right) \\&\qquad -{\epsilon \over {4!\,h}}\,\left( -3\,u_{1}^2-10\,u_{2}^2+18u_{3}^2-6u_{4}^2+u_{5}^2\right) ,\\ {d\,u_{i}\over {dt}}&={-\mu \over {4!\,h^3}}\,\left( -u_{i-2}+2\,u_{i-1}-2\,u_{i+1}+\,u_{i+2}\right) \\&\qquad -{\epsilon \over {4!\,h}}\,\left( \,u_{i-2}^2-8u_{i-1}^2+8u_{i+1}^2-u_{i+2}^2\right) ,\\&\qquad i=3,...,N-3,\\ {d\,u_{N-2}\over {dt}}&={-\mu \over {4!\,h^3}}\,\left( u_{N-5}-6\,u_{N-4}+12\,u_{N-3}\right. \\&\qquad \left. -10\,u_{N-2}+3\,u_{N-1}\right) \\&\qquad -{\epsilon \over {4!\,h}}\,\left( -\,u_{N-5}^2+6\,u_{N-4}^2\right. \\ {}&\qquad \left. -18u_{N-3}^2+10u_{N-2}^2+3u_{N-1}^2\right) ,\\ {d\,u_{N-1}\over {dt}}&={-\mu \over {4!\,h^3}}\,\left( 3\,u_{N-4}-14\,u_{N-3}+24\,u_{N-2}\right. \\&\qquad \left. -18\,u_{N-1}+5\,u_{N}\right) \\&\qquad -{\epsilon \over {4!\,h}}\,\left( 3\,u_{N-4}^2-16 u_{N-3}^2\right. \\ {}&\left. +36 u_{N-2}^2-48\,u_{N-1}^2+25 u_{N}^2\right) . \end{aligned} \end{aligned}$$
(4)

Hence, we have got above a coupled system of ODEs, featuring only the independent variable t. More so, this system will independently be solved computationally in the present study with the aid of the Euler and fourth-order Rung-Kutta methods.

2.2 7-point formula in MOL

In the same passion, we give the procedure of MOL in the presence of the non-central 7-point formula, to discretize the dispersion term, \(u_{xxx}\) and \(u_{x},\) as in [23]. We also refer to this method as MOL7, meaning the MOL incorporating non-central 7-point difference approximation. Then, on applying the non-central 7-point formula [23] to Eq. (1), a coupled system of ODEs in \(u_{i}\) as unknown functions in t is yielded as follows:

$$\begin{aligned} \begin{aligned} {du_{1}\over {dt}}&={-\mu \over {6! h^3}}(-49u_{0}+232u_{1}-461u_{2}+496u_{3}-307u_{4}+104u_{5}\\&\qquad -15u_{6})-{\epsilon \over {6! h}}(-49u^{2}_{0}+120u^{2}_{1}\\&\qquad -150u^{2}_{2}+{400\over {3}}u^{2}_{3}-75u^{2}_{4}+24u^{2}_{5}-{20\over {6}}u^{2}_{6}),\\ {du_{2}\over {dt}}&={-\mu \over {6! h^3}}(-15u_{1}+56u_{2}-83u_{3}+64u_{4}-29u_{5}+8u_{6}-u_{7})\\&\qquad -{\epsilon \over {6! h}}(-10u^{2}_{1}-77u^{2}_{2}+150u^{2}_{3}-100u^{2}_{4}\\&{\hspace{12pt}}+50u^{2}_{5}-15u^{2}_{6}+2u^{2}_{7}),\\ {du_{3}\over {dt}}&={-\mu \over {6! h^3}}(-u_{2}-8u_{3}+35u_{4}-48u_{5}+29u_{6}-8u_{7}+u_{8})\\&\qquad -{\epsilon \over {6! h}}(2u^{2}_{2}-24u^{2}_{3}-35u^{2}_{4}+80u^{2}_{5}-30u^{2}_{6}\\&\qquad +8u^{2}_{7}-u^{2}_{8}),\\ {du_{i}\over {dt}}&={-\mu \over {6! h^3}}(u_{i-3}-8u_{i-2}+13u_{i-1}-13u_{i+1}+8u_{i+2}-u_{i+3})\\&\qquad -{\epsilon \over {6! h}}(-u^{2}_{i-3}+9u^{2}_{i-2}-45u^{2}_{i-1}+45u^{2}_{i+1}\\&\qquad -9u^{2}_{i+2}+u^{2}_{i+3}),\,\,\,\,\,i=4,...,N-4,\\ {du_{N-3}\over {dt}}&={-\mu \over {6! h^3}}(-u_{N-8}+8u_{N-7}-29u_{N-6}+48u_{N-5}-35u_{N-4}\\&\qquad +8u_{N-3}+u_{N-2})-{\epsilon \over {6! h}}(u^{2}_{N-8}-8u^{2}_{N-7}\\&\qquad +30u^{2}_{N-6}-80u^{2}_{N-5}+35u^{2}_{N-4}+24u^{2}_{N-3}-2u^{2}_{N-2}),\\ {du_{N-2}\over {dt}}&={-\mu \over {6! h^3}}(u_{N-7}-8u_{N-6}+29u_{N-5}-64u_{N-4}+83u_{N-3}\\&\qquad -56u_{N-2}+15u_{N-1})-{\epsilon \over {6! h}}(-2u^{2}_{N-7}{}+15u^{2}_{N-6}-50u^{2}_{N-5}\\&\qquad +100u^{2}_{N-4}-150u^{2}_{N-3}+77u^{2}_{N-2}+10u^{2}_{N-1}),\\ {du_{N-1}\over {dt}}&={-\mu \over {6! h^3}}(15u_{N-6}-104u_{N-5}+307u_{N-4}-496u_{N-3}\\&\qquad +461u_{N-2}-232u_{N-1}+49u_{N}){}-{\epsilon \over {6! h}}({20\over {6}}u^{2}_{N-6}-24u^{2}_{N-5}\\&\qquad +75u^{2}_{N-4}-{400\over {3}}u^{2}_{N-3}+150u^{2}_{N-2}-120u^{2}_{N-1}+49u^{2}_{N}).\\ \end{aligned} \end{aligned}$$
(5)

Equally, the obtained coupled system of ODEs above, featuring only the independent variable t,  will independently be solved computationally with the help of the Euler and fourth-order Rung-Kutta methods.

3 Stability analysis

The present section establishes the stability conditions of the proposed MOL5 and MOL7 schemes for the solution of the governing KdV model. In fact, the stability analysis of any numerical scheme is a vital factor for the determination of a stable approximate solution (when existed), or otherwise. Hence, it is therefore relevant to establish the stability results for MOL for the treatment of the PDE of interest. Moreover, the nature of the resulting eigenvalues of the matrix, emanating from the implementation of MOL, is critical in examining a satisfactory solution for the given equation.

In particular, Kreiss and Scherer [25] have worked out the local stability conditions of the Rung-Kutta method when actualized on PDEs. More so, it was discovered with regard to the Rung-Kutta method that the method is only numerically valuable when it is stable for adequately small k/h;  with k representing the time-step.

Furthermore, the standard Fourier’s analysis is the universal approach that deeply examines the stability of diverse difference schemes, let alone the stability of the MOL as a case of concern. Indeed, we will be using this method to get hold of the stability conditions of the proposed MOL5 and MOL7 schemes for the governing KdV equation. Beginning with the MOL5, which revealed the coupled system of ODEs in (4), we first assume \(u_{i}\) to be constant in the nonlinear term, with

$$\delta =\max _{i} u_{i}.$$

Additionally, we seek a trail solution of the N ODEs expressed in (4) in order to get some vital information with regard to the resulting eigenvalues. Indeed, this trial solution must holistically satisfy all the variations of u(xt) in both x and t variables, (alternatively i and t). Thus, we make use of a generalized product solution expression of the following form

$$\begin{aligned} u(x,t)=C\,\Psi (t)\,\** (x), \end{aligned}$$
(6)

where the function \(\** (x)\) is further assumed based on Van Neumann’s suggestion as follows

$$\begin{aligned} \** (x)=e^{jKx},\,\,\,\, j=\sqrt{-1}, \end{aligned}$$
(7)

with K denoting the Fourier’s number. Then, upon substituting of (6) and (7) in (4), one gets

$$\begin{aligned}{} & {} {d\Psi (t)\over {dt}}(c\,e^{jKx_{i}})\\ {}{} & {} \quad ={-c\,\mu \,\Psi \over {4!\,h^3}} \left( -e^{jK(x_{i}-2h)}+2\,e^{jK(x_{i}-h)}-2\,e^{jK(x_{i}+h)}+\,e^{jK(x_{i}+2h)}\right) \\{} & {} \qquad -{c\,\epsilon \,\Psi \,\delta \over {4!\,h}}\left( e^{jK(x_{i}-2h)}-8\,e^{jK(x_{i}-h)} +8\,e^{jK(x_{i}+h)}-e^{jK(x_{i}+2\,h)}\right) ,\\{} & {} \quad ={-c\,\mu \,\Psi \over {4!\,h^3}}\left( e^{j\,K\,x_{i}}\left[ \,(e^{2\,j\,K\,h}-e^{-2\,j \,K\,h})-2\,(e^{j\,K\,h}-e^{-j\,K\,h})\right] \right) \\{} & {} \qquad -{c\,\epsilon \,\Psi \,\delta \over {4!\,h}}\left( e^{j\,K\,x_{i}}\,\left[ -(e^{2\,j\,K \,h}-e^{-2\,j\,K\,h})+8\,(e^{j\,K\,h}-e^{-j\,K\,h})\right] \right) , \end{aligned}$$

where \(\delta =max(u_{i})\). Hence,

$$\begin{aligned} {d\Psi (t)\over {dt}}= & {} {-\Psi \,\mu \,\over {12\,h^3}}\left[ +\left( {e^{2\,j\,K\,h}-e^{-2\,j\,K\,h}\over {2}}\right) -2\,\left( {e^{j\,K\,h}-e^{-j\,K\,h}\over {2}}\right) \right] \\{} & {} -{\Psi \epsilon \,\delta \over {12\,h}}\left[ -\left( {e^{2\,j\,K\,h}-e^{-2\,j\,K\,h}\over {2}}\right) +8\,\left( {e^{j\,K\,h}-e^{-j\,k\,h}\over {2}}\right) \right] ,\\= & {} \left( {-\,\mu \,\over {12\,h^3}}\left[ \,\sin (2\,K\,h)-2\,\sin (K\,h)\right] \right. \\{} & {} \left. -{\epsilon \,\delta \over {12\,h}}\left[ -\sin (2\,K\,h)+8\,\sin (K\,h)\right] \right) \,\Psi . \end{aligned}$$

Alternatively, upon using the relation \(\sin (2Kh)=2\,\sin (Kh)\,\cos (Kh),\) the latter equation reduces to the following system

$${d\Psi (t)\over {dt}}\,=\,\lambda \,\Psi (t),$$

where,

$$\begin{aligned} \lambda= & {} -{\,\mu \,\over {12\,h^3}}\left[ 2\,\sin (K\,h)\,\cos (K\,h)-2 \sin (K\,h) \right] \\{} & {} -{\epsilon \,\delta \over {12\,h}}\left[ -2\,\sin (K\,h) \cos (K\,h)+8\,\sin (K\,h)\right] . \end{aligned}$$

Furthermore, since \(|\sin (a)|\le 1\) and \(|\cos (a)|\le 1\), we observe that the eigenvalues of the system (4) admit negative real part, which indeed indicates that the coupled system of N equations is stable.

In a similar way, the numerical scheme for MOL7, which was implemented earlier and resulted in the coupled system of N equations in (5) admits the following eigenvalues

$$\begin{aligned} \lambda= & {} {-\,\mu \,\over {360\,h^3}}\left[ 16\,\sin (K\,h)(\cos (K\,h)-1)+4 \sin ^{3}(K\,h) \right] \\{} & {} -{\epsilon \,\delta \over {360\,h}}\left[ 3\,\sin (K\,h) (14-6\cos (K\,h))+4\,\sin ^{3}(K\,h)\right] , \end{aligned}$$

which also possesses negative real parts, indicating that the coupled system of N equations is stable.

4 Numerical results and discussion

In the present section, we demonstrate the applicability of the derived numerical methods, the MOL5, and MOL7, on two initial-boundary value problems of the KdV model. More so, as MOL is a semi-discretization method that transforms the governing PDE into a coupled system of first-order ODEs in t, and further approximate the spatial partial derivatives through finite difference approximations; these resulting ODEs will concurrently be solved using the Euler and fourth-order Rung-Kutta (RK4) methods, respectively.

Moreover, we will be computing the absolute error difference between the approximate and the corresponding exact analytical solutions at various mesh points, in addition to the determination of the discrete \(L_{2}\) and \(L_{\infty }\) error norms using

$$L_{2}=\sqrt{h\sum _{i=0}^{N}|u^{e}_{i}-u_{i}}|,$$

and

$$L_{\infty }=\max _{i}|u^{e}_{i}-u_{i}|,$$

where \(u^{e}_{i}\) is an exact analytical solution. Equally, respective percentage errors will be determined using

$$PE={|u^{e}_{i}-u_{i}|\over {|u^{e}_{i}|}}\times 100.$$

Further, a bright soliton solution of the KdV equation, taking the following form

$$u(x,t)=C\,\text {sech}^{2}{(B_1x+B_2t+B_3)},$$

will be considered for comparative examination, where C,  and \(B_i\) for \(i=1,2,3\) are constants to be determined. Also, as the KdV equation is known to possess different invariant polynomials, the following three invariant cases

$$\begin{aligned} \begin{aligned} I_{1}&=h\,\sum _{i=1}^{N} u,\\ I_{2}&=h\,\sum _{i=1}^{N} u^2,\\ I_{3}&=h\,\sum _{i=1}^{N}\left( u^{3}-{3\mu \over {2\,\epsilon }}u^2_{x}\right) , \end{aligned} \end{aligned}$$

will be adopted while simulating the proposed schemes, where \(u=u(x,t).\) Furthermore, we will equally be using these invariant polynomials in assessing the efficiency of the devised algorithms.

4.1 Example 1: Single soliton

In reference to the KdV equation expressed in (1), the following supportive boundary conditions

$$u(0,t)=0, \qquad u(2,t)=0, \qquad t>0,$$

are defined at the two endpoints, and coupled with the following initial data

$$u(x,0)=3\,C\,\text {sech}^{2}(B_1x+B_3),\,\,\,0\le x \le 2.$$

In addition, this problem satisfies the following exact analytical solution [26]

$$u(x,t)=3\,C\,\text {sech}^{2}(B_1x-B_2t+B_3),\,\,\,\,\,0 \le x \le 2,$$

where \(B_1=\frac{1}{2}\sqrt{{\epsilon \,C\over {\mu }}},\) \(B_2=\epsilon B_1 C;\) while \(B_3\) and C are real constants. Moreover, for the numerical purpose, we consider \(B_3=-6,\) \(C=0.3,\) \(\epsilon =1,\) \(\mu =4.84\times 10^{-4},\) \(N=20,\) \(h=0.1,\) \(k=0.005\) and \(nt=20\). Further, to establish a more rigorous comparative study, we seek the computational results presented in [27, 28], using the exponential finite-difference method (Exponential) and Heat Balance Integral (HBI) method, respectively, in order to assess the proposed MOL5 and MOL7. Indeed, we will be computing the error norms with regard to \(L_{2}\) and \(L_{\infty }\) norms; in addition to the determination of the respective invariants \(I_{k}\) for \(k=1,2,3,\) at \(t=0.005\) and \(t=0.01\), sequentially.

Eventually, the obtained numerical results of the governing example, using the proposed MOL5 and MOL7 (via both the Euler and RK4), are tabulated in Tables 1 and 2, and further compared with the results reported in [27, 28] using the Exponential and HBI approaches, in addition to that of the exact analytical solution. More so, from these tables, we have deeply examined the proposed schemes by successfully simulating/portraying the resulting percentage errors, invariant and error norms, and absolute error difference graphically. Indeed, our proposed methods turn out to be better than those of the competing Exponential and HBI methods in terms of both accuracy and efficiency. More so, the invariants are noted to be almost constant with an increase in time.

In addition, Figs. 1-2 depict the graphical illustrations by comparing the obtained solutions using the proposed schemes (MOL, present method) and that of the exact analytical solution. As expected, both solutions satisfy all the physical assumptions of the model. Accordingly, the solution revealed by the devised methods is noted to match the exact solution with indeed an insignificant error (Tables 3, 4, 5).

Table 1 Absolute error differences for Example 1
Table 2 Solution of Example 1 using the proposed MOL5 and the competing methods [27, 28] when \(k=0.005\)
Table 3 Percentage errors associated with Example 1
Table 4 Solution of Example 1 using the proposed MOL5 and the competing methods [27, 28] when \(k=0.01.\)
Table 5 Invariant of Example 1 when \(h=0.1\)
Fig. 1
figure 1

Comparison between the proposed MOL5 and exact solutions for Example 1

Fig. 2
figure 2

Comparison between the proposed MOL7 and exact solutions for Example 1

4.2 Example 2: Interaction of two solitary waves

Let us consider the KdV equation as given in (1) that admits a two-soliton solution, together with the following endpoint boundary conditions

$$u(0,t)=0, \qquad u(4,t)=0, \qquad t>0,$$

and further coupled with an appropriate initial condition, derivable from the exact solution that takes the following expression [29]

$$u(x,t)=12\,\mu \,(\log (F))_{xx}, \qquad 0\le x \le 4,$$

where

$$F=1+\exp (\omega _{1})+\exp (\omega _{2})+\left( {a_{1}-a_{2}\over {a_{1}+a_{2}}}\right) ^{2} \exp (\omega _{1}+\omega _{2}),$$

with \(a_{1}=\sqrt{{0.3\over {\mu }}},\) \(a_{2}=\sqrt{{0.1\over {\mu }}},\) \(\rho _{1}=-48,\) \(a_{1},\,\,\rho _{2}=-1.07a_{2}\) and \(\omega _{i}=a_{i}\,x-a_{i}^{3}\mu \,t+\rho _{i},\) for \(i=1,2.\) Additionally, we set \(\epsilon =1\), \(\mu =4.84\times 10^{-4},\) together with letting \(N=20,\) \(k=0.005,\) \(h=0.1,\) and \(nt=20\). In the same vein, and without further delay, Tables 6, 7 and 8 give the accuracy of devised methods and further compared with the results in [28], using HBI. More so, certain graphical illustrations are illustrated in Figs. 3-4, where a very good agreement has been noted between the proposed solution and that of the exact solution. Equally, the solutions satisfy the physical behaviour of the model.

Table 6 Percentage errors associated with Example 2
Table 7 Absolute error differences for Example 2
Table 8 Invariant of Example 2 when \(h=0.01\)
Fig. 3
figure 3

Comparison between the proposed MOL5 and exact solutions for Example 2

Fig. 4
figure 4

Comparison between the proposed MOL7 and exact solutions for Example 2

5 Conclusion

In conclusion, the present paper modified two numerical methods, the MOL5 and MOL7, and further implemented them on the renowned KdV model, a real-valued dispersive evolution equation with vast applications in various areas of wave and fluid phenomena. Besides, MOL is a semi-discretization method that gives a system of first-order ODEs; this resulting system was concurrently solved numerically using the Euler and RK4 methods, respectively. In addition, Fourier’s stability analysis method via the use of Van Neumann’s suggestion has helped us in achieving stable numerical schemes, with the MOL matrix admitting negative real eigenvalues. Moreover, having assessed the devised approaches on two initial-boundary value problems of the KdV model, by establishing the resulting percentage errors, absolute error differences, the error norms \(L_{2}\) and \(L_{\infty }\) and the invariant \(I_{k},\) for \(k=1,2,3,\). Therefore, we can proudly conclude that the proposed methods are better than those of the competing Exponential and HBI results in terms of both accuracy and efficiency. Hence, we recommend that the proposed methods should be applied to other types of evolution equations, including the Schrodinger equations. In addition, a higher order of KdV will be considered in our future work.