# A New Approach to Numerical Solution of Nonlinear Klein-Gordon Equation

Authors: Berna Bülbül; Mehmet Sezer
Journal: Mathematical Problems in Engineering
 (2013)

---

## Abstract

A numerical method based on collocation points is developed to solve the nonlinear Klein-Gordon equations by using the Taylor matrix method. The method is applied to some test examples and the numerical results are compared with the exact solutions. The results reveal that the method is very effective, simple, and convenient. In addition, an error estimation of proposed method is presented.


---

## Body

## 1. Introduction

Nonlinear phenomena, that occurs in many areas of scientific such as solid state physics, plasma physics, fluid dynamics, mathematical biology and chemical kinematics, can be modeled by partial differential equations. The Klein-Gordon equation is an important class of partial differential equations and arises in relativistic quantum mechanics and field theory, which is great importance for the high energy physicist [1], and is used to model many different phenomena, including the propagation of dislocations in crystals and the behavior of elementary particles. On the other hand, the one-dimensional Klein-Gordon equation is given by partial differential equation [2]
(1)∂2u∂t2-k2∂2u∂x2+h(u)=g(x,t).In the present work we are dealing with the numerical approximation of the following nonlinear Klein-Gordon equation:(2)∂2u∂t2-k2∂2u∂x2+β1u+⋯+βnun=g(x,t)x∈[a,b],t∈[0,T],
subject to initial conditions
(3)u(x,0)=f(x),∂u(x,0)∂t=m(x),x∈[a,b],
where βi(i=1,…,n), k are physical constants and g(x,t) is the time varying external input. Specially a non-zero right-hand side in the KGE naturally arises in the context when including for instance quantum gravitational effects into the model.KGE and the various other forms of the nonlinear KGE are all well studied in various papers. The equation has attracted much attention in studying solitons and soliton perturbation theory [3–6]. Biswas et al. studied the adiabatic dynamics of topological as well as the non-topological solitons in presence of perturbation terms [7–10]. In order to obtain the exact and numerical solutions of the nonlinear KGEs, a number of methods have been proposed such as the modified decomposition method [11], the symplectic finite difference approximations method [12], the numerical scheme based on the collocation method [2], the variational iteration method [13, 14], the finite element method [15], the cubic B-spline collocation method [16], the finite difference method [17], the decomposition method [18], Exp-function method [19, 20], the homotopy perturbation method [21], the tanh method [22] and the Jacobi elliptic function method [23], the Soliton solution [24–28], the stationary solutions [29] and the traveling wave solutions [30].Since the beginning of 1994, Taylor matrix and collocation methods have been to solve linear and nonlinear ordinary differential equations, and difference equations used by Sezer et al. [7, 31–36]. In this work, the mentioned Taylor methods are developed and applied to Klein-Gordon equation (2) with the initial conditions (3), and the solution is expressed in the truncated double Taylor series
(4)u(x,t)=∑r=0N∑s=0Nar,sxrts,ar,s=1r!·s!u(r,s)(0,0),
where ar,s, for r,s=0,…,N are the coefficients to be determined. In this study we use the collocation points defined by
(5)xk=a+kh,tl=lh;h=b-aN,k,l=0,1,…,N.


## 2. Fundamental Relations

