You are on page 1of 10

Int. J. Appl. Comput.

Math
DOI 10.1007/s40819-015-0128-5

ORIGINAL PAPER

On the Numerical Solution of Singular Lane–Emden


Type Equations Using Cubic B-spline Approximation

Hossein Aminikhah1 · Somayyeh Kazemi1

© Springer India Pvt. Ltd. 2015

Abstract In this article, a numerical approximation is presented for solving the nonlinear
Lane–Emden type equations. The method is based on cubic B-spline approximations that
leads to a system of nonlinear equations and the unknowns have been obtained by using
the optimization. Truncation error of this method is obtained. Some numerical examples are
presented to demonstrate the validity and applicability of the method.

Keywords Lane–Emden equations · Cubic B-splines · Truncation error

Introduction

Lane–Emden equations are singular initial value problems relating to second-order ordi-
nary differential equations (ODEs) which have been used to model several phenomena in
mathematical physics and astrophysics such as thermal explosions, stellar structure, the ther-
mal behaviour of a spherical cloud of gas, isothermal gas spheres, and thermionic currents
[1,2]. In astrophysics, the equation which describes the equilibrium density distribution in
self-gravitating sphere of polytropic isothermal gas was proposed by Lane [3] and further
describe by Emden [4] which are known as Lane–Emden equations. Lane–Emden equations
have the following form:
m
y  (x) + y  (x) + f (x, y) = g(x), 0 < x ≤ 1, m ≥ 0, (1)
x
with supplementary conditions
y(0) = α, y  (0) = 0. (2)

B Hossein Aminikhah
hossein.aminikhah@gmail.com; aminikhah@guilan.ac.ir
Somayyeh Kazemi
somayehkazemi8@gmail.com
1 Department of Applied Mathematics, School of Mathematical Sciences, University of Guilan,
P.O. Box 1914, P.C. 41938 Rasht, Iran

123
Int. J. Appl. Comput. Math

where α is a known constant, f (x, y) is a continuous real-valued function, and g(x) ∈


C[0, 1].
Several methods for the solution of Lane–Emden equations have been presented. Bender
et al. [5], proposed a new perturbation technique based on an artificial parameter δ, the
method is often called δ-method. Mandelzweig et al. [6] used Quasilinearization approach
to solve Lane–Emden equation. Wazwaz [7] has given a general way to construct exact
and series solutions to Lane–Emden equations by employing the Adomian decomposition
method. A numerical solution of Lane–Emden equations is given based on the Legendre
wavelets methods by Aminikhah and Moradian [8]. The fundamental work was done by
Liao [9] by introducing homotopy analysis method (HAM) in his Ph.D. dissertations. He
[10] obtained an approximate analytical solution of the Lane–Emden equation by applying a
variational approach which uses a semi-inverse method. In [11], series solutions of the Lane–
Emden equation have been obtained by writing this equation as a Volterra integral equation
and assuming that the nonlinearities are sufficiently differentiable. These series solutions
have been obtained by either working with the original differential equation or transforming
it into an ordinary differential equation that does not contain first-order derivatives. Parand
et. al [12] proposed an approximation algorithm for the solution of the nonlinear Lane–
Emden type equation using Hermite functions collocation method. The piecewise polynomial,
especially B-spline, has become a fundamental tool for numerical methods to get the solution
of the differential equations [13–20]. The aim of the present paper is to apply cubic B-spline
collocation method for solving Lane–Emden equation. This method produces a system of
equations. The values of the coefficients Ci , i = −1, . . . , n + 1, obtained by using the
optimization [14].

Description of the Method

Let be a uniform partition of an interval [a, b] as follows a = x 0 < x1 < · · · < xn−1 < xn =
b, where xi : xi = a + i h, i = 0, 1, . . . , n, h = b−an . The cubic B-splines basis functions
are defined as [19]:


⎪ (x − xi−2 )3 xi−2 ≤ x < xi−1




