%Version 3 December 2023
% See section 11 of the User Manual for version history
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                                 %%
%% Please do not use \input{...} to include other tex files.       %%
%% Submit your LaTeX manuscript as one .tex document.              %%
%%                                                                 %%
%% All additional figures and files should be attached             %%
%% separately and not embedded in the \TeX\ document itself.       %%
%%                                                                 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%\documentclass[referee,sn-basic]{sn-jnl}% referee option is meant for double line spacing

%%=======================================================%%
%% to print line numbers in the margin use lineno option %%
%%=======================================================%%

%%\documentclass[lineno,sn-basic]{sn-jnl}% Basic Springer Nature Reference Style/Chemistry Reference Style

%%======================================================%%
%% to compile with pdflatex/xelatex use pdflatex option %%
%%======================================================%%

%%\documentclass[pdflatex,sn-basic]{sn-jnl}% Basic Springer Nature Reference Style/Chemistry Reference Style


%%Note: the following reference styles support Namedate and Numbered referencing. By default the style follows the most common style. To switch between the options you can add or remove Numbered in the optional parenthesis. 
%%The option is available for: sn-basic.bst, sn-vancouver.bst, sn-chicago.bst%  
 
%%\documentclass[pdflatex,sn-nature]{sn-jnl}% Style for submissions to Nature Portfolio journals
%\documentclass[pdflatex,sn-basic]{sn-jnl}% Basic Springer Nature Reference Style/Chemistry Reference Style
%\documentclass[pdflatex,sn-mathphys-num]{sn-jnl}% Math and Physical Sciences Numbered Reference Style 
%%\documentclass[pdflatex,sn-mathphys-ay]{sn-jnl}% Math and Physical Sciences Author Year Reference Style
\documentclass[pdflatex,sn-aps]{sn-jnl}% American Physical Society (APS) Reference Style
%%\documentclass[pdflatex,sn-vancouver,Numbered]{sn-jnl}% Vancouver Reference Style
%%\documentclass[pdflatex,sn-apa]{sn-jnl}% APA Reference Style 
%%\documentclass[pdflatex,sn-chicago]{sn-jnl}% Chicago-based Humanities Reference Style

%%%% Standard Packages
%%<additional latex packages if required can be included here>

\usepackage{graphicx}%
\usepackage{multirow}%
\usepackage{amsmath,amssymb,amsfonts}%
\usepackage{amsthm}%
\usepackage{mathrsfs}%
\usepackage[title]{appendix}%
\usepackage{xcolor}%
\usepackage{textcomp}%
\usepackage{manyfoot}%
\usepackage{booktabs}%
\usepackage{algorithm}%
\usepackage{algorithmicx}%
\usepackage{algpseudocode}%
\usepackage{listings}%
\usepackage[section]{placeins}%
\usepackage{subcaption}%
\usepackage{threeparttable}%
\usepackage{float}
\usepackage{array}

%%%%

%%%%%=============================================================================%%%%
%%%%  Remarks: This template is provided to aid authors with the preparation
%%%%  of original research articles intended for submission to journals published 
%%%%  by Springer Nature. The guidance has been prepared in partnership with 
%%%%  production teams to conform to Springer Nature technical requirements. 
%%%%  Editorial and presentation requirements differ among journal portfolios and 
%%%%  research disciplines. You may find sections in this template are irrelevant 
%%%%  to your work and are empowered to omit any such section if allowed by the 
%%%%  journal you intend to submit to. The submission guidelines and policies 
%%%%  of the journal take precedence. A detailed User Manual is available in the 
%%%%  template package for technical guidance.
%%%%%=============================================================================%%%%

%% as per the requirement new theorem styles can be included as shown below
\theoremstyle{thmstyleone}%
\newtheorem{theorem}{Theorem}%  meant for continuous numbers
%%\newtheorem{theorem}{Theorem}[section]% meant for sectionwise numbers
%% optional argument [theorem] produces theorem numbering sequence instead of independent numbers for Proposition
\newtheorem{proposition}[theorem]{Proposition}% 
%%\newtheorem{proposition}{Proposition}% to get separate numbers for theorem and proposition etc.

\theoremstyle{thmstyletwo}%
\newtheorem{example}{Example}%
\newtheorem{remark}{Remark}%

\theoremstyle{thmstylethree}%
\newtheorem{definition}{Definition}%
\numberwithin{equation}{section}

\raggedbottom
%%\unnumbered% uncomment this for unnumbered level heads

\begin{document}

\title[Article Title]{An Improvised Cubic B-Spline-Based Collocation Approach for Solving Nonlinear K-G Equations}

%%=============================================================%%
%% GivenName	-> \fnm{Joergen W.}
%% Particle	-> \spfx{van der} -> surname prefix
%% FamilyName	-> \sur{Ploeg}
%% Suffix	-> \sfx{IV}
%% \author*[1,2]{\fnm{Joergen W.} \spfx{van der} \sur{Ploeg} 
%%  \sfx{IV}}\email{iauthor@gmail.com}
%%=============================================================%%

\author[1]{\fnm{Nadeem} \sur{Malik}}\email{nadeemmalik283@gmail.com}

\author[2]{\fnm{Aditi} \sur{Singh}}\email{aditi.dei2014@gmail.com}
\equalcont{These authors contributed equally to this work.}

\author*[1]{\fnm{Sumita} \sur{Dahiya}}\email{sumita.dahiya@nsut.ac.in}
\equalcont{These authors contributed equally to this work.}

\affil*[1]{\orgdiv{Netaji Subhas University of Technology},  \country{INDIA}}

\affil[2]{\orgdiv{Department of Mathematics}, \orgname{RBS College, Agra}, \country{INDIA}}


%%==================================%%
%% Sample for unstructured abstract %%
%%==================================%%

\abstract{This manuscript explores the complex Klein-Gordon (K-G) equation that is  a fundamental relativistic wave equation in nature. This equation is integral to scalar field interactions within various physics disciplines, including quantum field theory, relativistic quantum mechanics, and plasma as well as condensed matter physics. The integration of an advanced nonlinear term significantly complicates the numerical simulation of the K-G equation's solutions. This paper introduces a novel approach for approximating solutions to the K-G equation through a collocation technique, leveraging the computational power of third-degree B-splines. For temporal discretization, the Crank-Nicolson discretization is employed, while the Rubin Graves method is utilized to manage the equation's nonlinearity. The manuscript outlines a structured procedure for computing and categorizing the Klein-Gordon equation's approximate solutions. It encompasses the examination of notable specific instances, such as solitary and periodic waves, and delves into the analysis of certain characteristics that could be instrumental in future explorations of the nonlinear dynamics related to this partial differential equation. By benchmarking our results against known exact solutions or those derived from other numerical strategies, we have substantiated the proposed method's precision and effectiveness across a variety of test scenarios. }

%%================================%%
%% Sample for structured abstract %%
%%================================%%

