# Solution of Boundary Value Problems by Approaching Spline Techniques

Authors: P. Kalyani; P. S. Rama Chandra Rao
Journal: International Journal of Engineering Mathematics
 (2013)

---

## Abstract

In the present work a nonpolynomial spline function is used to approximate the solution of the second order two point boundary value problems. The classes of numerical methods of second order, for a specific choice of parameters involved in nonpolynomial spline, have been developed. Numerical examples are presented to illustrate the applications of this method. The solutions(u(x)) of these examples are found at the nodal points with various step sizes and with various parameters (α, β). The absolute errors in each example are estimated, and the comparison of approximate values, exact values, and absolute errors of u(x) at the nodal points are shown graphically. Further, shown that nonpolynomial spline produces accurate results in comparison with the results obtained by the B-spline method and finite difference method.


---

## Body

## 1. Introduction

There are many linear and nonlinear problems in science and engineering, namely, second order differential equations with various types of boundary conditions, which are solved either analytically or numerically. Numerical simulation in engineering science and in applied mathematics has become a powerful tool to model the physical phenomena, particularly when analytical solutions are not available, then very difficult to obtain. The numerical solution of two-point boundary value problems (BVPs) is of great importance due to its wide application in scientific research. Several authors like Bickley [1] and Khan [2] have considered the applications of cubic spline functions for the solution of two point boundary value problems. Detailed explanation of theory of splines is given in [3, 4]. Some of already established methods to solve the boundary value problems are shooting method, finite difference method, finite volume method, variational iteration method, and Adomian decomposition method. Chawla and Katti [5] employed finite difference method for a class of singular two-point BVPs; a class of BVPs was solved by using numerical integration [6]; Ravi kanth and Reddy dealt with cubic spline [7]; the variational iteration method was proposed originally by He [8] in 1999; Adomian et al. solved a generalization of Airy’s equation by decomposition method [9]. In the present communication we apply nonpolynomial spline functions to develop numerical method for obtaining the approximations to the solution of second order two point boundary value problem of the form
(1)-ddx[p(x)dudx]+v(x)u(x)=g(x),u(a)=u(b)=0,p∈c′[a,b],p>0,g,v∈c[a,b].This type of problem (by missing the term containingu(x)) is proposed by the authors in [10, 11]. Numerical solution of (1) based on finite difference, finite element, and finite volume methods has been proposed by Fang et al. [10]; Hikmet Caglar et al. [11] applied B-spline interpolation in two-point BVPs and compared results with finite difference, finite element, and finite volume methods.Briefly, outline is as follows. In Section2, we develop a numerical technique based on nonpolynomial spline function for solving second order linear and nonlinear two point boundary value problems (1). To demonstrate the efficiency of the method some numerical examples have been solved and compared with exact solution and also with other known methods [12] in Section 3 and conclusions have been presented in Section 4.


## 2. Description of the Method