⎪ (x − xi−2 ) − 4(x − xi−1 ) xi−1 ≤ x < xi
3 3
1 ⎨
B3,i (x) = 3 (xi+2 − x) − 4(xi+1 − x)
3 3 xi ≤ x < xi+1 (3)
h ⎪ ⎪

⎪ (xi+2 − x) 3 xi+1 ≤ x < xi+2




0 otherwise

where the set {B3,−1 , B3,0 , . . . , B3,n+1 } of cubic B-splines forms a basis over the region
a ≤ x ≤ b. The values of B3,i (x) and its derivatives are tabulated in Table 1.
In order to define Lane–Emden equation at the origin, we use the L’Hôpital rule at the
point x = 0, and we can obtain [20,21]

Table 1 Coefficient of cubic


x xi−2 xi−1 xi xi+1 xi+2
B-splines and its derivatives at
knots xi
B3,i (x) 0 1 4 1 0
 (x)
B3,i 0 3 0 − h3 0
h
 (x)
B3,i 0 6 − 122 6 0
h2 h h2

123
Int. J. Appl. Comput. Math


(m + 1)y  (x) + f (x, y(x)) = g(x), f or x = 0,
(4)
y  (x) + m 
x y (x) + f (x, y(x)) = g(x), f or x  = 0.

In this method, the solution of Eq. (1) is approximated by S(x) where is defined as a linear
combination of cubic B-splines basis functions [22], as follows:


n+1
S(x) = Ci B3,i (x) (5)
i=−1

where B3,i (x) are the cubic B-spline functions and Ci are the unknown coefficients. Each
B-spline covers the four elements so that an element is covered by four B-splines. By using
Table 1 the approximate values of S(x) and its two derivatives at the point x = xi can be
determined as follows:

S(xi ) = Ci−1 + 4Ci + Ci+1 , (6)


 
3 3
S  (xi ) = Ci−1 − Ci+1 , (7)
h h
  
 6 −12 6
S (xi ) = Ci−1 + Ci + Ci+1 , (8)
h2 h2 h2
where i = 0, 1, . . . , n. Putting Eqs. (6)–(8) into Eqs. (4) and (2), we will have
⎧ 
⎪ (m + 1)S (xi ) + f (xi , S(xi )) = g(xi ),


i =0

⎨ S  (xi ) + m S  (xi ) + f (xi , S(xi )) = g(xi ), i = 1, 2, . . . , n
xi
(9)

⎪ S(xi ) = α, i = 0,


⎩ 
S (xi ) = 0, i = 0.

Then, we get a system of (n + 3) nonlinear equations that has the (n + 3) unknowns


C−1 , C0 , . . . , Cn+1 . In order to solve the system (9), we attention to that S(x) and its deriv-
atives are the approximate solution of Eqs. (4) and (2), hence
⎧ 
⎪ (m + 1)S (xi ) + f (xi , S(xi )) ≈ g(xi ),


i =0

⎨ S  (xi ) + m S  (xi ) + f (xi , S(xi )) ≈ g(xi ), i = 1, 2, . . . , n
xi

⎪ S(xi ) ≈ α, i = 0,


⎩ 
S (xi ) ≈ 0, i = 0.
Therefore, the error vector E of the approximation can be written as

E 1 = S(x0 ) − α,
E 2 = S  (x0 ),
E 3 = (m + 1)S  (0) + f (0, S(0)) − g(0),
m
E i+3 = S  (xi ) + S  (xi ) + f (xi , S(xi )) − g(xi ), i = 1, 2, . . . , n.
xi
Now, we wish to minimize the error norm, the L 2 -norm, such that

n+3

L2 = E i2 = 0. (10)
i=1

123
Int. J. Appl. Comput. Math