% \abstract{\textbf{Purpose:} The abstract serves both as a general introduction to the topic and as a brief, non-technical summary of the main results and their implications. The abstract must not include subheadings (unless expressly permitted in the journal's Instructions to Authors), equations or citations. As a guide the abstract should not exceed 200 words. Most journals do not set a hard limit however authors are advised to check the author instructions for the journal they are submitting to.
% 
% \textbf{Methods:} The abstract serves both as a general introduction to the topic and as a brief, non-technical summary of the main results and their implications. The abstract must not include subheadings (unless expressly permitted in the journal's Instructions to Authors), equations or citations. As a guide the abstract should not exceed 200 words. Most journals do not set a hard limit however authors are advised to check the author instructions for the journal they are submitting to.
% 
% \textbf{Results:} The abstract serves both as a general introduction to the topic and as a brief, non-technical summary of the main results and their implications. The abstract must not include subheadings (unless expressly permitted in the journal's Instructions to Authors), equations or citations. As a guide the abstract should not exceed 200 words. Most journals do not set a hard limit however authors are advised to check the author instructions for the journal they are submitting to.
% 
% \textbf{Conclusion:} The abstract serves both as a general introduction to the topic and as a brief, non-technical summary of the main results and their implications. The abstract must not include subheadings (unless expressly permitted in the journal's Instructions to Authors), equations or citations. As a guide the abstract should not exceed 200 words. Most journals do not set a hard limit however authors are advised to check the author instructions for the journal they are submitting to.}

\keywords{Klein-Gordon(K-G) equation, Quantum field theory, Cubic B-Spline, Crank-Nicolson implicit scheme.}

%%\pacs[JEL Classification]{D8, H51}

%%\pacs[MSC Classification]{35A01, 65L10, 65L12, 65L20, 65L70}

\maketitle

\section{Introduction}\label{sec1}


Partial differential equations can simulate nonlinear events across multiple scientific disciplines, including mathematical biology, fluid dynamics, plasma physics, solid-state physics and chemical kinetics. These nonlinear PDEs have been studied using various analytical and numerical solution techniques. The nonlinear K-G equation has been particularly significant in various research contexts, such as condensed matter systems, plasma dynamics without collisions, cyclic state recurrence, and the study of wave behavior in nonlinear systems\cite{caudrey1975sine, dodd1982solitons}. 

The nonlinear K-G equation can simulate various nonlinear phenomena, such as ferroelectric and ferromagnetic domain walls and dislocations. The K-G equation holds an essential place in mathematical physics \cite{dehghan2009numerical,wazwaz2005tanh}. The K-G equation is used to represent a variety of phenomena, including the spread of dislocations in crystals and the behavior of elementary particles. The equation's significance extends into the realm of relativistic quantum mechanics and field theory, making it an indispensable tool for researchers in high-energy physics. The following equation gives 1D nonlinear K-G equation:

\begin{equation}
\varphi_{tt} + \alpha \varphi_{xx} + f_1(\varphi) = f_2(x,t),
\end{equation}

where $\varphi = \varphi(x,t)$ shows the wave displacement at $x$ and time $t$, $\alpha < 0$ is a known value and $f_1(\varphi)$ is the nonlinear force. 
Equation (1.1) is a fundamental representations of quantum mechanics \cite{shakeri2008numerical}. It also appears as a model for dispersive phenomena in relativistic physics. The nonlinear K-G equation is a Hamiltonian partial differential equation, and it has conserved Hamiltonian energy (E) for a variety of forces $f_1(\varphi)$ (or energy):

\begin{equation}
E = \int \left(\frac{1}{2} \varphi_t^2 + \frac{1}{2} \varphi_x^2 + F_1(\varphi)\right) d\varphi,
\end{equation}

where $F_1'(\varphi) = f_1(\varphi)$.
This study based on the finding of numerical result of the nonlinear K-G equation, which is defined by cubic nonlinearity.

\begin{equation}
\varphi_{tt} + \alpha \varphi_{xx} + \beta \varphi + \gamma \varphi^3 = 0,
\end{equation}
where $\alpha$, $\beta$, and $\gamma$ are predetermined values.

Many applications depend on the solutions of the nonlinear K-G equation including spin waves, nonlinear optics, and mathematical physics issues. The literature has extensively discussed the numerical solutions of the nonlinear K-G equation, which have been extensively studied using various effective techniques. As highlighted in \cite{wazwaz2008new}. Additional mathematical frameworks include the Wadati trace methodology, Hirota bilinear formulations, and pseudo-spectral analysis. Further solution strategies encompass the tanh-sech approach, sine-cosine analysis, implementations using Jacobi elliptic functions, and the Riccati equation expansion technique. Researchers have developed various numerical techniques to obtain solutions for the K-G equation. These computational approaches span a spectrum of mathematical methodologies, from the implementation of second-order finite difference schemes \cite{li1995finite}, to the application of variational iteration techniques \cite{dehghan2009numerical,shakeri2008numerical}, The differential transform method \cite{kanth2009differential} represents another significant computational framework that has been employed to analyze this equation.

Lakestani and Dehghan solved the cubic and quadratic nonlinear K-G equations \cite{lakestani2010collocation} using cubic spline scaling functions. In addition to creating a method involving wavelet polynomials, Rashidinia \cite{rashidinia2010tension} and others devised a triple-time level approach using tension spline techniques.
Gua and Wang have created a collocation approach \cite{guo2014collocation} for the generalized nonlinear K-G equation that has high-order accuracy in space and time. Li \cite{li2017meshless} has contributed a meshless method featuring a well-posed moving least squares approximation. Lu \cite{lu2017small} has found a family of small amplitude periodic solutions relevant to a certain class of nonlinear K-G equations. A numerical technique that employs the Crank-Nicolson scheme alongside the Tau method have been recently developed by Saray et al. \cite{saray2018evaluation}. Also, the Legendre wavelet-based approximation method has been recently developed by Venkatesh et al. \cite{venkatesh2018efficient} to get the solution of the K-G equation.
For the solution of linear and nonlinear K-G equations, El-Sayed et al \cite{el2003decomposition}, \cite{el2003comparison, wazwaz2001new}, and Kaya et al. \cite{kaya2004numerical} have employed the Adomian decomposition approach. Finite difference techniques are well-known as the first way to resolve such an equation. These techniques are particularly efficient for solving different PDEs, and Dehghan \cite{dehghan2006finite} developed explicit finite difference processes that are conditionally stable. Bratsos \cite{bratsos2009numerical} utilized a predictor-corrector (P-C) method, which is grounded in the logical approximation of second-order recurrence relations at three distinct time levels.

Abbasbandy has used the variational iteration method \cite{abbasbandy2007numerical} to get a numerical solution to the nonlinear K-G equation. The spline difference approach was considered by Ismail et al. \cite{ismail1989spline} for solving the K-G equation. Vu-Quoc et al. \cite{vu1993invariant} provided a paradigm for systematically generating algorithms utilizing second-order accurate finite differences that ensure the preservation of specific invariant quantities found in the original PDEs. They developed three algorithms for the nonlinear K-G problem based on this paradigm.

M. Chawla and M.A Al-Zanaidi \cite{chawla2001linearly}  produce a linearly implicit one-step temporal integration scheme for nonlinear hyperbolic equations. Dehghan et al. \cite{dehghan2009fourth} employed a method that relies on a fourth-order compact finite difference approximation for spatial derivative discretization to address the one-dimensional nonlinear K-G equation. 
Mittal et al. \cite{Mittal03102015} also discussed the K-G equation with the collocation method. They converted the PDE into an associated system of ODE and then solved it using Runge Kutta methods, but in this manuscript, the PDE is transformed into an associated system of algebraic equations which can easily be solved. Khuri et al. \cite{KHURI20101047} employed a finite element collocation approach with a backward 3-point formula and Rashidinia et al. \cite{RASHIDINIA20101866} designed a scheme with third-order convergence in time. Both schemes were used directly on the K-G equation. In this paper, the K-G equation is first transformed into a system of equations, and then an improvised cubic B-spline collocation approach is taken. Some numerical methods exhibited undesirable characteristics, such as loss of spatial symmetry and the onset of instability for large parameter values in the equation's initial condition.

The improvised cubic B-spline collocation approach is a method of great interest for obtaining effective numerical solutions to nonlinear boundary-value problems. The B-spline curves are suitable for shape representation and analysis because they offer significant characteristics and intriguing aspects. The initial boundary value problem of the nonlinear K-G equation is addressed through a fully implicit, discrete energy-conserving finite difference method. This approach ensures numerical stability and accuracy by preserving the system's energy over time, which is essential for long-term simulations' credibility. The approach's validity and accuracy are evaluated by applying the method to five numerical problems. The numerical results are evaluated against existing literature. This approach is simple yet effective, providing accurate results with a much smaller grid size, which helps minimize complexity and computational expense.

The structure of this manuscript is explained in the subsequent sections.  The improvised cubic B-spline collocation approach is discussed in Section 2. The technique is implemented to numerically solve the cubic nonlinear K-G equation in Section 3. The stability is discussed in section 4. The numerical outcomes are compared with existing numerical results in Section 5. A conclusion that succinctly summarizes the numerical outcomes is provided in Section 6.




\section{ Improvised Cubic B-spline collocation Approach(ICBCA)-Fully Discrete Scheme
}\label{sec2}

This section elaborates the high-order numerical scheme based on a uniform mesh to numerically simulate K-G equation, given
by Equation (1.3). More specifically, the problem is semi-discretized in the temporal direction by using Crank–Nicolson
method, after the unknown functions being approximated by weighted B-Spline functions. Let the domain $\Omega$  divided into an uniform partition by the grid points $x_j$, where $j = 0, 1, 2, \dots, N$, such that the length of each interval is given by $h = x_j - x_{j-1}$. The third-degree B-splines, also known as cubic B-splines, are defined as follows:

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

where $\{Q_{-1}(x), Q_0(x), Q_1(x), ..., Q_N(x), Q_{N+1}(x)\}$ forms a basis over the  defined interval.

In the ICBCA, the exact solution $\varphi(x,t)$ is approximated by $\Phi(x,t)$ in the form

\begin{equation}
\Phi(x,t) = \sum_{j=-1}^{N+1} g_j(t) Q_j(x)
\end{equation}
The quantities $g_j(t)$ are time-dependent unknowns that are determined using boundary conditions and collocation methods. It's assumed that $\Phi(x,t)$ satisfies the following interpolatory and end conditions

\begin{equation}
\Phi (x_j,t) = \varphi(x_j,t), \quad 0 \leq j \leq N
\end{equation}
\begin{equation}
\Phi''(x_j,t) = \varphi''(x_j,t) - \frac{1}{12}h^2 \varphi''(x_j,t), \quad j = 0, N
\end{equation}
\textbf{Theorem 1}
 $\varphi(x,t)$ is a  sufficiently  smooth function and $\Phi(x,t)$ is a unique cubic spline interpolant(CSI) that meets the boundary conditions, then we have

\begin{equation}
\Phi'(x_j,t) = \varphi'(x_j,t) + O(h^4), \quad 0 \leq j \leq N
\end{equation}
\begin{equation}
\Phi''(x_j,t) = \varphi''(x_j,t) - \frac{1}{12}h^2 \varphi^{(4)}(x_j,t) + O(h^4), \quad 0 \leq j \leq N
\end{equation}
\textbf{Proof} Given in \cite{lucas1974error}.

The estimated values $\Phi(x,t)$ and its first order derivatives at the grid points are defined using Taylor series expansions and finite differences as outline below

For $j = 0$,

\begin{equation}
\varphi^{(4)}(x_j,t) = \frac{2\Phi''(x_0,t) - 5\Phi''(x_1,t) + 4\Phi''(x_2,t) - \Phi''(x_3,t)}{h^2} + O(h^2)
\end{equation}

For $1 \leq j \leq N - 1$,

\begin{equation}
\varphi^{(4)}(x_j,t) = \frac{\Phi''(x_{j-1},t) - 2\Phi''(x_j,t) + \Phi''(x_{j+1},t)}{h^2} + O(h^2)
\end{equation}

For $j = N$,

\begin{equation}
\varphi^{(4)}(x_N,t) = \frac{2\Phi''(x_N,t) - 5\Phi''(x_{N-1},t) + 4\Phi''(x_{N-2},t) - \Phi''(x_{N-3},t)}{h^2} + O(h^2)
\end{equation}

Using equations (2.7), (2.8) and (2.9) in equations (2.5), (2.6), we get...
\begin{equation}
\varphi'(x_j, t) = U'(x_j, t) + O(h^4), \quad 0 \leq j \leq N
\end{equation}

For $j = 0$,

\begin{equation}
\varphi''(x_0,t) = \frac{14\Phi''(x_0,t) - 5\Phi''(x_1,t) + 4\Phi''(x_2,t) - \Phi''(x_3,t)}{12} + O(h^4)
\end{equation}

For $1 \leq j \leq N - 1$,

\begin{equation}
\varphi''(x_j,t) = \frac{\Phi''(x_{j-1},t) + 10\Phi''(x_j,t) + \Phi''(x_{j+1},t)}{12} + O(h^4)
\end{equation}

For $j = N$,

\begin{equation}
\varphi''(x_N,t) = \frac{14\Phi''(x_N,t) - 5\Phi''(x_{N-1},t) + 4\Phi''(x_{N-2},t) - \Phi''(x_{N-3},t)}{12} + O(h^4)
\end{equation}

Using equations (2.1) and (2.2), equations (2.11), (2.12), (2.13) can be reduced to be written as:

For $j = 0$,

\begin{equation}
\varphi''(x_0,t) = \frac{14g_{-1} - 33g_0 + 28g_1 - 14g_2 + 6g_3 - g_4}{2h^2}
\end{equation}

For $1 \leq j \leq N - 1$,

\begin{equation}
\varphi''(x_j,t) = \frac{g_{j-2} + 8g_{j-1} - 18g_j + 8g_{j+1} + g_{j+2}}{2h^2}
\end{equation}

For $j = N$,

\begin{equation}
\varphi''(x_N,t) = \frac{14g_{N+1} - 33g_N + 28g_{N-1} - 14g_{N-2} + 6g_{N-3} - g_{N-4}}{2h^2}
\end{equation}




\section{ Implementation of ICBSCA on the Klein-Gordon Equation }\label{sec3}

 Let $\psi = \varphi_t$ in the K-G equation (1.3). This PDE is of second order in space and time.  Using a transformation, we convert the K-G equation (1.3) is into a coupled system of the nonlinear partial differential equations,

\begin{equation}
\psi_t + \alpha \varphi_{xx} + \beta \varphi + \gamma \varphi^3 = 0, 
\end{equation}

\begin{equation}
\psi - \varphi_t = 0. 
\end{equation}

The resulting system is characterized by being first-order in 
$t$ and second-order in 
$x$, a feature that facilitates constructing a smooth cubic spline approximation. Utilizing this structure, We can now implement the method outlined in Section 2 to solve the system of equations efficiently.

Let $\varphi$ be approximated by $\Phi$ and $\psi$ be approximated by $\Psi$. Then

\begin{equation}
\Phi(x, t) = \sum_{j=-1}^{N+1} g_j(t) Q_j(x) 
\end{equation}
\begin{equation}  
\Psi(x, t) = \sum_{j=-1}^{N+1} f_j(t) Q_j(x) 
\end{equation}\\

where $g_j$'s and $f_j$'s are time-dependent quantities that we need to determine.

We discretize K-G equation (1.3) by Crank-Nicolson scheme to get

\begin{equation}
\frac{\Psi^{(n+1)} - \Psi^{(n)}}{\Delta t} + \alpha\frac{\Phi^{(n+1)}_{xx} + \Phi^{(n)}_{xx}}{2} + \beta \frac{\Phi^{(n+1)} + \Phi^{(n)}}{2} + \gamma \frac{(\Phi^{(3)})^{(n+1)} + (\Phi^{(3)})^{(n)}}{2} = 0 
\end{equation}
\begin{equation}
\frac{\Phi^{(n+1)} - \Phi^{(n)}}{\Delta t} = \frac{\Psi^{(n+1)} + \Psi^{(n)}}{2} 
\end{equation}\\

To deal with cubic non-linearity $\Phi^{(3)}^{(n+1)}$, the Rubin-Graves method is employed in Equation (3.5), we get

\begin{equation}
\frac{\Psi^{(n+1)} - \Psi^{(n)}}{\Delta t} + \alpha\frac{\Phi^{(n+1)}_{xx} + \Phi^{(n)}_{xx}}{2} + \beta \frac{\Phi^{(n+1)} + \Phi^{(n)}}{2} + \gamma \frac{3\Phi^{(n+1)} (\Phi^{2(n)}) - (\Phi^{3(n)})}{2} = 0 
\end{equation}
By separating the terms of the $(n)$th and $(n+1)$th time levels, we obtain
\begin{align}
\Psi^{(n+1)} + \Phi^{(n+1)} \left[ \frac{3\gamma \Delta t (\Phi^{(2)})^n}{2} + \frac{\beta \Delta t }{2} \right] + 
\Phi^{(n+1)}_{xx}\left [\alpha \frac{\Delta t}{2}\right] & = \Psi^{(n)} + \Phi^{(n)} \left[ \frac{\gamma \Delta t (\Phi^{(2)})^{(n)}}{2} - \frac{\beta \Delta t }{2} \right]       \nonumber \\
&-\Phi^{(n)}_{xx}\left[\frac{\alpha\Delta t }{2}\right]
\end{align}

\begin{equation}
\Phi^{(n+1)}-\Psi^{(n+1)} \left( \frac{\Delta t}{2}\right) =  \Phi^{(n)} + \Psi^{(n)}\left(\frac{\Delta t}{2}\right)
\end{equation}

Let 

\[
x_1 = \frac{3\gamma \Delta t (\Phi^{(2)})^{(n)}}{2}+ \frac{\beta\Delta t }{2}, \quad x_2 = \frac{\gamma \Delta t (\Phi^{(2)})^{(n)}}{2} - \frac{\beta \Delta t} {2}, \quad x_3 = \frac{\alpha \Delta t} {4h^2}, \quad x_4 = \frac{\Delta t}{2}
\]

Simplifying equations (3.8) and (3.9), we get
\begin{equation}
\Psi^{(n+1)} + x_1 \Phi^{(n+1)} + \Phi^{(n+1)}_{xx}\left[\frac{\alpha\Delta t }{2}\right]  = \Psi^{(n)} + x_2\Phi^{(n)} - (\Phi^{(n)}_{xx})\left[\frac{\alpha\Delta t }{2}\right] 
\end{equation}

\begin{equation}
\Phi^{(n+1)} - x_4 \Psi^{(n+1)} = \Phi^{(n)} + x_4\Psi^{(n)}
\end{equation}

For $j = 0$, equation (3.10) reduces to
\\ \\
$\begin{aligned}
& {\left[f_{-1}^{(n+1)}+4 f_0^{(n+1)}+f_1^{(n+1)}\right]+x_1\left[g_{-1}^{(n+1)}+4 g_0^{(n+1)}+g_1^{(n+1)}\right]+x_3\left[14 g_{-1}^{(n+1)}-33 g_0^{(n+1)}+\right.} \\ & \left.28 g_1^{(n+1)}-14 g_2^{(n+1)}+6 g_3^{(n+1)}-g_4^{(n+1)}\right]=\left[f_{-1}^{(n)}+4 f_0^{(n)}+f_1^{(n)}\right]+x_2\left[g_{-1}^{(n)}+4 g_0^{(n)}+\right.\end{aligned}$

$$
\left.g_1^{(n)}\right]-x_3\left[14 g_{-1}^{(n)}-33 g_0^{(n)}+28 g_1^{(n)}-14 g_2^{(n)}+6 g_3^{(n)}-g_4^{(n)}\right]
$$

We may write it as
$$
\begin{aligned}
& s_1 g_{-1}^{(n+1)}+s_2 g_0^{(n+1)}+s_3 g_1^{(n+1)}+s_4 g_2^{(n+1)}+s_5 g_3^{(n+1)}+s_6 g_4^{(n+1)}+f_{-1}^{(n+1)}+4 f_0^{(n+1)}+ \\
& f_1^{(n+1)}=b_1 g_{-1}^{(n)}+b_2 g_0^{(n)}+b_3 g_1^{(n)}+b_4 g_2^{(n)}+b_5 g_3^{(n)}+b_6 g_4^{(n)}+f_{-1}^{(n)}+4 f_0^{(n)}+f_1^{(n)}
\end{aligned}
$$

For $j=0$, equation (3.11) reduces to
\begin{equation}
\begin{aligned}
& {\left[g_{-1}^{(n+1)}+4 g_0^{(n+1)}+g_1^{(n+1)}\right]-x_4\left[f_{-1}^{(n+1)}+4 f_0^{(n+1)}+f_1^{(n+1)}\right]=\left[g_{-1}^{(n)}+4 g_0^{(n)}+g_1^{(n)}\right]+} \\
& x_4\left[f_{-1}^{(n)}+4 f_0^{(n)}+f_1^{(n)}\right] \\
& g_{-1}^{(n+1)}+4 g_0^{(n+1)}+g_1^{(n+1)}-x_4 f_{-1}^{(n+1)}-4 x_4 f_0^{(n+1)}-x_4 f_1^{(n+1)}=g_{-1}^{(n)}+4 g_0^{(n)}+g_1^{(n)}+ \\
& x_4 f_{-1}^{(n)}+4 x_4 f_0^{(n)}+x_4 f_1^{(n)}
\end{aligned}
\end{equation}


For $1 \leq j \leq N-1$, equation (3.10) reduces to
\begin{equation}
\begin{aligned}
& {\left[f_{j-1}^{(n+1)}+4 f_j^{(n+1)}+f_{j+1}^{(n+1)}\right]+x_1\left[g_{j-1}^{(n+1)}+4 g_j^{(n+1)}+g_{j+1}^{(n+1)}\right]+x_3\left[g_{j-2}^{(n+1)}+8 g_{j-1}^{(n+1)}-\right.} \\
& \left.18 g_j^{(n+1)}+8 g_{j+1}^{(n+1)}+g_{j+2}^{(n+1)}\right]=\left[f_{j-1}^{(n)}+4 f_j^{(n)}+f_{j+1}^{(n)}\right]+x_2\left[g_{j-1}^{(n)}+4 g_j^{(n)}+g_{j+1}^{(n)}\right]- \\
& x_3\left[g_{j-2}^{(n)}+8 g_{j-1}^{(n)}-18 g_j^{(n)}+8 g_{j+1}^{(n)}+g_{j+2}^{(n)}\right]
\end{aligned}
\end{equation}

We may write it as
$$
\begin{aligned}
& t_1 g_{j-2}^{(n+1)}+t_2 g_{j-1}^{(n+1)}+t_3 g_j^{(n+1)}+t_2 g_{j+1}^{(n+1)}+t_1 g_{j+2}^{(n+1)}+f_{j-1}^{(n+1)}+4 f_j^{(n+1)}+f_{j+1}^{(n+1)}= \\
& p_1 g_{j-2}^{(n)}+p_2 g_{j-1}^{(n)}+p_3 g_j^{(n)}+p_2 g_{j+1}^{(n)}+p_1 g_{j+2}^{(n)}+f_{j-1}^{(n)}+4 f_j^{(n)}+f_{j+1}^{(n)}
\end{aligned}
$$

For $1 \leq j \leq N-1$, equation (3.11) reduces to
$$
\begin{aligned}
& {\left[g_{j-1}^{(n+1)}+4 g_j^{(n+1)}+g_{j+1}^{(n+1)}\right]-x_4\left[f_{j-1}^{(n+1)}+4 f_j^{(n+1)}+f_{j+1}^{(n+1)}\right]=\left[g_{j-1}^{(n)}+4 g_j^{(n)}+g_{j+1}^{(n)}\right]+} \\
& x_4\left[f_{j-1}^{(n)}+4 f_j^{(n)}+f_{j+1}^{(n)}\right] \\
& g_{j-1}^{(n+1)}+4 g_j^{(n+1)}+g_{j+1}^{(n+1)}-x_4 f_{j-1}^{(n+1)}-4 x_4 f_j^{(n+1)}-x_4 f_{j+1}^{(n+1)}=g_{j-1}^{(n)}+4 g_j^{(n)}+g_{j+1}^{(n)}+ \\
& x_4 f_{j-1}^{(n)}+4 x_4 f_j^{(n)}+x_4 f_{j+1}^{(n)}
\end{aligned}
$$
For $j=N$, equation (3.10) reduces to
$$
\left[f_{N-1}^{(n+1)}+4 f_N^{(n+1)}+f_{N+1}^{(n+1)}\right]+x_1\left[g_{N-1}^{(n+1)}+4 g_N^{(n+1)}+g_{N+1}^{(n+1)}\right]+x_3\left[14 g_{N+1}^{(n+1)}-33 g_N^{(n+1)}+\right.
$$
$$
\begin{aligned}
& \left.28 g_{N-1}^{(n+1)}-14 g_{N-2}^{(n+1)}+6 g_{N-3}^{(n+1)}-g_{N-4}^{(n+1)}\right]=\left[f_{N-1}^{(n)}+4 f_N^{(n)}+f_{N+1}^{(n)}\right]+x_2\left[g_{N-1}^{(n)}+4 g_N^{(n)}+\right. \\
& \left.g_{N+1}^{(n)}\right]-x_3\left[14 g_{N+1}^{(n)}-33 g_N^{(n)}+28 g_{N-1}^{(n)}-14 g_{N-2}^{(n)}+6 g_{N-3}^{(n)}-g_{N-4}^{(n)}\right]
\end{aligned}
$$

We may write it as
$$
\begin{aligned}
& v_1 g_{N-4}^{(n+1)}+v_2 g_{N-3}^{(n+1)}+v_3 g_{N-2}^{(n+1)}+v_4 g_{N-1}^{(n+1)}+v_5 g_N^{(n+1)}+v_6 g_{N+1}^{(n+1)}+f_{N-1}^{(n+1)}+4 f_N^{(n+1)}+ \\
& f_{N+1}^{(n+1)}=w_1 g_{N-4}^{(n)}+w_2 g_{N-3}^{(n)}+w_3 g_{N-2}^{(n)}+w_4 g_{N-1}^{(n)}+w_5 g_N^{(n)}+w_6 g_{N+1}^{(n)}+f_{N-1}^{(n)}+4 f_N^{(n)}+ \\
& f_{N+1}^{(n)}
\end{aligned}
$$

For $j=N$, equation (3.11) reduces to
$$
\begin{aligned}
& {\left[g_{N-1}^{(n+1)}+4 g_N^{(n+1)}+g_{N+1}^{(n+1)}\right]-x_4\left[f_{N-1}^{(n+1)}+4 f_N^{(n+1)}+f_{N+1}^{(n+1)}\right]=\left[g_{N-1}^{(n)}+4 g_N^{(n)}+g_{N+1}^{(n)}\right]+} \\
& x_4\left[f_{N-1}^{(n)}+4 f_N^{(n)}+f_{N+1}^{(n)}\right] \\
& g_{N-1}^{(n+1)}+4 g_N^{(n+1)}+g_{N+1}^{(n+1)}-x_4 f_{N-1}^{(n+1)}-4 x_4 f_N^{(n+1)}-x_4 f_{N+1}^{(n+1)}=g_{N-1}^{(n)}+4 g_N^{(n)}+g_{N+1}^{(n)}+ \\
& x_4 f_{N-1}^{(n)}+4 x_4 f_N^{(n)}+x_4 f_{N+1}^{(n)}
\end{aligned}
$$

Hence, we get the following system of linear equations,
$$
A Z^{(n+1)}=B Z^{(n)}
$$
where $Z=\left[g_{-1}, f_{-1}, g_0, f_0, g_1, f_1, \ldots, g_{N+1}, f_{N+1}\right]^T$
\\

\resizebox{1\textwidth}{55}{
\[$
A = 
\left[
\begin{array}{cccccccccccccccccccccc}
s_1 & 1 & s_2 & 4 & s_3 & 1 & s_4 & \cdots & s_5 & \cdots & s_6 & & & & & & & & & & \\
1 & -x_4 & 4 & -4x_4 & 1 & -x_4 & \cdots & \cdots & \cdots & \cdots & \cdots & & & & & & & & & & \\
t_1 & \cdots & t_2 & 1 & t_3 & 4 & t_2 & 1 & t_1 & \cdots & \cdots & & & & & & & & & & \\
\cdots & \cdots & 1 & -x_4 & 4 & -4x_4 & 1 & -x_4 & \cdots & \cdots & \cdots & & & & & & & & & \\
& & & & & & & & & \ddots & \ddots & \ddots & & & & & & & & & \\
& & & & & & & & \ddots & \ddots & \ddots & & & & & & & & & & & \\
& & & & & & & \cdots & \cdots & t_1 & \cdots & t_2 & 1 & t_3 & 4 & t_2 & 1 & t_1 & \cdots \\
& & & & & & & \cdots & \cdots & \cdots & \cdots & 1 & -x_4 & 4 & -4x_4 & 1 & -x_4 & \cdots & \cdots \\
& & & & & & & v_1 & \cdots & v_2 & \cdots & v_3 & \cdots & v_4 & 1 & v_5 & 4 & v_6 & 1 \\
& & & & & & & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & 1 & -x_4 & 4 & -4x_4 & 1 & -x_4
\end{array}
\right]
$\]
}
\\ \\

\resizebox{1\textwidth}{55}{
\[
B = 
\left[
\begin{array}{cccccccccccccccccccccccccc}
b_1 & 1 & b_2 & 4 & b_3 & 1 & b_4 & \cdots & b_5 & \cdots & b_6 & & & & & & & & & & & \\
1 & x_4 & 4 & 4 x_4 & 1 & x_4 & \cdots & \cdots & \cdots & \cdots & \cdots & & & & & & & & & & & \\
p_1 & \cdots & p_2 & 1 & p_3 & 4 & p_2 & 1 & p_1 & \cdots & \cdots & & & & & & & & & & & & \\
\cdots & \cdots & 1 & x_4 & 4 & 4 x_4 & 1 & x_4 & \cdots & \cdots & \cdots & & & & & & & & & & & \\
& & & & & & & & \ddots & \ddots & \ddots & & & & & & & & & & & \\
& & & & & & & & \ddots & \ddots & \ddots & & & & & & & & & & & \\
& & & & & & & & & \cdots & \cdots & p_1 & \cdots & p_2 & 1 & p_3 & 4 & p_2 & 1 & p_1 & \cdots \\
& & & & & & & & & \cdots & \cdots & \cdots & \cdots & 1 & x_4 & 4 & 4 x_4 & 1 & x_4 & \cdots & \cdots \\
& & & & & & & & & w_1 &\cdots & w_2 & \cdots & w_3 & \cdots & w_4 & 1 & w_5 & 4 & w_6 & 1 \\
& & & & & & & & & \cdots & \cdots & \cdots & \cdots & \cdots & \cdots & 1 & x_4 & 4 & 4 x_4 & 1 & x_4
\end{array}
\right]
\]
}\\

In this case we get $2(N+3)$ unknowns and $2(N+1)$ equations. We can eliminate the following  \( g_{-1}, f_{-1}, g_{N+1}, f_{N+1} \)   via  boundary conditions and reducing the system into \( 2(N+1) \) unknowns \( 2(N+1) \) equations. Now the system of equations can be solved with the initial vector 
\[
\begin{bmatrix} g_0, f_0, g_1, f_1, \dots, g_N, f_N \end{bmatrix}^T
\]
at any specified time level, the B-spline approximation of the initial condition is used to obtain the initial vector
\section{Stability Analysis}
From equation (3.13), we have
% Main equations in multline* for line breaks
\begin{equation}
\begin{align*}
&\left[ f_{j-1}^{(n+1)} + 4f_{j}^{(n+1)} + f_{j+1}^{(n+1)} \right] 
+ x_1 \left[ g_{j-1}^{(n+1)} + 4g_{j}^{(n+1)} + g_{j+1}^{(n+1)} \right]+ x_3 \bigg[ g_{j-2}^{(n+1)} + 8g_{j-1}^{(n+1)} - 18g_{j}^{(n+1)}\\
&+ 8g_{j+1}^{(n+1)} + g_{j+2}^{(n+1)} \bigg]= \left[ f_{j-1}^{(n)} + 4f_{j}^{(n)} + f_{j+1}^{(n)} \right] 
+ x_2 \left[ g_{j-1}^{(n)} + 4g_{j}^{(n)} + g_{j+1}^{(n)} \right]- x_3 \bigg[ g_{j-2}^{(n)} + \\
&\hspace{3.8cm}8g_{j-1}^{(n)} - 18g_{j}^{(n)} + 8g_{j+1}^{(n)} + g_{j+2}^{(n)} \bigg],
\end{align*}
\end{equation}
Substituting 
\[
g_j^n = A_1 \, \xi^n e^{i j \mu h} \quad \text{and} \quad f_j^n = A_2 \, \xi^n e^{i j \mu h}
\]
where \( h \) is the step size, \( A_1 \) and \( A_2 \) are amplitudes, and \( \mu \) is the mode number, we take $L = e^{i \mu h}$ then we have,

\begin{align}
  & A_2\,\xi^{n+1} \bigg[e^{-L} + 4 + e^{L}\bigg]
+ A_1\,\xi^{n+1} \bigg[x_3 e^{-2L} + (x_1\!+\!8x_3) e^{-L} + (4x_1\!-\!18x_3)\nonumber \\
&+ (x_1\!+\!8x_3) e^{L} + x_3 e^{2L}\bigg] = \nonumber  A_2\,\xi^{n} \bigg[e^{-L} + 4 + e^{L} \bigg] 
+ A_1\,\xi^{n} \bigg[-x_3 e^{-2L} + (x_1 - 8x_3) e^{-L} \nonumber \\
& \hspace{3.8cm}+ (4x_2 + 18x_3) + (x_1 - 8x_3) e^{L}  - x_3 e^{2L}\bigg] 
.
\end{align}
\begin{flalign}
&\xi = \frac{A_2 \left[e^{-L} + 4 + e^{L}\right] + A_1 \left[-x_3 e^{-2L} + (x_2 - 8x_3) e^{-L} + (4x_2 + 18x_3) + (x_2 - 8x_3) e^{L} - x_3 e^{2L}\right]}{A_2 \left[e^{-L} + 4 + e^{L}\right] + A_1 \left[x_3 e^{-2L} + (x_1 + 8x_3) e^{-L} + (4x_1 - 18x_3) + (x_1 + 8x_3) e^{L} + x_3 e^{2L}\right]}&
\end{flalign}
\begin{align}
\xi = \frac{A_2 \left[ 2\cos(\mu h) + 4 \right] + A_1 \left[ x_3 \left(-2\cos(2\mu h)\right) + 2\left(x_2 - 8x_3\right )\cos(\mu h) + 4x_2 + 18x_3 \right]}{A_2 \left[2\cos(\mu h) + 4 \right) + A_1 \left( 2\cos(2\mu h) x_3 + 2(x_1 + 8x_3) \cos(\mu h) + 4x_1 - 18x_3 \right]}
\end{align}
For stability, we should have
\[
|\xi|^2 < 1
\]
\[
\Rightarrow \left| \frac{P}{Q + Ri} \right|^2 < 1 \quad \Leftrightarrow \quad \left| \frac{Q + Ri}{P} \right|^2 > 1
\]
Our goal is to prove that \[
Q^2 + R^2 - P^2 > 0
\] 
The minimum value of \( Q^2 + R^2 - P^2 \) occurs when \(\cos\mu h = 1\). Imposing the condition on equation 4.4 we get \[
72A_1A_2(x_1 - x_2)
\] which is clearly positive.
Therefore, the present approach is unconditionally stable .
\section{Computational Results and Analysis}\label{sec4}
To verify the validity and efficiency of the proposed approach, we calculate the discrepancy between the numerical and exact solutions using  maximum absolute errors and $L_2$ errors

At time $t$, the numerical results represent the conservation laws for energy $ E(t)$ and momentum $P(t)$
) \cite{jhangeer2014conserved} 
\begin{equation}
E(t) = \frac{1}{2} \int_{-\infty}^{\infty} \left(\varphi_t^2 + \varphi_x^2 + \beta \varphi + \gamma \varphi^3\right) dx
\end{equation}
\begin{equation}
P(t) = \int_{-\infty}^{\infty} \left(\varphi_x \varphi_t\right) dx
\end{equation}
For the nonlinear K-G equation, these conservation laws can also serve as reliable indicators of the method's validity, even in the absence of analytical solutions.

The fractional changes \( R(E_t) \) and \( R(P_t) \) of conservation principles \( E \) and \( P \) are expressed as
\begin{equation}
R(E_t) = \bigg |\frac{E_t - E_0}{E_0}\bigg|
\end{equation}
\begin{equation}
R(P_t) = \bigg|{\frac{P_t - P_0}{P_0}}\bigg|
\end{equation}
where \( E_0 \) and \( P_0 \) indicate the initial quantities of energy and momentum, whereas  \( E_t \) and \( P_t \)
  are the respective calculated values at time \(t)\.

\subsection{ For $\alpha = -1$, 
$\beta = -1$, $\gamma = 1$, and $-1<s<1$}\label{p1} 
In the nonlinear K-G equation (1.3), we consider the above parameters. These parameter selection yields an exact solution of the following form: 

\begin{equation}
\varphi(x, t) = \tanh \left( \frac{x - st}{\sqrt{2(1 - s^2)}} \right) 
\end{equation}

with initial conditions:

\begin{equation}
\varphi(x, 0) = \tanh \left( \frac{x}{\sqrt{2(1 - s^2)}}\right), \quad \varphi_t(x, 0) = 0 
\end{equation}

and homogeneous Neumann boundary conditions

\begin{equation}
\varphi_x(-30, t) = 0, \quad \varphi_x(30, t) = 0 
\end{equation}
The parameter $s$ represents the speed of the traveling wave. The existence of this exact solution relies on the condition $-1 < s < 1$. Based on the sign of $s$, The wave's direction - either leftward or rightward along the $x$-axis - is determined by the sign of s. We assume a wave velocity of $s = 0.5$ for simplicity. The initial conditions for the numerical computation are obtained from the exact solution (5.6) by setting  $t = 0$. To satisfy the requirements of the iterative algorithm, homogeneous Neumann boundary conditions are imposed at both ends of the finite domain $[-30, 30]$. The proposed approach has been employed to solve this problem for different values of $h$ and $\Delta t$.
Fig. \ref{Fig 1} depicts the space–time graph for $t = 10$, with $h = 0.2$, $\Delta t = 0.05$. Fig. \ref{Fig 2} and Fig. \ref{Fig 3} depict the maximum error distribution graph of the traveling waves for parameters $s = 0.5$ and $s = 0.05$, respectively, up to $t = 10$ with $h = 0.2$, $\Delta t = 0.05$. 

Table \ref{Table 1} represents a comparative analysis of the error norms between the current approach and Korkmaz's approach. \cite{korkmaz2016trigonometric} at $t = 10$ for various values of $h$ and $\Delta t$. 
It can be seen that the present approach generates the results one decimal digit better as compared to those of Korkmaz \cite{korkmaz2016trigonometric} for the same parameters. 
 
Table \ref{Table 2} shows error norms $L_\infty$, $L_2$,  global relative error (GRE) and rate of the convergence of the present approach at time $t = 0.2$  and $\Delta t = 0.01$. 
It can be inferred from Table \ref{Table 2} that the present approach maintains good accuracy.

It should be noted that the energy conservation law has been conveniently integrated into the finite interval $[-30, 30]$. As shown in Table \ref{Table 3}, the calculated fractional changes for different discretization parameter values show that the momentum(P) and energy(E) were accurately conserved during the numerical computation for the time $t = 10$. The fractional change of the energy is maintained with at least  seven decimal accuracy. The momentum's fractional change is accurate to four decimal places.

When we use parameters $t = 0.01$ and $h = 0.05$, the accuracy improves significantly: nine decimal places for the energy conservation law and five decimal places for the momentum conservation law.
Table \ref{Table 4} represents $L_\infty$ and $L_2$ error norms of the present approach for different values of the parameter $s = -0.5, -0.3, -0.1, 0, 0.1, 0.3, 0.5$ for time $t = 10$ and $h = 0.2$, $\Delta t = 0.05$.


\begin{figure}
    \centering
\includegraphics[width=14cm,height=10cm]{ex1_surface_t10.eps}
    \caption{3D figure of the traveling waves for t = 10, with h = 0.2, $ \Delta t= 0.05$ for Problem \ref{p1}.}
    \label{Fig 1}        
\end{figure}

\begin{figure}
\centering
\includegraphics[width=\textwidth]{ex1_errornorms0.5.eps}
    \caption{Maximum error distribution of the traveling waves for parameter $s = 0.5$ up to $t = 10.$ for Problem \ref{p1}.}
    \label{Fig 2}
 \end{figure}
 
\begin{figure}
\centering
\includegraphics[width=\textwidth]{ex1_errornorms0.05.eps}
\caption{Maximum error distribution of the traveling waves for parameter $s = 0.05$ up to $t = 10$ for Problem \ref{p1}.}
      \label{Fig 3}
\end{figure}

\textbf{Review: }The errors for Problem \ref{p1} is significantly smaller for $s = 0.05 $ compared to $s = 0.5$, which indicates that the error is reduced as the parameter $s$ decreases. The error distribution for $s = 0.5$ is more localized around a single peak, while for $s = 0.05$, the error is more spread out and shows multiple oscillations. These figures highlight how the choice of $s$ influences the error distribution, with larger s leading to localized errors and smaller $s$ resulting in a more spread-out and oscillatory error pattern. This might suggest that different values of $s$ affect the stability and accuracy of numerical solutions for the traveling wave in the K-G equation.
\begin{table}[h]
\centering
\caption{Comparison of $L_{\infty}$ values between Korkmaz \cite{korkmaz2016trigonometric} and Current approach for varying values of $h$ and $\Delta t$ in the Problem \ref{p1}}.
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}cccc} % Removed the leading 1
\toprule
$h$ & $\Delta t$ & Korkmaz\cite{korkmaz2016trigonometric}$L_{\infty}$ & Present approach $L_{\infty}$ \\
\midrule
0.2  & 0.05  & 1.4525E-003 & 7.0229E-004 \\
0.1  & 0.02  & 4.4025E-004 & 1.1245E-004 \\
0.05 & 0.01  & 1.1098E-004 & 2.8314E-005 \\
\bottomrule
\end{tabular*}
\label{Table 1}
\end{table}
\begin{table}[h]
\centering
\caption{Error norms and rate of convergence of the present approach at $t$ = $0.2$ for Problem \ref{p1}.}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ccccc} % Removed the leading 1
\toprule
$N$ & $L_{2}(t)$ & Rate & $L_\infty(t)$ & GRE \\
\midrule
75 & 2.1725E-04 & --      & 2.5502E-04 & 2.5438E-05 \\
150 & 2.6780E-05 & 3.9501   & 1.6594E-05 & 1.2294E-06 \\
300 & 2.5171E-05 & 3.9804   & 1.0513E-06 & 1.4813E-07 \\
600 & 8.4090E-07 & 4.0895   & 1.7897E-07 & 3.5022E-08 \\

\bottomrule
\end{tabular*}
\label{Table 2}
\end{table}
\begin{table}[h!]
        \centering
       \caption{Absolute relative changes of conservation laws of the present approach at $t = 10$ in Problem \ref{p1}.}
        \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}cccc} % Removed the leading 1
            \toprule
            $h$ & $\Delta t$ & \multicolumn{2}{c}{Present approach} \\
            \cmidrule(lr){3-4}
             &  & $R(E_{10})$ & $R(P_{10})$ \\
            \midrule
            0.2  & 0.05 & 6.9250E-007 & 2.1982E-005 \\
            0.1  & 0.02 & 4.4522E-008 & 4.7156E-006 \\
            0.05 & 0.01 & 5.5767E-009 & 1.2981E-005 \\
            \bottomrule
        \end{tabular*}
        \label{Table 3}