In the numerical solution of (2) with the presented Taylor method, it is necessary to evaluate the Taylor coefficients of the unknown function. For convenience, the relation (4) can be written in the matrix form
(6)u(x,t)=X1(x,t)A1,ui(x,t)=Xi(x,t)Ai,i=2,…,n,
where Xi(x,t) and Ai are 1×(N+1)2i and (N+1)2i×1 matrices, respectively, and defined as follows:
(7)X1(x,t)=[x0t0x0t1…x0tNx1t0x1t1…x1tN…xNt0xNt1…xNtN],Xi(x,t)=[X(i)0,0(x,t)X(i)0,1(x,t)…X(i)0,N(x,t)X(i)1,0(x,t)X(i)1,1(x,t)…X(i)1,N(x,t)…X(i)N,0(x,t)X(i)N,1(x,t)…X(i)N,N(x,t)],
so that
(8)X(i)p,q(x,t)=xptqXi-1(x,t);i=2,…,n,p,q=0,1,…,N,A1=[a0,0a0,1…a0,Na1,0a1,1…a1,N…aN,0aN,1…aN,N]T,Ai=[A(i)0,0A(i)0,1…A(i)0,NA(i)1,0A(i)1,1…A(i)1,N…A(i)N,0A(i)N,1…A(i)N,N]T,
where
(9)A(i)p,q=ap,qAi-1,i=2,…,n,p,q=0,1,…,N.
On the other hand, the relation between the matrix X1(x,t) and its derivatives (X1(x,t))(m,n) is
(10)(X1(x,t))(m,n)=X1(x,t)(B-)m(B~)n,
where
(11)B=[010⋯0002⋯0⋮⋮⋮⋱⋮000⋯N000⋯0](N+1)×(N+1),B-=[0I0⋯0002I⋯0⋮⋮⋮⋱⋮000⋯NI000⋯0](N+1)2×(N+1)2,B~=[B0⋯00B⋯0⋮⋮⋱⋮00⋯B](N+1)2×(N+1)2,
where I is the (N+1)×(N+1) identity matrix. Using the relations (6) and (10) we have
(12)u(m,n)(x,t)=(X1(x,t))(m,n)A=X1(x,t)(B-)m(B~)nA1.


## 3. Method of Solution

The technique is to assume that the unknown function has an expansion in the form (4), and to attempt to determine values for the coefficients {ar,s} such that the required differential equation and other conditions are satisfied. To obtain numerical approximation to Klein-Gordon equation under the given conditions, we can reduce (2) and (3) to the matrix equations as follows:
(13)X1(x,t){(B~)2-k2(B-)2}A1+β1X1(x,t)A1+β2X2(x,t)A2+⋯+βnXn(x,t)An=g(x,t),
or briefly
(14)W1(x,t)A1+W2(x,t)A2+⋯+Wn(x,t)An=g(x,t),
where
(15)W1(x,t)=X1(x,t){(B~)2-k2(B-)2}+β1X1(x,t),Wi(x,t)=βiXi(x,t),i=2,…,n.
By substituting the collocation points defined by (5) into (14) we have
(16)W1(xk,tl)A1+W2(xk,tl)A2+⋯+Wn(xk,tl)An=g(xk,tl);k,l=0,1,…,N,
or in the compact form
(17)W~1A1+W~2A2+⋯+W~nAn=G,
where
(18)W~j=[w~0jw~1j⋮w~Nj],w~ij=[Wi(x0,ti)Wi(x1,ti)⋮Wi(xN,ti)],G=[g0g1⋮gN],gi=[g(x0,ti)g(x1,ti)⋮g(xN,ti)],i=0,…,N,j=1,2,…,n.We can use the following formulas to construct the matrix representation of initial conditions (3):
(19)u(x,t)=X(x)Q(t)A1,ut(x,t)=X(x)Q(t)B~A1,
where
(20)X(x)=[1xx2…xN],T(t)=[1tt2…tN],Q(t)=[T(t)0⋯00T(t)⋯0⋮⋮⋱⋮00⋯T(t)].The matrix representations of nonhomogeneous terms of (3) can be written in the forms
(21)f(x)=X(x)F,F=[f0f1…fN]T,fn=f(n)(0)n!;n=0,1,…,N,m(x)=X(x)M,M=[m0m1…mN]T,mn=m(n)(0)n!;n=0,1,…,N.
By substituting relations (21) into (3) and then simplifying the result, we get the matrix forms of conditions as
(22)Q(0)A1=F,Q(0)B~A1=M.
To obtain the solution under the conditions, we get
(23)W-1=[w~0jw~1j⋮w~N-2jQ(0)Q(0)B~],W-j=[w~0jw~1j⋮w~N-2j00],(j=2,…,n),G-=[g0g1⋮gN-2FM].
By solving the following nonlinear system:
(24)W-1A1+W-2A2+⋯+W-nAn=G-,
the unknown Taylor coefficients ar,s are determined and substituted in (4); thus we get the Taylor polynomial solution
(25)u(x,t)=∑r=0N∑s=0Nar,sxrts.