By solving Eq. (10), we can get the values of Ci for i = −1, 0, . . . , n + 1. Now, with
substituting the values C−1 , C0 , . . . , Cn+1 into Eqs. (6)–(8), the approximate value of S(x)
and its derivatives will ensure.

Truncation Error

In this section, we calculate the truncation error. Attention to Eqs. (6)–(8), we will get the
following relationships [13]
h[S  (xi−1 ) + 4S  (xi ) + S  (xi+1 )] = 3[S(xi+1 ) − S(xi−1 )], (11)
h 2 S  (xi ) = 6[S(xi+1 ) − S(xi )] − 2h[2S  (xi ) + S  (xi+1 )]. (12)
By using Eqs. (11) and (12), we have
h 4 (5)
S  (xi ) = y  (xi ) − y (xi ) + O(h 6 ), (13)
180
h 2 (4) h 4 (6)
S  (xi ) = y  (xi ) − y (xi ) + y (xi ) + O(h 6 ). (14)
12 360
Then, truncation error is defined as follows:
m
e(xi ) = g(xi ) − y  (xi ) − y  (xi ) − f (xi , y(xi ))
xi
m  m
= S (xi ) + S (xi ) + f (xi , S(xi )) − y  (xi ) − y  (xi ) − f (xi , y(xi ))

xi xi
  m  
= (S (xi ) − y (xi )) + (S (xi ) − y (xi )), i = 1, 2, . . . , n.
xi
Hence,

y (4) (xi ) 2 y (6) (xi ) my (5) (xi )
e(xi ) = − h + − h 4 + O(h 6 ), i = 1, 2, . . . , n (15)
12 360 180xi

and for i = 0, we have


e(x0 ) = g(x0 ) − (m + 1)y  (x0 ) − f (x0 , y(x0 ))
= (m + 1)S  (x0 ) + f (x0 , S(x0 )) − (m + 1)y  (x0 ) − f (x0 , y(x0 ))
= (m + 1)(S  (x0 ) − y  (x0 )),
then we have the following result
(m + 1)y (4) (x0 ) 2 (m + 1)y (6) (x0 ) 4
e(x0 ) = − h + h + O(h 6 ). (16)
12 360
Therefore the truncation error for the Lane–Emden equation is O(h 2 ).

Numerical Results

In this section, three examples are studied to demonstrate the accuracy of the present method.
The error between the proposed method and the exact solutions is measured numerically with
the maximum absolute errors (L ∞ -norms) and Euclidean norms (L 2 -norms) for different

123
Int. J. Appl. Comput. Math

values of the step size h and absolute errors in some mesh points are presented. All the
results of these examples are calculated by using MATLAB 2015a. Results obtained by the
method are found to be a good agreement with the exact solution.

Example 1 Consider the following nonlinear Lane–Emden equation


6 
y  (x) + y (x) + 14y(x) = −4y(x) ln(y(x)), 0 < x ≤ 1, (17)
x
subject to the initial conditions

y(0) = 1, y  (0) = 0, (18)

Table 2 Comparison of y(x) for


x Exact Numerical method
present method with
h = 0.1, 0.01 and exact solutions h = 0.1 h = 0.01
for Example 1
0.0 1 1 1
0.1 0.990050 0.990074 0.990050
0.2 0.960789 0.960825 0.960790
0.3 0.913931 0.913989 0.913932
0.4 0.852144 0.852224 0.852145
0.5 0.778801 0.778893 0.778802
0.6 0.697676 0.697764 0.697677
0.7 0.612626 0.612690 0.612627
0.8 0.527292 0.527311 0.527293
0.9 0.444858 0.444816 0.444858
1.0 0.367879 0.367766 0.367878

Table 3 Absolute and norm