\end{table}
\begin{table}[h!]
    \centering
    \caption{$L_{\infty}$ and $L_2$ error norm of the present approach for different values of the parameter $s$ at $t = 10$ for Problem \ref{p1}.}
     \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ccc} % Removed the leading 1
        \toprule
        $s$ & $L_{\infty}(10)$ & $L_2(10)$ \\
        \midrule
        -0.5 & 7.0229E-04 & 2.1000E-05 \\
        -0.3 & 1.1546E-04 & 3.6216E-05 \\
        -0.1 & 3.0815E-06 & 1.0737E-06 \\
        0    & 3.8892E-06 & 1.3080E-06 \\
        0.1  & 3.0815E-06 & 1.0737E-06 \\
        0.3  & 1.1546E-04 & 3.6216E-05 \\
        0.5  & 7.0229E-04 & 2.1000E-05 \\
        \bottomrule
    \end{tabular*}
    \label{Table 4}
    \end{table}\\
    
\subsection{ For $\alpha = -1$, 
$\beta = -1$, $\gamma = 1$ and $s=\sqrt2$}\label{p2}
Results are calculated for given parameters and corresponding exact solution is
\begin{equation}
\varphi(x, t) = \pm \sqrt{2} \, \text{sech} \left( \pm \frac{1}{\sqrt{s^2 - 1}}(x + st) \right)
\end{equation}