## 4. Accuracy of Solution and Error Analysis

We can easily check the accuracy of the solution. Since the truncated Taylor series (4) is an approximate solution of (2), when the function uN(x,t) and its derivatives are substituted in (2), the resulting equation must be satisfied approximately; that is, for x=xp,  t=tq∈[a,b]×[0,T], p,q=0,1,2…(26)EN(xp,tq)=|∂2u(xp,tq)∂t2-k2∂2u(xp,tq)∂x2+β1u(xp,tq)+⋯+βnun(xp,tq)-g(xp,tq)∂2u(xp,tq)∂t2|≅0,
where
(27)EN(xp,tq)≤10-kpq,(kpqisanypositiveinteger).
If max 10-kpq=10-k (k positive integer) is prescribed, then the truncation limit N is increased until difference E(xp,tq) at each of the points becomes smaller than the prescribed 10-k. On the other hand we use different error norms for measuring errors. These error norms are defined as follows:(1)
L2-Error=(∑i=0n(ei)2)1/2,(2)
L∞-Error=Max(ei),0≤i≤n,(3)
RMS-Error=∑i=0nei2/(n+1),where ei=u(xi,τ)-u^(xi,τ)(xi=a+ih,h=(b-a)/n); also u and u^ are the exact and approximate solutions of the problem, respectively, and τ is an arbitrary time t in [0,T].


## 5. Illustrative Examples