x h = 0.1 h = 0.05 h = 0.01
errors of example 1 when using
different values of h
0.0 0 0 1.1732 × 10−11
0.1 2.4526 × 10−5 2.4280 × 10−6 7.0808 × 10−8
0.2 3.5516 × 10−5 7.0765 × 10−6 2.5965 × 10−7
0.3 5.8209 × 10−5 1.3276 × 10−5 5.1205 × 10−7
0.4 8.0580 × 10−5 1.9090 × 10−5 7.4991 × 10−7
0.5 9.2398 × 10−5 2.2472 × 10−5 8.9071 × 10−7
0.6 8.7850 × 10−5 2.1735 × 10−5 8.6632 × 10−7
0.7 6.3275 × 10−5 1.5922 × 10−5 6.3802 × 10−7
0.8 1.8674 × 10−5 5.0118 × 10−6 2.0469 × 10−7
0.9 4.2298 × 10−5 1.0087 × 10−5 3.9743 × 10−7
1.0 1.1311 × 10−4 2.7734 × 10−5 1.1025 × 10−6
L 2 -norm 2.1664 × 10−4 5.2188 × 10−5 2.0648 × 10−6
L ∞ -norm 1.1311 × 10−4 2.7734 × 10−5 1.1025 × 10−6

123
Int. J. Appl. Comput. Math

The exact solution of this problem is given as y(x) = e−x . Comparison between analytical
2

and numerical results are presented in Table 2. Table 3 shows absolute and norm errors for
different values of h. A plot of absolute errors is displayed in Fig. 1.
Example 2 Consider the following nonlinear Lane–Emden equation
2 
y  (x) + y (x) + y 5 (x) = 0, 0 < x ≤ 1, (19)
x
subject to the initial conditions
y(0) = 1, y  (0) = 0. (20)

Fig. 1 Absolute errors of example 1 when using different values of h

Table 4 Comparison of y(x) for


x Exact Numerical method
present method with
h = 0.1, 0.01 and exact solutions h = 0.1 h = 0.01
for Example 2
0.0 1 1 1
0.1 0.998337 0.998340 0.998338
0.2 0.993399 0.993406 0.993399
0.3 0.985329 0.985342 0.985329
0.4 0.974355 0.974374 0.974355
0.5 0.960769 0.960794 0.960769
0.6 0.944911 0.944941 0.944912
0.7 0.927146 0.927178 0.927146
0.8 0.907841 0.907874 0.907842
0.9 0.887357 0.887386 0.887357
1.0 0.866025 0.866050 0.866026

123
Int. J. Appl. Comput. Math

Table 5 Absolute and norm


x h = 0.1 h = 0.05 h = 0.01
errors of example 2 when using
different values of h
0.0 0 0 9.0475 × 10−8
0.1 2.7377 × 10−6 4.5611 × 10−7 1.0363 × 10−7
0.2 6.9792 × 10−6 1.4160 × 10−6 1.4015 × 10−7
0.3 1.2519 × 10−5 2.8278 × 10−6 1.9359 × 10−7
0.4 1.8867 × 10−5 4.4491 × 10−6 2.5437 × 10−7
0.5 2.4952 × 10−5 6.0082 × 10−6 3.1179 × 10−7
0.6 2.9763 × 10−5 7.2493 × 10−6 3.5579 × 10−7
0.7 3.2491 × 10−5 7.9685 × 10−6 3.7844 × 10−7
0.8 3.2619 × 10−5 8.0345 × 10−6 3.7467 × 10−7
0.9 2.9934 × 10−5 7.3938 × 10−6 3.4252 × 10−7
1.0 2.4503 × 10−5 6.0631 × 10−6 2.8283 × 10−7
L 2 -norm 7.5455 × 10−5 1.8388 × 10−5 9.1949 × 10−7
L ∞ -norm 3.2619 × 10−5 8.0345 × 10−6 3.7844 × 10−7

Fig. 2 Absolute errors of example 2 when using different values of h

2
The exact solution of this problem is given as y(x) = (1+ x3 )−1/2 . In Table 4 a comparison
between exact and numerical results are presented. Absolute and norm errors for different
values of h are presented in Table 5. Absolute error between the numerical and analytical
solution is also depicted in Fig. 2.