Consider positive solutions in the domain $ x \in [-8, 8] $ and $t \in [0,1]$
subject to Dirichlet boundary conditions
$\varphi(-8, t) = \varphi(8, t) = 0$.

Fig. \ref{Fig 4} compares the exact and numerical solutions of the problem \ref{p2} for $t=0.1$. The continuous blue line shows the exact solution, and the yellow dashed line represents the approximate solution. The close overlap between the two lines suggests that the numerical solution accurately approximates the exact solution for the K-G equation.

Fig. \ref{Fig 5} illustrates a 3D plot of the solution $\varphi(x, t)$ across the same spatial and temporal domains. The X-axis represents the spatial variable and the Y-axis represents the field value at each point $x$ at time t=0.1. The graph shows a solitary, stable and localized wave that maintains its shape as it travels, presenting the evolution of the solution over time. The color gradient represents changes in the solution’s magnitude, visually understanding its dynamics over space and time. 

\begin{figure}
\centering
%\begin{subfigure}{0.5\textwidth}
      \includegraphics[width=14cm,height=7cm]{klein.numerical.eps}
    \caption{ Numerical solution for \ref{p2}.}  
    \label{Fig 4}
    \end{figure}
    \begin{figure}[H]
    \centering
      \includegraphics[width=14cm,height=7cm]{kleinapproximate.eps}
    \caption{Space time figure of numerical solution for $s=\sqrt{2}$ for Problem \ref{p2}.}
      \label{Fig 5}     