We consider a uniform meshΔ with nodal points xi  on [a,b] such that
(2)Δ:a=x0<x1<x2<⋯<xN-1<xN=b,xi=a+ih,i=0,1,2,…,Nwhereh=(b-a)N.
A nonpolynomial function sΔ(x) of class c2[a,b] which interpolates u(x) at the mesh points xi, for i=0,1,…,N, depends on a parameter τ and reduces to ordinary cubic spline in [a,b] as τ→0. The spline function we propose has the following form: T3=Span{1,x,cosτx,sinτx}, where τ is the frequency of the trigonometric part of the spline function which can be real or pure imaginary and which will be used to raise the accuracy of the method.When correlation between polynomial and nonpolynomial spline basis functions are investigated in the following manner:(3)T3=Span{1,x,cosτx,sinτx}=Span{1,x,(2τ2)(1-cosτx),(6τ3)(τx-sinτx)}.
It follows that limτ→0T3={1,x,x2,x3}. Thus in each subinterval xi≤x≤xi+1, we have
(4)Span{1,x,cosτx,sinτx}orSpan{1,x,x2,x3}(whenτ⟶0)For each segment[xi,xi+1], i=0,1,2,…,N-1 the non-polynomial sΔ(x) has the following form:
(5)sΔ(x)=ai+bi(x-xi)+cisinτ(x-xi)+dicosτ(x-xi),i=0,1,2,…,N,
where ai, bi, ci, and di are constants and τ is a free parameter. Let ui be an approximation to u(xi), obtained by the segment sΔ(x) of mixed spline function passing through the points (xi,ui) and (xi+1,ui+1). To obtain the necessary conditions for the coefficients introduced in (5), we not only require sΔ(x) to satisfie interpolate conditions at xi and xi+1, but also the continuity of first derivative at the common nodes (xi,,ui) to be fulfilled.To derive an expression for the coefficients of (5) in terms of ui, ui+1, Mi, Mi+1, we first denote
(6)SΔ(xi)=ui,SΔ(xi+1)=ui+1,SΔ′′(xi)=Mi,SΔ′′(xi+1)=Mi+1.
From algebraic simplification we get the following expression:
(7)ai=ui+Miτ2,bi=ui+1-uih+Mi+1-Miτθ,ci=Micosθ-Mi+1τ2sinθ,di=-Miτ2,
where θ=τh and i=0,1,2,…,N-1 using the continuity of the first derivative at (xi,ui); that is, sΔi-1′(xi)=sΔi′(xi), we obtain the following relations for i=0,1,2,…,N-1(8)αMi+1+2βMi+αMi-1=1h2(ui+1-2ui+ui-1),whereα=1h2(θcscθ-1),β=1h2(1-θcotθ),
and θ=τh whenever τ→0; then α→1/6 and β→1/3. Therefore (8) reduces to the consistency relation of cubic splines:
(9)Mi+1+4Mi+Mi-1=6h2(ui+1-2ui+ui-1).
Equation (1) can be rewritten as
(10)d2udx2+q(x)dudx+r(x)u=f(x),whereq(x)=p′(x)p(x),r(x)=-v(x)p(x),f(x)=-g(x)p(x).
The proposed differential equation (10) can be discretized at the nodal point xi by
(11)ui′′+qiui′+riui=fi,whereqi=q(xi),ri=r(xi),fi=f(xi).
By using moment of the spline in (11) we obtain
(12)Mi+qiui′+riui=fi.
Taking approximations for the first derivative of u we have
(13)ui′=ui+1-ui-12h,ui+1′=3ui+1-4ui+ui-12h,ui-1′=-ui+1+4ui-3ui-12h.
Substituting (12), (13) in (8) and simplifying, we get the following tridiagonal system which gives the approximations u1,u2,u3,…,uN-1 of the solution u(x) at x1,x2,x3,…,xN-1:
(14)(3h2αqi-1+hβqi-h2αqi+1-h2αri-1-1)ui-1+(-2hαqi-1+2hαqi+1-h22βri+2)ui+(h2αqi-1-hβqi-3h2αqi+1-h2αri+1-1)ui+1=-h2(αfi-1+2βfi+αfi+1),
with u(a)=u(b)=0, i=1(1)N-1.The tridiagonal linear system (14) can be written in the following matrix form:
(15)AU+h2DF=G,whereA=P+hBQ-h2BR.A is a tridiagonally dominant matrix of order (N-1).P
=
(
P
i
j
) is a tridiagonal matrix defined by
(16)(Pij)={2i=j=1,2,…,N-1,-1|i-j|=1,0otherwise,BQ=(Zij), BR=(Rij) are tridiagonal matrices defined as
(17)(Zij)={2α(-q0+q2),i=j=1,32αqi-1+βqi-12αqi+1,i>j,2α(-qi-1+qi+1),i=j,12αqi-1-βqi-32αqi+1,i<j,2α(-qN-2+qN),i=j=N-1,(Rij)={2βri,i=j=1,2…,N-1,αri-1,i>j,αri+1,i<j,(18)F=(f1,f2,…,fN-1)T,U=(u1,u2,…,uN-1)T.
The tridiagonal matrix D is defined by
(19)D=[2βα000··0α2βα00··00α2βα0··000α2βα··0000α2βα······α2βα······α2βα00000·α2β],G=(g1,0,0,0,…,0,gN-1)Twhereg1=-h2αf0,gi=0,fori=2,3,…,N-2,gN-1=-h2αfN.


## 3. Numerical Illustrations

In the present work four linear boundary value problems withh=0.1 and one nonlinear boundary value problem with h=0.2 for different values of α and β have been solved, whose exact solutions are known. The approximate solution, exact solutions, and absolute errors at the nodal points are tabulated in Tables 1–7, and comparisons are shown in Figures 1–5. The results of the present work are compared with the exact solution of all the problems and with finite difference method, B-spline method of Example 4.Table 1
Approximate solution (series 1), exact solution (series 2), and absolute errors of Example1.
x values
Approximate solution (U)
Exact solutionu(x)
Absolute error
2.1
0.018809
0.018609
0.0002
2.2
0.032904
0.032536
0.00037
2.3
0.042537
0.042048
0.00049
2.4
0.047925
0.047368
0.00056
2.5
0.049252
0.048684
0.00057
2.6
0.046680
0.046154
0.00053
2.7
0.040350
0.039912
0.00044
2.8
0.030389
0.030075
0.00031
2.9
0.016908
0.016742
0.00017Table 2
Approximate solution (series 1), exact solution (series 2), and absolute errors of Example2.
x values
Approximate solution
Exact solution
Absolute error
0.1
0.307797
0.309017
0.00122
0.2
0.585475
0.587785
0.00231
0.3
0.805863
0.809017
0.003154
0.4
0.947402
0.951052
0.003654
0.5
0.996253
1
0.003747
0.6
0.947656
0.951057
0.003401
0.7
0.806396
0.809018
0.002622
0.8
0.586341
0.587787
0.001446
0.9
0.309083
0.309019
0.00006Table 3
(a) Approximate solution, exact solution, and absolute errors of Example2 Case 2(a). (b) Approximate solution, exact solution, and absolute errors of Example 2 Case 2(b).
(a)
x values
Approximate solution
Exact solution
Absolute error
0.1
0.306536
0.309017
0.002481
0.2
0.583081
0.587785
0.004704
0.3
0.802581
0.809017
0.006436
0.4
0.943571
0.951056
0.007485
0.5
0.992273
1
0.007727
0.6
0.943954
0.951057
0.007103
0.7
0.803386
0.809018
0.005632
0.8
0.584388
0.587787
0.003399
0.9
0.308477
0.309019
0.000542
(b)
x values
Approximate solution
Exact solution
Absolute error
0.1
0.30922
0.309017
0.000203
0.2
0.588176
0.587785
0.000391
0.3
0.809565
0.809017
0.000548
0.4
0.951724
0.951056
0.000668
0.5
1.000742
1
0.000742
0.6
0.951832
0.951057
0.000775
0.7
0.809792
0.809018
0.000774
0.8
0.588544
0.587787
0.000757
0.9
0.309766
0.309019
0.000747Table 4
Approximate solutions (series 1), exact solution (series 2), and absolute errors of Example3.
x values
Approximate solution
Exact solution
Absolute error
0.1
0.100030
0.099465
0.00056462
0.2
0.196479
0.195424
0.00105456
0.3
0.284928
0.28347
0.00145765
0.4
0.359797
0.358038
0.00175907
0.5
0.414122
0.41218
0.00194168
0.6
0.439290
0.437309
0.00198149
0.7
0.424738
0.422888
0.00184993
0.8
0.357597
0.356087
0.00151045
0.9
0.222286
0.221364
0.00092172Table 5
Approximate solution (series 1), exact solution (series 2), and absolute errors of Example4.
x values
Approximate solution
Exact solution
Absolute error
0.1
0.057301
0.0572
0.000101
0.2
0.106357
0.1061
0.000257
0.3
0.146421
0.1460
0.000421
0.4
0.176383
0.1758
0.000583
0.5
0.194657
0.1940
0.00065
0.6
0.199044
0.1983
0.000744
0.7
0.186544
0.1858
0.000744
0.8
0.153113
0.1524
0.00071
0.9
0.093335
0.0928
0.000535Table 6
Comparison of present method (series 3) with B-spline method (series 2), finite difference method (series 1) and with exact solution (series 4) for Example4.
x values
Finite difference method
B-Spline method
Present  method
Exact solution
0.1
0.0399
0.05657
0.05730
0.0572
0.2
0.0897
0.104297
0.106357
0.1061
0.3
0.1302
0.1464167
0.146421
0.1460
0.4
0.1604
0.1763667
0.176383
0.1758
0.5
0.1787
0.193999
0.194657
0.1940
0.6
0.1827
0.1982966
0.199044
0.1983
0.7
0.1695
0.18655
0.186544
0.1858
0.8
0.1350
0.153771
0.15311
0.1524
0.9
0.0735
0.909366
0.093335
0.0928Table 7
Approximate solution,  exact solution, and absolute errors of Example5
x values
Approximate solution
Exact solution
Absolute error
0.2
−0.08874
−0.08888
0.00014
0.4
−0.14974
−0.15
0.00026
0.6
−0.17111
−0.17143
0.00032
0.8
−0.13306
−0.13333
0.00027Figure 1
Comparison of approximate values and exact values for Example1.(a) Comparison of approximate values and exact values for Example2. (b) Comparison of errors in 2 cases for Example 2.
(a)
(b)Figure 3
Comparison of approximate values and exact values for Example3.(a) Comparison of approximate values and exact values for Example4. (b) Comparison of results obtained by our method of Example 4 with the values obtained by other methods (Table 6).
(a)
(b)Figure 5
Comparison of approximate values and exact values for Example5.Example 1.
Consider the boundary value problem:(20)u′′(x)=2x2u(x)-1x;2<x<3,u(2)=0,u(3)=0.
The analytical solution of (20) is
(21)u(x)=138(-5x2+19x-36x).
By comparing the given equation with (10) we have
(22)qi=q(xi)=0,ri=r(xi)=-2xi2,fi=f(xi)=-1xi,forxi=2,2.1,2.2,…,3,withh=0.1,wherei=0,1,2…,10,respectively.
Here
(23)G=(g1,0,0,0,0,0,0,0,g9)T,whereg1=8.3333×10-4,g9=5.55555×10-4,
and the function values at the nodal points are given by F=(f1,f2,…,f9)T; that is,(24)F=(-0.47619,-0.45455,-0.43478,-0.41667,-0.4,-0.38462,-0.37037,-0.35714,-0.34483)T.
Substituting the values of pi, qi, ri at i=0,1,2…,10 in (16), (17), and (18) we get the values of (Pij), (Zij), (Rij), and taking these values in (15) we get the tridiagonal matrix A. From (23), (24) we have G and F so we obtain a system of linear equations. This system in the matrix form is AU+h2DF=G; that is, (25)[2.0015-0.999310000000-0.999242.00137-0.999370000000-0.999312.00126-0.999420000000-0.999372.00116-0.999470000000-0.999422.00107-0.999510000000-0.999472.00099-0.999540000000-0.999512.00091-0.999570000000-0.999542.00085-0.99960000000-0.999572.00079][u1u2u3u4u5u6u7u8u9]=[0.0047650.0045480.004350.0041690.0040020.0038480.0037050.0035730.003449].Solving this we get the solution matrixU. The approximate values (U), exact values (u(x) of (21)), and the absolute errors are summarized in Table 1, and the comparison is given in Figure 1.Example 2.
Consider the boundary value problem:(26)u′′(x)-π2u(x)=-2π2sinπx;0<x<1,u(0)=0,u(1)=0,
Comparing the given equation with (10) we have
(27)qi=q(xi)=0,ri=r(xi)=-π2,fi=f(xi)=-2π2sinπxi,fori=0,1,…,10.
Here h=0.1, so the nodal points are x0,x1,x2,…,x10.Case  1 (choosing α=1/6, β=1/3). From (19) we have
(28)G=(g1,0,0,0,0,0,0,0,g9)T,whereg1=0,g9=1.8029683×10-3,and the function values at the nodal points are given byF=(f1,f2,…,f9)T; that is,
(29)F=(-6.09974,-11.6024,-13.9693,-18.7731,-19.7392,-18.7731,-15.9693,-11.6024,-6.09979)T.
Substituting the values of pi, qi, and ri at i=0,1,2…10 in (16), (17), and (18) we get the values of (Pij), (Zij), (Rij), and substituting these values in (15) we get the tridiagonal matrix A. From (28), (29) we have G and F. So we obtain a system of linear equations. This system in the matrix form is AU+h2DF=G; solving this we get the solution matrix U.The analytical solution of the given equation is(30)u(x)=sinπx.
The approximate values (U), exact values (u(x) from (30)), and the absolute errors at the nodal points are summarized in Table 2 and the comparison is given in Figure 2.Case  2 ((a) choosing α=1/4, β=1/4 (b) choosing α=1/14, β=3/7).For the values of α, β the procedure followed in Case 1 is used to determine the approximate solution of (24). The approximate values (U), exact values (u(x) from (30)), and the absolute errors at the nodal points of Case 2 are summarized in Tables 3(a) and 3(b), respectively. The comparison of errors in the two cases at the nodal points is given in Figure 2(b).Example 3.
Consider the boundary value problem:(31)u′′(x)-u(x)=-4xex;0≤x≤1,u(0)=0,u(1)=0.
Comparing the given equation with (10) we have
(32)qi=q(xi)=0,ri=r(xi)=-1,fi=f(xi)=-4xexi.
Here h=0.1, so the nodal points are x0,x1,x2,…,x10. Solution of (31) is given by (15). Here
(33)G=(g1,0,0,0,0,0,0,0,g9)T,whereg1=0,g9=1.8152132×10-3,
and the function values at the nodal points is given by F=(f1,f2,…,f9)T; that is,
(34)F=(-0.44207,-0.97712,-1.61983,-2.38692,-3.29744,-4.37309,-5.6385,-7.12173,-8.85457)T.
Substituting the values of pi, qi, and ri at i=0,1,2…,10 in (16), (17), and (18) we get the values of (Pij), (Zij), and (Rij), and substituting these values in (15) we get the tridiagonal matrix A. From (33), (34) we have G and F. So we obtain a system of linear equations. This system in the matrix form is AU+h2DF=G, solving this we get the solution matrix U.
The analytical solution of the given differential equation is(35)u(x)=x(1-x)ex.
Approximate values, exact values (35), and the absolute errors at the nodal points of u(x) are given in Table 4, and the comparison is given in Figure 3.Example 4.
Consider the boundary value problem:(36)u′′(x)-2u′(x)-2u(x)=-2;0≤x≤1,u(0)=0,u(1)=0,
Comparing the given equation with (10) we have qi=q(xi)=-2, r(x)=-2, fi=f(xi)=-2.
Hereh=0.1, so the nodal points are x0,x1,x2,…,x10. Solution of (36) is given by (15). Here G=(g1,0,0,0,0,0,0,0,g9)T, where g1=0.00333333, g9=0.00333333, and the function values at the nodal points is −2. That is,
(37)F=(f1,f2,…,f9.)T,wherefi=-2fori=1,2,…,9.
Substituting the values of pi, qi, and ri at i=0,1,2,…,10 in (16), (17), and (18) we get the values of (Pij), (Zij), and (Rij), and substituting these values in (15) we get the tridiagonal matrix A. From (37) we have G and F. So we obtain a system of linear equations. This system in the matrix form is AU+h2DF=G; solving this we get the solution matrix U.
The analytical solution of (36) is commutation
(38)u(x)=(1-e1+√3e1+√3-e1-√3)e(1-√3)x+(e1-√3-1e1+√3-e1-√3)e(1+√3)x+1.
Approximate solution, the exact solution, and the absolute errors at the nodal points of u(x) are given in Table 5, and the comparison is given in Figure 4. Comparative results obtained by our method of Example 4 with the values obtained by other methods are given in Table 6 and shown in Figure 4(b).Example 5.
Consider the non linear boundary value problem:(39)u′′(x)=12(1+x+u)3;0≤x≤1,u(0)=0,u(1)=0.
Comparing the given equation with (10) by taking g(x)=g(x,u) in (1) we have
(40)fi=f(xi,ui)=12(1+xi+ui)3,
and the nodal points with h=0.2 are xi=0,0.2,0.4,0.6,0.8,1 for i=0,1,2,3,4,5.
Now by choosingα=1/14 and β=3/7 and substituting these values in (16) and (19) we get the tridiagonal matrices P, D and
(41)G=(g1,0,0,g4)T,whereg1=g4=-0.00142857.
From (18) we have
(42)F=((1.2+u1)32,(1.4+u2)32,(1.6+u3)32,(1.8+u4)32)T.
Substituting P, D, (41), and (42) in (15), we obtain a system of nonlinear equations:
(43)12(1.2+u1)3+(1.4+u2)3+1400u1-700u2+1=0,(1.2+u1)3+12(1.4+u2)3+(1.6+u3)3-700u1+1400u2-700u3=0,(1.4+u2)3+12(1.6+u3)3+(1.8+u4)3-700u2+1400u3-700u4=0,(1.6+u3)3+12(1.8+u4)3-700u3+1400u4+8=0,
Solving these equations by Newton method we get the solution matrix U.
The analytical solution of (39) is
(44)u(x)=22-x-x-1.
The approximate solution (U), exact solution (u(x) of (44)) and the absolute errors are summarized in Table 7, and the comparison is given in Figure 5.


## 4. Conclusions

In the present work it has been described and demonstrated the applicability and efficiency of the nonpolynomial spline method for solving second order linear and nonlinear two point boundary value problems. The nonpolynomial spline method is tested on different problems. Numerical results for Examples1, 2, 3, 4, and 5 are presented in Tables 1, 2, 3, 4, 5, 6, and 7, and graphs between the exact solution and approximate solution have been plotted for all the 5 examples. In Example 2 the solution is obtained by choosing different values for α and β, and a comparison of errors is given in Figure 2(b) from which we can say that the error is reduced more rapidly with the choice of α=1/14 and β=3/7 than the other choices of α and β, and for Example 4 the graph (Figure 4(b)) is plotted by comparing with the results obtained by other known methods. This shows that the accuracy of our method is better than the accuracy of finite difference method and of B-spline method. All the tables and figures clearly indicate that our numerical solution converges to the exact solution. We conclude that the present method is an applicable technique and approximates the solution very well, and the numerical solutions are in very good agreement with the exact solution. Moreover non-polynomial spline method has less computational cost over other polynomial spline methods. The implementation of the present method is very easy, acceptable, and valid scheme.



---

*Source: 482050-2013-09-30.xml*