Example 3 Consider the following nonlinear Lane–Emden equation


2 
y  (x) + y (x) + 4(2e y + e y/2 ) = 0, 0 < x ≤ 1, (21)
x

123
Int. J. Appl. Comput. Math

Table 6 Comparison of y(x) for


x Exact Numerical method
present method with
h = 0.1, 0.01 and exact solutions h = 0.1 h = 0.01
for Example 3
0.0 0 −0.000000 0.000000
0.1 −0.019901 −0.019836 −0.019900
0.2 −0.078441 −0.078286 −0.078440
0.3 −0.172355 −0.172104 −0.172353
0.4 −0.296840 −0.296510 −0.296837
0.5 −0.446287 −0.445926 −0.446284
0.6 −0.614969 −0.614637 −0.614966
0.7 −0.797552 −0.797308 −0.797550
0.8 −0.989392 −0.989284 −0.989391
0.9 −1.186654 −1.186714 −1.186654
1.0 −1.386294 −1.386542 −1.386297

Table 7 Absolute and norm


x h = 0.1 h = 0.05 h = 0.01
errors of example 3 when using
different values of h
0.0 4.3368 × 10−19 3.9031 × 10−18 7.7386 × 10−8
0.1 6.4497 × 10−5 1.0736 × 10−5 4.0228 × 10−7
0.2 1.5516 × 10−4 3.1380 × 10−5 1.2356 × 10−6
0.3 2.5181 × 10−4 5.6728 × 10−5 2.2595 × 10−6
0.4 3.2972 × 10−4 7.7505 × 10−5 3.1001 × 10−6
0.5 3.6092 × 10−4 8.6527 × 10−5 3.4685 × 10−6
0.6 3.3215 × 10−4 8.0402 × 10−5 3.2288 × 10−6
0.7 2.4446 × 10−4 5.9382 × 10−5 2.3913 × 10−6
0.8 1.0858 × 10−4 2.6177 × 10−5 1.0650 × 10−6
0.9 6.0406 × 10−5 1.5418 × 10−5 5.9774 × 10−7
1.0 2.4723 × 10−4 6.1568 × 10−5 2.4431 × 10−6
L 2 -norm 7.5978 × 10−4 1.8032 × 10−4 7.2142 × 10−6
L ∞ -norm 3.6092 × 10−4 8.6527 × 10−5 3.4685 × 10−6

subject to the initial conditions


y(0) = 0, y  (0) = 0, (22)
The exact solution of this problem is given as y(x) = −2 ln(1 + x 2 ). Exact and
numerical results have been compared in Table 6. In Table 7 absolute and norm errors for
h = 0.1, 0.05, 0.01, are presented. Absolute error for different values of h, is depicted in
Fig. 3.

123
Int. J. Appl. Comput. Math

Fig. 3 Absolute errors of example 3 when using different values of h

Conclusion

The Lane–Emden type equations describe a variety of phenomena in theoretical physics and
astrophysics, including the aspects of stellar structure, the thermal history of a spherical
cloud of gas, isothermal gas spheres, and thermionic currents. The fundamental goal of
this paper has been to construct an approximation to the solution of nonlinear Lane–Emden
equation. We presented a new approach to solve Lane–Emden equations using cubic B-spline
approximations. This method produces a system of nonlinear equations. The unknowns are
obtained by optimization. Three problems have been solved to assess the efficiency and
performance of the method.

Acknowledgments We are very grateful to anonymous referee for their careful reading and valuable com-
ments which led to the improvement of this paper.