\end{figure}


  The error norms are shown in Table \ref{Table 6}. This table illustrates the accuracy ( through $L_\infty$ and $L_2$).
\begin{table}[h]
    \centering
        \caption{Absolute errors at grid points for different times $T$ for Problem \ref{p2}.}
        \label{Table 6}
       \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}cccc} % Removed the leading 1
            \toprule
            $x_i$ & $T=0.5$ & $T=1$ &  $T=2$ \\
            \midrule
            2.1 & 1.0837E-06 & 1.4579E-06 &  2.872E-05 \\
            2.2 & 1.1223E-06 & 8.5892E-07 &  2.5073E-05 \\
            2.3 & 1.1231E-06 & 4.0948E-07 &  2.1636E-05 \\
            2.4 & 1.0976E-06 & 8.0880E-07 &  1.8345E-05 \\
            2.5 & 1.051E-06 & 1.5235E-07 &  1.5284E-05 \\
            \bottomrule
        \end{tabular*}
  \end{table}

 \textbf{Review:} The Figures for Problem \ref{p2} clearly visualizes the change in amplitude and structure of $\varphi(x, t)$ as t progresses. The solution starts with a pronounced peak near $t=0$, gradually dissipating as t increases. The graph shows a solitary, stable and
localized wave that maintains its shape as it travels, presenting the evolution of the
solution over time. 