In this section, several numerical examples are given to illustrate the properties of the method and all of them were performed on the computer using a program written in Maple v9.Example 1.
Consider the nonlinear Klein-Gordon equation [13]
(28)utt-uxx+u2=6xt(x2-t2)+x6t6
with initial conditions
(29)u(x,0)=0,ut(x,0)=0.
Following the procedures in Section 2 and by substituting the obtained coefficients in equation, the solution becomes
(30)u(x,t)=x3t3,
which is the exact solution.Example 2.
We next consider the nonlinear linear Klein-Gordon equation [2]
(31)utt-uxx+u2=-xcos(t)+x2cos2(t),
with initial conditions
(32)u(x,0)=x,ut(x,0)=0.
In Table 1, the L2, L∞ errors and RMS of errors are obtained for different values of t. The graph of analytical and numerical functions for N=4 and the absolute error graph are given in Figure 1. It is seen that the linear terms in right hand side of (28) and (31) are forced terms. By adding these terms to the homogen equations, we are trying to find the effect of the force terms on homogen solution such a way that either they are in solution forms or other types of solutions.Table 1
L
∞
,
L
2, and  RMS  errors of Example 2 for N=4 and h=0.1.
t
L
∞-error
L
2-error
RMS-error
0
0
0
0
0.1
4.9593
E
-
8
9.6138
E
-
6
2.8986
E
-
6
0.2
5.6542
E
-
7
5.4883
E
-
6
1.6532
E
-
6
0.3
1.8493
E
-
6
1.1933
E
-
5
3.5979
E
-
6
0.4
3.2841
E
-
6
1.5829
E
-
5
4.7726
E
-
6
0.5
3.8373
E
-
6
1.4683
E
-
5
4.4271
E
-
6
0.6
4.6197
E
-
6
1.4714
E
-
5
4.4366
E
-
6
0.7
1.4141
E
-
5
3.9360
E
-
5
1.1867
E
-
5
0.8
5.6879
E
-
5
1.3952
E
-
4
4.2069
E
-
5
0.9
1.8571
E
-
4
4.0542
E
-
4
1.2224
E
-
4
1
2.2334
E
-
4
9.7993
E
-
4
2.9546
E
-
4Exact solution, numerical solution, and absolute error of Example2 for N=4.
(a)
(b)
(c)Example 3.
In this example, we consider the nonlinear Klein-Gordon Equation (3) with cubic nonlinearity with constants k2=2.5, β1=1, β3=1.5 and βi=0,i≠1,3) in the interval 0≤x≤1. The initial conditions are given by
(33)u(x,0)=Btan(Kx),0≤x≤1,ut(x,0)=BcKsec2(Kx),0≤x≤1,
and the exact solution by (3) is
(34)u(x,t)=Btan(K(x+ct)),0≤x≤1,
where
(35)B=β1β3,K=-β12(k2+c2),g(x,t)=0.
The numerical solution for Example 3 is recorded for different time levels by utilizing the proposed method. At each given time level, absolute error is shown in Table 2.Table 2
Absolute errors of Example3 for N=4.
t
t
=
0.001
t
=
0.01
t
=
0.1
x
i
c
=
0.01
c
=
0.05
c
=
0.01
c
=
0.05
c
=
0.01
c
=
0.05
0.1
5.13
E
-
9
5.19
E
-
9
6.18
E
-
7
5.20
E
-
7
5.88
E
-
5
5.91
E
-
5
0.2
9.58
E
-
6
9.61
E
-
6
9.39
E
-
6
9.42
E
-
6
1.63
E
-
5
1.63
E
-
5
0.3
3.67
E
-
6
3.68
E
-
6
3.67
E
-
6
3.68
E
-
6
1.20
E
-
6
2.91
E
-
6
0.4
2.68
E
-
6
2.69
E
-
6
2.61
E
-
6
2.62
E
-
6
2.42
E
-
6
1.23
E
-
6
0.4
3.66
E
-
6
3.67
E
-
6
3.60
E
-
6
3.61
E
-
6
3.69
E
-
6
2.47
E
-
6
0.5
3.91
E
-
11
4.61
E
-
6
2.02
E
-
9
2.19
E
-
6
5.18
E
-
6
3.76
E
-
6
0.6
3.84
E
-
6
3.86
E
-
6
3.78
E
-
6
3.79
E
-
6
6.85
E
-
6
5.28
E
-
6
0.7
2.96
E
-
6
2.97
E
-
6
2.87
E
-
6
2.88
E
-
6
4.65
E
-
6
7.00
E
-
6
0.8
4.26
E
-
6
4.27
E
-
6
1.14
E
-
6
1.12
E
-
5
1.39
E
-
5
1.37
E
-
5
0.9
1.16
E
-
5
1.17
E
-
5
4.27
E
-
6
3.63
E
-
6
7.51
E
-
5
7.36
E
-
5
1
6.90
E
-
9
9.88
E
-
5
1.16
E
-
7
2.68
E
-
6
1.39
E
-
5
1.44
E
-
5Example 4.
We finally close our analysis by studying the Klein-Gordon equation [14]
(36)utt-uxx+34u-32u3=0,
with initial conditions
(37)u(x,0)=-sech(x),ut(x,0)=12sech(x)tanh(x).
Here the exact solution of equation is (see [21])
(38)u(x,t)=-sech(x+12t).
The solution of this nonlinear system is obtained for N=6. For numerical results, see Table 3 and Figure 2.Table 3
Error analysis for Example4.
x
i
E
N
(
x
i
,
0.5
)
0
0
0.1
4.14
E
-
4
0.2
3.39
E
-
4
0.3
3.54
E
-
4
0.4
1.19
E
-
4
0.5
7.83
E
-
4
0.6
6.13
E
-
10
0.7
1.41
E
-
4
0.8
7.68
E
-
4
0.9
2.71
E
-
4
1
8.41
E
-
4(a) Error function for Example4. (b) Error function at t=0.5 for Example 4.
(a)
(b)


## 6. Conclusion

In this paper, a very simple but effective Taylor matrix method was proposed for the numerical solution nonlinear Klein-Gordon equation. One of the advantages of this method that the solution is expressed as a truncated Taylor series, thenu(x,t) can be easily evaluated for arbitrary values of x and t by using the computer program without any computational effort. From the given illustrative examples, it can be seen that the Taylor series approach can obtain very accurate and satisfactory results. An interesting feature of this method is that the analytical solution is obtained as demonstrated in Example 1 when the exact solution is polynomial. This method can be improved with new strategies to solve the other nonlinear equations.



---

*Source: 869749-2013-06-26.xml*