References
1. Chandrasekhar, S.: An Introduction to the Study of Stellar Structure. Dover Publications, New York, NY
(1967)
2. Richardson, O.U.: The Emission of Electricity From Hot Bodies. Longmans Green and Company, London
(1921)
3. Lane, J.H.: On the theoretical temperature of the sun under the hypothesis of a gaseous mass maintaining
its volume by its internal heat and depending on the laws of gases known to terrestrial experiment. Am.
J. Sci. Arts 2nd Ser. 50, 57–74 (1870)
4. Emden Gaskugeln, R.: Anwendungen der mechanischen Warmen-theorie auf Kosmologie and meteorol-
ogische Problem, Leipzig, Teubner (1907)
5. Bender, C.M., Milton, K.A., Pinsky, S.S., Simmons Jr, L.M.: A new perturbative approach to nonlinear
problems. J. Math. Phys. 30, 1447–1455 (1989)
6. Mandelzweig, V.B., Tabakin, F.: Quasilinearization approach to nonlinear problems in physics with appli-
cation to nonlinear ODEs. Comput. Phys. Commun. 141, 268–281 (2001)
7. Wazwaz, A.M.: A new algorithm for solving differential equations of Lane–Emden type. Appl. Math.
Comput. 118, 287–310 (2001)

123
Int. J. Appl. Comput. Math

8. Aminikhah, H., Moradian, S.: Numerical solution of singular Lane–Emden equation. ISRN Math. Phys.
Volume 2013, Article ID 507145, 9 pp
9. Liao, S.J.: On the Proposed Homotopy Analysis Technique for Nonlinear Problems and Its Applications.
Ph.D. Dissertation, Shanghai Jio Tong University, Shanghai, China (1992)
10. He, J.H.: An approximation solution technique depending upon an artificial parameter. Commun. Non-
linear Sci. Numer. Simul. 3, 92–97 (1998)
11. Ramos, J.I.: Series approach to the Lane–Emden equation and comparison with the homotopy perturbation
method. Chaos Solitons Fractals 38, 400–408 (2008)
12. Parand, K., Dehghan, M., Rezaeia, A., Ghaderi, S.: An approximation algorithm for the solution of
the nonlinear Lane–Emden type equations arising in astrophysics using Hermite functions collocation
method. Comput. Phys. Commun. 181, 1096–1108 (2010)
13. Kadalbajoo, M.K., Kumar, V.: B-spline method for a class of singular two-point boundary value problems
using optimal grid. Appl. Math. Comput. 188, 1856–1869 (2007)
14. Goh, J., Majid, A.A., Ismail, A.I.M.: A quartic B-spline for second-order singular boundary value prob-
lems. Comput. Math. Appl. 64, 115–120 (2012)
15. Khuri, S.A., Sayfy, A.: A spline collocation approach for a generalized parabolic problem subject to
non-classical conditions. Appl. Math. Comput. 218, 9187–9196 (2012)
16. Mittal, R.C., Jain, R.K.: Numerical solutions of nonlinear Burgers equation with modified cubic B-splines
collocation method. Appl. Math. Comput. 218, 7839–7855 (2012)
17. Aminikhah, H., Alavi, J.: Numerical study of the nonlinear Cauchy diffusion problem and Newell-
Whitehead equation via cubic B-spline quasi-interpolation. Iran. J. Numer. Anal. Optim. 5, 63–72 (2015)
18. Jafari, Hossein, Tajadodi, Haleh, Baleanu, Dumitru: A numerical approach for fractional order Riccati
differential equation using B-spline operational matrix. Fract. Calc. Appl. Anal. 18, 387–399 (2015)
19. Deboor, C.: A Practical Guide to Splines. Springer, Berlin (1978)
20. Caglar, N., Caglar, H.: B-spline solution of singular boundary value problems. Appl. Math. Comput. 182,
1509–1513 (2006)
21. Ravi, A.S.V., Kanth, Y.N.: Reddy, higher order finite difference method for a class of singular boundary
value problems. Appl. Math. Comput. 155, 249–258 (2004)
22. Prenter, P.M.: Splines and Variational Methods. Wiley, Hoboken (1989)

123

You might also like