\subsection{ For $\alpha = -1$, 
$\beta = -1$, $\gamma = 1$ and $s=-4$}\label{p3}
For the given parameters, Fig. \ref{Fig 6} shows the exact solution and Fig. \ref{Fig 7} comparison between numerical and exact solutions. The absolute error are shown in the Table \ref{Table 7}.

\textbf{Review: } In Problem \ref{p2}, the wave speed is taken as $s=\sqrt{2}$ which leads to a wider, more slowly moving soliton
while in this Problem, a larger magnitude \( s = -4 \)
 leads to a faster and more sharply defined soliton. If we analyze the figures of solution for Problem \ref{p2} for $s=\sqrt{2}$,  soliton 
would look like a smoothly moving, broader wave. While on the other hand for \( s = -4 \),
  soliton 
 would look like a sharply peaked, quickly moving wave in the opposite direction. In summary, the  soliton 
 with $s=\sqrt{2}$ moves slower and is more spread out, while the  soliton 
with 
\( s = -4 \)  moves faster and is more sharply peaked, but in the opposite direction. 
\begin{table}[h]
    \centering
        \caption{$L_\infty$ and $L_2$ errors with CPU time for $\Delta x = 0.1$ and $\Delta t = 0.1$ for Problem \ref{p3}.}
        \label{Table 7}
       \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}cccc} % Removed the leading 1
            \toprule
            $x_i$ & $L_2$ & $L_\infty$ & CPU time (sec) \\
            \midrule
            2.1 & 1.6145E-06 & 1.6145E-06 & 1.9 \\
            2.2 & 1.6202E-06 & 1.6202E-06 & 2.0 \\
            2.3 &  1.6170E-06 &  1.6170E-06 & 1.9 \\
            2.4 & 1.6054E-06 & 1.6054E-06 & 1.9 \\
            2.5 & 1.5862E-06 & 1.5862E-06 & 1.9 \\
            \midrule
            \multicolumn{2}{c}{$L_2 $norm } & \multicolumn{2}{c}{$9.7487E-04$}\\
            \bottomrule
        \end{tabular*}
  \end{table}


   % \begin{subfigure}{0.4\textwidth}
    \begin{figure}[H]
    \centering
    \includegraphics[width=14cm,height=7cm]{klein4aa.eps}
    \caption{ Numerical solution for Problem \ref{p3}}
      \label{Fig 7}
      % \end{subfigure}
\end{figure}
\begin{figure}[H]
\centering
%\begin{subfigure}{0.6\textwidth}

       \includegraphics[width=14cm,height=7cm]{klein4ab.eps}
    
    \caption{Space time figure of numerical solution\\ for \( s = -4 \)
in Problem \ref{p3}.}
\label{Fig 6}
    %\end{subfigure}
    \end{figure}

\subsection{ For $\alpha = -1, \beta = 1, \gamma = -1/6$ and $s=0.5$}\label{p4}
Taking  $\alpha = -1$ ,  $\beta = 1 $ \text{ and } $\gamma=\frac{-1}{6} $ for different times with wave speed  $s= \-0.5$ and corresponding exact solution is
\begin{equation}
\varphi(x, t) = \pm \sqrt{3} \, \text{sech}\left( \pm \frac{1}{\sqrt{1 - s^2}}(x + st)\right)
\end{equation}
We consider the positive solution over the domain $ x \in [-2{\pi}, 2{\pi}] $ and time domain $t \in [0,4]$, subject to zero flux Neumann boundary condition. The results are demonstrated for spatial size $ h =0.1$  and time step size $\Delta t= 0.001 $ in Fig. \ref{Fig 8} and  absolute errors in Table \ref{Table8}. CPU time for these computations is very small, indicating that the numerical approach is not only accurate but also highly efficient.
\begin{figure}[H]
    \centering
    \includegraphics[width=14cm,height=7cm]{klein.5a.eps}
    \caption{Numerical solution at time t = 0.01 and 0.05 for Problem \ref{p4}}
    \label{Fig 8}
\end{figure}
\begin{table}[h]
        \centering
        \caption{ Error norms with Computational time (sec) for various $T$ for Problem \ref{p4}.}
        \label{Table8}
      \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ccccc} % Removed the leading 1
            \toprule
            $T$ & $L_2$ Error & $L_\infty$ Error & CPU time (sec) \\
            \midrule
            0.01 & 6.3007E-04 & 2.1213E-04 & 2.16 \\
            0.02 & 2.5000E-03 & 8.4957E-04 & 2.6 \\
            0.03 & 5.7000E-03 & 1.9000E-03 & 3.5 \\
            0.04 & 1.0100E-02 & 3.4000E-03 & 5.4 \\
            0.05 & 1.5800E-02 & 5.3000E-03 & 4.2 \\
            \bottomrule
        \end{tabular*}
\end{table}


\subsection{ For $\alpha = -1$, 
$\beta = 1$, $\gamma = 1$ and $s=1$}\label{p5}

In the nonlinear K-G equation (1.3), above parameters provides an exact solution with the initial condition:

\begin{equation}
\varphi(x, 0) = A \left( 1 + \cos \left( \frac{2\pi x}{1.28} \right) \right), \quad \varphi_t(x, 0) = 0 
\end{equation}

Here $A$ is the amplitude. The homogeneous Neumann boundary conditions are given by: 

\begin{equation}
\varphi_x(a, t) = 0, \quad \varphi_x(b, t) = 0 
\end{equation}
where  $ x \in [a, b] \in [0, 1.28] $

For this case, the periodic boundary conditions guarantee that the continuous solutions remain symmetric around the center of the spatial domain \cite{dehghan2009numerical}. Various values of $A$ have been considered in previous studies. For this problem ICBSCA has been employed with $h = 0.01$ and $\Delta t = 0.001$. Numerical solutions for $A = 100$ at $t = 0, 0.1$, and 7 are shown in Fig. \ref{Fig 9} and Fig. \ref{Fig 10}. Likewise, Fig. \ref{Fig 11} and Fig. \ref{Fig 12} depict approximate solutions for $A = 150$ at $t = 0, 0.1$, and 32, showing that the solution remains bounded for $t \in [0, 32]$. These figures illustrate the time evolution of approximate solutions for the K-G equation under different parameters. 
\begin{figure}[H]
\centering
%\begin{subfigure}{0.5\textwidth}
   \includegraphics[width=14cm,height=7cm]{ex2_a100_tpoint1.eps}
    \caption{Numerical solution for time t = 0, 0.1 with $A$ = 100, and $h = 0.01$ for Problem \ref{p5}  }
    \label{Fig 9}
 \end{figure}
 \begin{figure}[H]
 \centering
   \includegraphics[width=13cm,height=6.2cm]{ex2_a100_t7.eps}
    \caption{Numerical solution for time t = 0, 7 with $A$ = 100, and $h = 0.01$ for Problem \ref{p5}  }
    \label{Fig 10}
%\end{subfigure}
\end{figure}
\begin{figure}[H]
\centering
%\begin{subfigure}{0.5\textwidth}
   \includegraphics[width=14cm,height=7cm]{ex2_a150_tpoint1.eps}
    \caption{Numerical solution for time t = 0, 0.1 with $A$ = 150, and $h = 0.01$ for Problem \ref{p5} }
    \label{Fig 11}
 \end{figure}
 \begin{figure}[H]
 \centering
   \includegraphics[width=14cm,height=7cm]{ex2_a150_t32.eps}
    \caption{Numerical solution for time t = 0, 32 with $A$ = 100, and $h = 0.01$ for Problem \ref{p5}  }
    \label{Fig 12}
%\end{subfigure}
\end{figure}

\textbf{Review: }The initially smooth wave patterns quickly turn into oscillating states. Over time, these oscillations become more complicated, showing how sensitive and dynamic the equation's solutions are. Also amplitude $A$ significantly impacts the solution. Higher values of $A$  result in larger oscillations and more irregular behavior compared to lower values, suggesting increased instability or chaos with higher amplitudes.
These results highlight the sensitivity of the K-G equation to initial conditions and parameter values, as well as the oscillatory nature of the numerical solutions.\\

\section{Conclusion}
In this paper, we presented an improvised cubic B-spline collocation approach for efficiently solving the nonlinear K-G equation. The approach’s effectiveness is demonstrated by calculating the \(L_2\), \(L_\infty\) error norms across various standard test cases. We present 3D and 2D visualizations of the obtained solutions, showcasing improved accuracy and reduced computational time compared to other established techniques. The spline-based formulation allows for easy evaluation of the solution at  grid points, enhancing flexibility and precision.  

It is important to highlight that these methods are credible, reliable, and versatile, making them suitable for addressing a wide range of nonlinear PDEs. The results obtained have significant applications in quantum field models and offer valuable insights into the diverse phenomena encountered in the physical systems encompassed by this framework.  

Additionally, the approach is well-suited for broader applications in nonlinear partial differential equations and can be extended to two-dimensional problems using bi-cubic splines. Our findings conclude that the approximate solutions closely match the exact solutions, exhibiting higher accuracy compared to those obtained by Korkmaz. All computations were performed using MATLAB.

\section{Statement and Declaration}

\begin{itemize}
    \item \textbf{Data Availability Statement:} This study did not involve the creation or analysis of any datasets.
    \\
    \item \textbf{Funding:} The authors did not receive any funding for this study.
    \\
    \item \textbf{Author Contribution:} All authors contributed equally to the design and completion of the manuscript.
\end{itemize}







\bibliographystyle{plain}
\bibliography{mybib}
\end{document}

\begin{table}

\renewcommand\thetable{7}
\centering
\caption{$E_{\text{rms}}$ and $E_{\max}$ of Example \ref{eg7} for different values of $\nu$ and $\kappa$.}
\begin{tabular}{lccccccc}
\toprule
$n$&$E_{\text{rms}}$&$E_{\max}$&Order&$E_{\text{rms}}$&$E_{\max}$&Order\\
\midrule
&\multicolumn{3}{c}{$\nu=0.5,\kappa=4$}&\multicolumn{3}{c}{$\nu=0.75, \kappa=3.75$}\\

\cmidrule(lr){2-4}\cmidrule(lr){5-7}
64&8.1615e–06&1.3870e–06&&1.2083e–05&2.1036e–06&\\
128&9.5733e–07&1.1420e–07&3.6022&1.4311e–06&1.8368e–07&3.5176\\
256&9.2673e–08&7.6440e–09&3.9012&1.4228e–07&1.3942e–08&3.7197\\
512&8.4725e–09&4.8412e–10&3.9809&1.3359e–08&1.0381e–09&3.7474\\
1024&7.5967e–10&3.0347e–11&3.9957&1.2247e–09&7.7164e–11&3.7499\\
\bottomrule
\end{tabular}
\label{t:7}
\end{table}
\bibliographystyle{plain}
\bibliography{mybib}
\end{document}
%\noindent
T%he input format for the above table is as follows:

%%=============================================%%
%% For presentation purpose, we have included  %%
%% \bigskip command. Please ignore this.       %%
%%=============================================%%
%\bigskip
%\begin{verbatim}
\begin{table}[<placement-specifier>]
\caption{<table-caption>}\label{<table-label>}%
\begin{tabular}{@{}llll@{}}
\toprule
Column 1 & Column 2 & Column 3 & Column 4\\
\midrule
row 1 & data 1 & data 2	 & data 3 \\
row 2 & data 4 & data 5\footnotemark[1] & data 6 \\
row 3 & data 7 & data 8	 & data 9\footnotemark[2]\\
\botrule
\end{tabular}
\footnotetext{Source: This is an example of table footnote. 
This is an example of table footnote.}
\footnotetext[1]{Example for a first table footnote.
This is an example of table footnote.}
\footnotetext[2]{Example for a second table footnote. 
This is an example of table footnote.}
\end{table}
\bigskip
%%=============================================%%
%% For presentation purpose, we have included  %%
%% \bigskip command. Please ignore this.       %%
%%=============================================%%

%\begin{table}[h]
%\caption{Example of a lengthy table which is set to full textwidth}\label{tab2}
%\begin{tabular*}{\textwidth}{@{\extracolsep\fill}lcccccc}
%\toprule%
%& \multicolumn{2}{@{}c@{}}{Element 1\footnotemark[1]}  \\\cmidrule{2-3} 
%Project & Energy & $\sigma_{calc}$ & 
%\midrule
%Element 3  & 990 A & 1168 & $1547\pm12$ & 780 A & 1166 & $1239\pm100$\\
%Element 4  & 500 A & 961  & $922\pm10$  & 900 A & 1268 & $1092\pm40$\\
%\botrule
%\end{tabular*}
%\footnotetext{Note: This is an example of table footnote. This is an example of table footnote this is an example of table footnote this is an example of~table footnote this is an example of table footnote.}
%\footnotetext[1]{Example for a first table footnote.}
%\footnotetext[2]{Example for a second table footnote.}
%\end{table}

In case of double column layout, tables which do not fit in single column width should be set to full text width. For this, you need to use \verb+\begin{table*}+ \verb+...+ \verb+\end{table*}+ instead of \verb+\begin{table}+ \verb+...+ \verb+\end{table}+ environment. Lengthy tables which do not fit in textwidth should be set as rotated table. For this, you need to use \verb+\begin{sidewaystable}+ \verb+...+ \verb+\end{sidewaystable}+ instead of \verb+\begin{table*}+ \verb+...+ \verb+\end{table*}+ environment. This environment puts tables rotated to single column width. For tables rotated to double column width, use \verb+\begin{sidewaystable*}+ \verb+...+ \verb+\end{sidewaystable*}+.

\begin{sidewaystable}
\caption{Tables which are too long to fit, should be written using the ``sidewaystable'' environment as shown here}\label{tab3}
\begin{tabular*}{\textheight}{@{\extracolsep\fill}lcccccc}
\toprule%
& \multicolumn{3}{@{}c@{}}{Element 1\footnotemark[1]}& \multicolumn{3}{@{}c@{}}{Element\footnotemark[2]} \\\cmidrule{2-4}\cmidrule{5-7}%
Projectile & Energy	& $\sigma_{calc}$ & $\sigma_{expt}$ & Energy & $\sigma_{calc}$ & $\sigma_{expt}$ \\
\midrule
Element 3 & 990 A & 1168 & $1547\pm12$ & 780 A & 1166 & $1239\pm100$ \\
Element 4 & 500 A & 961  & $922\pm10$  & 900 A & 1268 & $1092\pm40$ \\
Element 5 & 990 A & 1168 & $1547\pm12$ & 780 A & 1166 & $1239\pm100$ \\
Element 6 & 500 A & 961  & $922\pm10$  & 900 A & 1268 & $1092\pm40$ \\
\botrule
\end{tabular*}
\footnotetext{Note: This is an example of table footnote this is an example of table footnote this is an example of table footnote this is an example of~table footnote this is an example of table footnote.}
\footnotetext[1]{This is an example of table footnote.}
\end{sidewaystable}

\section{Figures}\label{sec6}

As per the \LaTeX\ standards you need to use eps images for \LaTeX\ compilation and \verb+pdf/jpg/png+ images for \verb+PDFLaTeX+ compilation. This is one of the major difference between \LaTeX\ and \verb+PDFLaTeX+. Each image should be from a single input .eps/vector image file. Avoid using subfigures. The command for inserting images for \LaTeX\ and \verb+PDFLaTeX+ can be generalized. The package used to insert images in \verb+LaTeX/PDFLaTeX+ is the graphicx package. Figures can be inserted via the normal figure environment as shown in the below example:

%%=============================================%%
%% For presentation purpose, we have included  %%
%% \bigskip command. Please ignore this.       %%
%%=============================================%%
\bigskip
\begin{verbatim}
\begin{figure}[<placement-specifier>]
\centering
\includegraphics{<eps-file>}
\caption{<figure-caption>}\label{<figure-label>}
\end{figure}
\end{verbatim}
\bigskip
%%=============================================%%
%% For presentation purpose, we have included  %%
%% \bigskip command. Please ignore this.       %%
%%=============================================%%

\begin{figure}[h]
\centering
\includegraphics[width=0.9\textwidth]{fig.eps}
\caption{This is a widefig. This is an example of long caption this is an example of long caption  this is an example of long caption this is an example of long caption}\label{fig1}
\end{figure}

In case of double column layout, the above format puts figure captions/images to single column width. To get spanned images, we need to provide \verb+\begin{figure*}+ \verb+...+ \verb+\end{figure*}+.

For sample purpose, we have included the width of images in the optional argument of \verb+\includegraphics+ tag. Please ignore this. 

\section{Algorithms, Program codes and Listings}\label{sec7}

Packages \verb+algorithm+, \verb+algorithmicx+ and \verb+algpseudocode+ are used for setting algorithms in \LaTeX\ using the format:

%%=============================================%%
%% For presentation purpose, we have included  %%
%% \bigskip command. Please ignore this.       %%
%%=============================================%%
\bigskip
\begin{verbatim}
\begin{algorithm}
\caption{<alg-caption>}\label{<alg-label>}
\begin{algorithmic}[1]
. . .
\end{algorithmic}
\end{algorithm}
\end{verbatim}
\bigskip
%%=============================================%%
%% For presentation purpose, we have included  %%
%% \bigskip command. Please ignore this.       %%
%%=============================================%%

You may refer above listed package documentations for more details before setting \verb+algorithm+ environment. For program codes, the ``verbatim'' package is required and the command to be used is \verb+\begin{verbatim}+ \verb+...+ \verb+\end{verbatim}+. 

Similarly, for \verb+listings+, use the \verb+listings+ package. \verb+\begin{lstlisting}+ \verb+...+ \verb+\end{lstlisting}+ is used to set environments similar to \verb+verbatim+ environment. Refer to the \verb+lstlisting+ package documentation for more details.

A fast exponentiation procedure:

\lstset{texcl=true,basicstyle=\small\sf,commentstyle=\small\rm,mathescape=true,escapeinside={(*}{*)}}
\begin{lstlisting}
begin
  for $i:=1$ to $10$ step $1$ do
      expt($2,i$);  
      newline() od                (*\textrm{Comments will be set flush to the right margin}*)
where
proc expt($x,n$) $\equiv$
  $z:=1$;
  do if $n=0$ then exit fi;
     do if odd($n$) then exit fi;                 
        comment: (*\textrm{This is a comment statement;}*)
        $n:=n/2$; $x:=x*x$ od;
     { $n>0$ };
     $n:=n-1$; $z:=z*x$ od;
  print($z$). 
end
\end{lstlisting}

\begin{algorithm}
\caption{Calculate $y = x^n$}\label{algo1}
\begin{algorithmic}[1]
\Require $n \geq 0 \vee x \neq 0$
\Ensure $y = x^n$ 
\State $y \Leftarrow 1$
\If{$n < 0$}\label{algln2}
        \State $X \Leftarrow 1 / x$
        \State $N \Leftarrow -n$
\Else
        \State $X \Leftarrow x$
        \State $N \Leftarrow n$
\EndIf
\While{$N \neq 0$}
        \If{$N$ is even}
            \State $X \Leftarrow X \times X$
            \State $N \Leftarrow N / 2$
        \Else[$N$ is odd]
            \State $y \Leftarrow y \times X$
            \State $N \Leftarrow N - 1$
        \EndIf
\EndWhile
\end{algorithmic}
\end{algorithm}

%%=============================================%%
%% For presentation purpose, we have included  %%
%% \bigskip command. Please ignore this.       %%
%%=============================================%%
\bigskip
\begin{minipage}{\hsize}%
\lstset{frame=single,framexleftmargin=-1pt,framexrightmargin=-17pt,framesep=12pt,linewidth=0.98\textwidth,language=pascal}% Set your language (you can change the language for each code-block optionally)
%%% Start your code-block
\begin{lstlisting}
for i:=maxint to 0 do
begin
{ do nothing }
end;
Write('Case insensitive ');
Write('Pascal keywords.');
\end{lstlisting}
\end{minipage}

\section{Cross referencing}\label{sec8}

Environments such as figure, table, equation and align can have a label
declared via the \verb+\label{#label}+ command. For figures and table
environments use the \verb+\label{}+ command inside or just
below the \verb+\caption{}+ command. You can then use the
\verb+\ref{#label}+ command to cross-reference them. As an example, consider
the label declared for Figure~\ref{fig1} which is
\verb+\label{fig1}+. To cross-reference it, use the command 
\verb+Figure \ref{fig1}+, for which it comes up as
``Figure~\ref{fig1}''. 

To reference line numbers in an algorithm, consider the label declared for the line number 2 of Algorithm~\ref{algo1} is \verb+\label{algln2}+. To cross-reference it, use the command \verb+\ref{algln2}+ for which it comes up as line~\ref{algln2} of Algorithm~\ref{algo1}.

\subsection{Details on reference citations}\label{subsec7}

Standard \LaTeX\ permits only numerical citations. To support both numerical and author-year citations this template uses \verb+natbib+ \LaTeX\ package. For style guidance please refer to the template user manual.

Here is an example for \verb+\cite{...}+: \cite{bib1}. Another example for \verb+\citep{...}+: \citep{bib2}. For author-year citation mode, \verb+\cite{...}+ prints Jones et al. (1990) and \verb+\citep{...}+ prints (Jones et al., 1990).

All cited bib entries are printed at the end of this article: \cite{bib3}, \cite{bib4}, \cite{bib5}, \cite{bib6}, \cite{bib7}, \cite{bib8}, \cite{bib9}, \cite{bib10}, \cite{bib11}, \cite{bib12} and \cite{bib13}.


\section{Examples for theorem like environments}\label{sec10}

For theorem like environments, we require \verb+amsthm+ package. There are three types of predefined theorem styles exists---\verb+thmstyleone+, \verb+thmstyletwo+ and \verb+thmstylethree+ 

%%=============================================%%
%% For presentation purpose, we have included  %%
%% \bigskip command. Please ignore this.       %%
%%=============================================%%
\bigskip
\begin{tabular}{|l|p{19pc}|}
\hline
\verb+thmstyleone+ & Numbered, theorem head in bold font and theorem text in italic style \\\hline
\verb+thmstyletwo+ & Numbered, theorem head in roman font and theorem text in italic style \\\hline
\verb+thmstylethree+ & Numbered, theorem head in bold font and theorem text in roman style \\\hline
\end{tabular}
\bigskip
%%=============================================%%
%% For presentation purpose, we have included  %%
%% \bigskip command. Please ignore this.       %%
%%=============================================%%

For mathematics journals, theorem styles can be included as shown in the following examples:

\begin{theorem}[Theorem subhead]\label{thm1}
Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. 
Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. 
Example theorem text. 
\end{theorem}

Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text.

\begin{proposition}
Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. 
Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. 
\end{proposition}

Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text.

\begin{example}
Phasellus adipiscing semper elit. Proin fermentum massa
ac quam. Sed diam turpis, molestie vitae, placerat a, molestie nec, leo. Maecenas lacinia. Nam ipsum ligula, eleifend
at, accumsan nec, suscipit a, ipsum. Morbi blandit ligula feugiat magna. Nunc eleifend consequat lorem. 
\end{example}

Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text.

\begin{remark}
Phasellus adipiscing semper elit. Proin fermentum massa
ac quam. Sed diam turpis, molestie vitae, placerat a, molestie nec, leo. Maecenas lacinia. Nam ipsum ligula, eleifend
at, accumsan nec, suscipit a, ipsum. Morbi blandit ligula feugiat magna. Nunc eleifend consequat lorem. 
\end{remark}

Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text.

\begin{definition}[Definition sub head]
Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. 
\end{definition}

Additionally a predefined ``proof'' environment is available: \verb+\begin{proof}+ \verb+...+ \verb+\end{proof}+. This prints a ``Proof'' head in italic font style and the ``body text'' in roman font style with an open square at the end of each proof environment. 

\begin{proof}
Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. 
\end{proof}

Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text. Sample body text.

\begin{proof}[Proof of Theorem~{\upshape\ref{thm1}}]
Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. 
\end{proof}

\noindent
For a quote environment, use \verb+\begin{quote}...\end{quote}+
\begin{quote}
Quoted text example. Aliquam porttitor quam a lacus. Praesent vel arcu ut tortor cursus volutpat. In vitae pede quis diam bibendum placerat. Fusce elementum
convallis neque. Sed dolor orci, scelerisque ac, dapibus nec, ultricies ut, mi. Duis nec dui quis leo sagittis commodo.
\end{quote}

Sample body text. Sample body text. Sample body text. Sample body text. Sample body text (refer Figure~\ref{fig1}). Sample body text. Sample body text. Sample body text (refer Table~\ref{tab3}). 

\section{Methods}\label{sec11}

Topical subheadings are allowed. Authors must ensure that their Methods section includes adequate experimental and characterization data necessary for others in the field to reproduce their work. Authors are encouraged to include RIIDs where appropriate. 

\textbf{Ethical approval declarations} (only required where applicable) Any article reporting experiment/s carried out on (i)~live vertebrate (or higher invertebrates), (ii)~humans or (iii)~human samples must include an unambiguous statement within the methods section that meets the following requirements: 

\begin{enumerate}[1.]
\item Approval: a statement which confirms that all experimental protocols were approved by a named institutional and/or licensing committee. Please identify the approving body in the methods section

\item Accordance: a statement explicitly saying that the methods were carried out in accordance with the relevant guidelines and regulations

\item Informed consent (for experiments involving humans or human tissue samples): include a statement confirming that informed consent was obtained from all participants and/or their legal guardian/s
\end{enumerate}

If your manuscript includes potentially identifying patient/participant information, or if it describes human transplantation research, or if it reports results of a clinical trial then  additional information will be required. Please visit (\url{https://www.nature.com/nature-research/editorial-policies}) for Nature Portfolio journals, (\url{https://www.springer.com/gp/authors-editors/journal-author/journal-author-helpdesk/publishing-ethics/14214}) for Springer Nature journals, or (\url{https://www.biomedcentral.com/getpublished/editorial-policies\#ethics+and+consent}) for BMC.

\section{Discussion}\label{sec12}

Discussions should be brief and focused. In some disciplines use of Discussion or `Conclusion' is interchangeable. It is not mandatory to use both. Some journals prefer a section `Results and Discussion' followed by a section `Conclusion'. Please refer to Journal-level guidance for any specific requirements. 

\section{Conclusion}\label{sec13}

Conclusions may be used to restate your hypothesis or research question, restate your major findings, explain the relevance and the added value of your work, highlight any limitations of your study, describe future directions for research and recommendations. 

In some disciplines use of Discussion or 'Conclusion' is interchangeable. It is not mandatory to use both. Please refer to Journal-level guidance for any specific requirements. 

\backmatter

\bmhead{Supplementary information}

If your article has accompanying supplementary file/s please state so here. 

Authors reporting data from electrophoretic gels and blots should supply the full unprocessed scans for key as part of their Supplementary information. This may be requested by the editorial team/s if it is missing.

Please refer to Journal-level guidance for any specific requirements.

\bmhead{Acknowledgements}

Acknowledgements are not compulsory. Where included they should be brief. Grant or contribution numbers may be acknowledged.

Please refer to Journal-level guidance for any specific requirements.

\section*{Declarations}

Some journals require declarations to be submitted in a standardised format. Please check the Instructions for Authors of the journal to which you are submitting to see if you need to complete this section. If yes, your manuscript must contain the following sections under the heading `Declarations':

\begin{itemize}
\item Funding
\item Conflict of interest/Competing interests (check journal-specific guidelines for which heading to use)
\item Ethics approval and consent to participate
\item Consent for publication
\item Data availability 
\item Materials availability
\item Code availability 
\item Author contribution
\end{itemize}

\noindent
If any of the sections are not relevant to your manuscript, please include the heading and write `Not applicable' for that section. 

%%===================================================%%
%% For presentation purpose, we have included        %%
%% \bigskip command. Please ignore this.             %%
%%===================================================%%
\bigskip
\begin{flushleft}%
Editorial Policies for:

\bigskip\noindent
Springer journals and proceedings: \url{https://www.springer.com/gp/editorial-policies}

\bigskip\noindent
Nature Portfolio journals: \url{https://www.nature.com/nature-research/editorial-policies}

\bigskip\noindent
\textit{Scientific Reports}: \url{https://www.nature.com/srep/journal-policies/editorial-policies}

\bigskip\noindent
BMC journals: \url{https://www.biomedcentral.com/getpublished/editorial-policies}
\end{flushleft}

\begin{appendices}

\section{Section title of first appendix}\label{secA1}

An appendix contains supplementary information that is not an essential part of the text itself but which may be helpful in providing a more comprehensive understanding of the research problem or it is information that is too cumbersome to be included in the body of the paper.

%%=============================================%%
%% For submissions to Nature Portfolio Journals %%
%% please use the heading ``Extended Data''.   %%
%%=============================================%%

%%=============================================================%%
%% Sample for another appendix section			       %%
%%=============================================================%%

%% \section{Example of another appendix section}\label{secA2}%
%% Appendices may be used for helpful, supporting or essential material that would otherwise 
%% clutter, break up or be distracting to the text. Appendices can consist of sections, figures, 
%% tables and equations etc.

\end{appendices}

%%===========================================================================================%%
%% If you are submitting to one of the Nature Portfolio journals, using the eJP submission   %%
%% system, please include the references within the manuscript file itself. You may do this  %%
%% by copying the reference list from your .bbl file, paste it into the main manuscript .tex %%
%% file, and delete the associated \verb+\bibliography+ commands.                            %%
%%===========================================================================================%%

%\bibliography{sn-bibliography}% common bib file
%% if required, the content of .bbl file can be included here once bbl is generated
%%\input sn-article.bbl


\end{document}
