# A Numerical Method for Lane-Emden Equations Using Hybrid Functions and the Collocation Method

Authors: Changqing Yang; Jianhua Hou
Journal: Journal of Applied Mathematics
 (2012)

---

## Abstract

A numerical method to solve Lane-Emden equations as singular initial value problems is presented in this work. This method is based on the replacement of unknown functions through a truncated series of hybrid of block-pulse functions and Chebyshev polynomials. The collocation method transforms the differential equation into a system of algebraic equations. It also has application in a wide area of differential equations. Corresponding numerical examples are presented to demonstrate the accuracy of the proposed method.


---

## Body

## 1. Introduction

In recent years, studies on singular initial value problems in second-order ordinary differential equations have attracted much attention among mathematicians and physicists. One of the equations describing this type of problem is the Lane-Emden equation which can be written in the following form:(1.1)y′′+2xy′+f(y)=0,0<x≤1,(1.2)y(0)=A,y′(0)=B,
where A and B are constants, and f(y) is a real-valued continuous function. This equation has been used in the fields of mathematical physics and astrophysics to model several problems such as the stellar structure theory, the thermal behavior of a spherical gas cloud, isothermal gas spheres, and the thermionic current theory [1–3].On the other hand, another type of singular initial value problems of the Lane-Emden equation can also be given in the following form:(1.3)y′′+2xy′+f(x,y)=g(x),(1.4)y(0)=A,y′(0)=B,
where A and B are constants, f(x,y) is a continuous real-valued function, and g(x)∈C[0,1].Many methods have been used to solve Lane-Emden equations. However, most algorithms in current use to deal with Lane-Emden problems are based on either series solutions or perturbation techniques. For instance, approximate solutions to (1.1) were presented by Shawagfeh [4] and Wazwaz [5, 6] using the Adomian decomposition method which provides a convergent series solution. Ramos [7] presented a series approach to the Lane-Emden equation and made comparisons with He’s homotopy perturbation method. Dehghan and Shakeri [8] first applied exponential transformation to the Lane-Emden equation in order to address the difficulty of a singular point at x=0 and solve the resulting nonsingular problem using the variational iteration method. Yousefi [9] applied an integral operator, converted Lane-Emden equations to integral equations, and solved these integral equations using Legendre wavelets. Recently, Parand et al. [10] proposed an approximation algorithm for the solution of the nonlinear Lane-Emden type equation using Hermite functions collocation method. Moreover, Adibi and Rismani [11] introduced a modified Legendre-spectral method for solving (1.1). Wazwaz [12] applied the variational iteration method to solve the singular initial problems or boundary value problems of Emden-Fowler type of equations.In this work, we present a reliable algorithm based on hybrid functions and the collocation method in order to obtain approximate solutions for (1.3).The main advantage of our proposed method is its direct application to all types of differential equations whether linear or nonlinear, homogeneous or inhomogeneous, and with constant coefficients or with variable coefficients. Furthermore, the method can greatly reduce the size of computational work while still maintaining the numerical solution’s high accuracy because it does not employ numerical integration [9, 11, 13].


## 2. Properties of Hybrid Functions

### 2.1. Hybrid Functions of Block-Pulse and Chebyshev Polynomials

Hybrid functionshnm(x), n=1,2,…,N, m=0,1,2,…,M-1, are defined on the interval [0,1) as(2.1)hnm(x)={Tm(2Nx-2n+1),x∈[(n-1N),nN)0,otherwise.
Here, Tm(x) are the well-known Chebyshev polynomials of order m which satisfy the following recursive formula:(2.2)T0(x)=1,T2(x)=xTm+1(x)=2xTm(x)-Tm-1(x),m=1,2,3,….


### 2.2. Function Approximation

A functiony(x) defined over the interval 0 to t may be expanded as(2.3)y(x)=∑n=1∞∑m=0∞cnmhnm(x),
where (2.4)cnm=(y(x),hnm(x)).
in which (·,·) denotes the inner product.If the infinite series in (2.3) is truncated, then (2.3) can be written as(2.5)y(x)≈yNM(x)=∑n=1N∑m=0M-1cnmhnm(x)=CTH(x)=HT(x)C,
where(2.6)C=[c10,c11,…,c1M-1,c20,…,c2M-1,…cN0,…,cNM-1]T,(2.7)H(x)=[h10(x),h11(x),…,h1M-1(x),h20(x),…,h2M-1(x),…hN0(x),…,hNM-1(x)]T.
In (2.5) and (2.6), cnm, n=1,2,…,N, m=0,1,…,M-1, are the coefficients expansions of the function y(x) and hnm(x), n=1,2,…,N, m=0,1,…,M-1, are defined in (2.1).


### 2.3. Operational Matrix of the Integration

The integration of the vectorH(x) defined in (2.7) can be obtained as(2.8)∫0xH(t)dt≈PH(x),
where P is NM×NM matrix, that is called the operational matrix for integration and is given in [14].


## 2.1. Hybrid Functions of Block-Pulse and Chebyshev Polynomials

Hybrid functionshnm(x), n=1,2,…,N, m=0,1,2,…,M-1, are defined on the interval [0,1) as(2.1)hnm(x)={Tm(2Nx-2n+1),x∈[(n-1N),nN)0,otherwise.
Here, Tm(x) are the well-known Chebyshev polynomials of order m which satisfy the following recursive formula:(2.2)T0(x)=1,T2(x)=xTm+1(x)=2xTm(x)-Tm-1(x),m=1,2,3,….


## 2.2. Function Approximation

A functiony(x) defined over the interval 0 to t may be expanded as(2.3)y(x)=∑n=1∞∑m=0∞cnmhnm(x),
where (2.4)cnm=(y(x),hnm(x)).
in which (·,·) denotes the inner product.If the infinite series in (2.3) is truncated, then (2.3) can be written as(2.5)y(x)≈yNM(x)=∑n=1N∑m=0M-1cnmhnm(x)=CTH(x)=HT(x)C,
where(2.6)C=[c10,c11,…,c1M-1,c20,…,c2M-1,…cN0,…,cNM-1]T,(2.7)H(x)=[h10(x),h11(x),…,h1M-1(x),h20(x),…,h2M-1(x),…hN0(x),…,hNM-1(x)]T.
In (2.5) and (2.6), cnm, n=1,2,…,N, m=0,1,…,M-1, are the coefficients expansions of the function y(x) and hnm(x), n=1,2,…,N, m=0,1,…,M-1, are defined in (2.1).


## 2.3. Operational Matrix of the Integration

The integration of the vectorH(x) defined in (2.7) can be obtained as(2.8)∫0xH(t)dt≈PH(x),
where P is NM×NM matrix, that is called the operational matrix for integration and is given in [14].


## 3. Numerical Solution Using the Hybrid Functions and the Collocation Method

We then consider the Lane-Emden equations given in (1.3). First, we assume that the unknown function y′′(x) is given by
(3.1)y′′(x)=∑n=1N∑m=0M-1cnmhnm(x)=CTH(x).
Then using Condition (1.4), we obtain(3.2)y′(x)=CTPH(x)+B,y(x)=CTP2H(x)+Bx+A.
Substituting (3.1) and (3.2) into (1.3), we obtain(3.3)CTH(x)+2x(CTPH(x)+B)+f(x,CTP2H(x)+Bx+A)=g(x).
Rewriting (3.3) in the form(3.4)xCTH(x)+2(CTH(x)+B)+xf(x,CTH(x)+Bx+A)=xg(x).
We now collocate (3.4) at NM points xnm as(3.5)xnmCTH(xnm)+2(CTH(xnm)+B)+xnmf(xnm,CTH(xnm)+Bxnm+A)=xnmg(xnm).
Suitable collocation points are zeros of Chebyshev polynomials(3.6)xnm=12Ncos⁡(mπM-1+2n-1),m=0,1,2,…,M-1,n=1,2,…,N.
System (3.5) consists of NM nonlinear equations which can be solved using conventional iterative methods such as Newton’s method or the simplex method.


## 4. Accuracy of Solution

We can easily verify the accuracy of the method. Given that the truncated hybrid functions series in (2.5) are an approximate solution of (1.3), it must have approximately satisfied these equations. Thus, for each xi∈(0,1](4.1)E(xi)=CTH(xi)+2xi(CTPH(xi)+B)+f(xi,CTP2H(xi)+Bxi+A)-g(xi)≈0.
If max E(xi)=10-k (k is any positive integer) is prescribed, then the truncation limit N,M is increased until the difference E(xi) at each of the points xi becomes smaller than the prescribed 10-k.Proposition 4.1.
Lety(x)∈Hk(-1,1) (Sobolev space) and yN(x)=∑i=0NaiTi(x) be the best approximation polynomial of y(x) in Lω2-norm. Thus, the truncation error is
(4.2)‖y(x)-yN(x)‖Lω2[-1,1]≤C0N-k‖y(x)‖Hk(-1,1),
where C0 is a positive constant, which is dependent on the selected norm and independent of y(x) and N (proof [15]).Proposition 4.2.
Lety(x)∈Hk(0,1), In=[(n-1)/N,n/N] then
(4.3)‖y(x)-yNM(x)‖Lω2[0,1]≤C0M-kmax⁡0≤n≤N‖y(x)‖Hk(In).
By using of Proposition 4.1, it is obvious [16].


## 5. Numerical Examples

In the section, we demonstrate the accuracy of the proposed method in solving the Lane-Emden equation. In all the examples, we use the relations shown in Section3 to convert a differential equation to a system of nonlinear equations. The numerical results are presented in tabular form to illustrate the efficiency of the method. All computations were carried out using Matlab7.0.Example 5.1.
We consider the linear singular initial value problem [6]
(5.1)y′′+2xy′+y=6+12x+x2+x3,0<x≤1,(5.2)y(0)=0,y′(0)=0.
We applied the method presented in this paper and solved (5.1) with M=4, N=1. For this equation, we find
(5.3)c0=7.5000000000000000e-001,c1=1.500000000000000e+000,c2=7.500000000000000e-001.
Using (2.6), we obtain
(5.4)y(x)=x2+x3,
which is the exact solution.Example 5.2.
We consider the linear singular initial value problem [6, 13]
(5.5)y′′+2xy′+y=2(2x2+3)y,0<x≤1,(5.6)y(0)=1,y′(0)=0.
The exact solution for this problem is y(x)=ex2. We assume that
(5.7)y′′(x)=∑n=1N∑m=0M-1cnmhnm(x)=CTH(x).
Using the boundary condition in (5.7)), we derive
(5.8)y′(x)=CTPH(x)+0,(5.9)y(x)=CTP2H(x)+0x+1.
Now, by inserting (5.7)–(5.9) into (5.5), we obtain
(5.10)xCTH(x)+2(CTPH(x))+x(CTP2H(x)+1)=x⋅2(2x2+3)(CTP2H(x)+1).
The collocation points are
(5.11)xnm=12Ncos⁡(mπM-1+2n-1),m=0,1,2,…,M-1,n=1,2,…,N.
Using these points, we obtain
(5.12)xnmCTH(xnm)+2(CTPH(xnm))+xnm(CTP2H(xnm)+1)-xnm⋅2(2xnm2+3)(CTP2H(xnm)+1)=0.
By solving (5.12), we obtain the coefficients ci’s. Using (5.9), we then derive the approximate solution. Table 1 shows the absolute error of the exact and approximate solution for N=2, M=3 and N=2, M=5.Table 1
Comparison of the absolute errors for Example5.2.
xMethod in [10]Present methodPresent method(n=30)(N=2, M=3)(N=2, M=5)00000.11.78e−085.73e−0062.52e−0090.22.09e−087.22e−0063.05e−0100.52.62e−081.17e−0052.61e−0090.73.27e−081.22e−0061.28e−0090.83.79e−081.88e−0066.19e−0090.95.48e−081.31e−0062.02e−0101.02.51e−098.49e−0061.30e−010Example 5.3.
We consider the nonlinear singular initial value problem [6, 10, 13]
(5.13)y′′+2xy′+4(2ey+ey/2)=0,0<x≤1,(5.14)y(0)=0,y′(0)=0,
with the exact solution y(x)=-2ln(1+x2).We solved (5.13) using the method presented in this paper. Table 2 shows the absolute errors of exact and approximate solutions in some points of the interval [0,1] obtained by presented method for N=2, M=5. The comparison of absolute errors using present method and the method in [10] with m=30 is shown in Figure 1. It is easily found that the present approximations are more efficient.Table 2
Absolute error of Example5.3′s exact and approximated solution.
xApproximated solutionExact solutionAbsolute error00000.1−1.990065975846963e−002−1.990066170633618e−0021.947866552082234e−0090.2−7.844142227675365e−002−7.844142630656266e−0024.029809014260977e−0090.3−1.723553877014332e−001−1.723553924821048e−0014.780671636339662e−0090.42.968400304512400e−001−2.968400102365468e−0012.021469319712921e−0080.5−4.462871382464894e−001−4.462871026284195e−0013.561806982688154e−0080.6−6.149693761315079e−001−6.149693994959211e−0012.336441318195881e−0080.7−7.975522016254086e−001−7.975522399147356e−0013.828932693128451e−0080.8−9.893925027250091e−001−9.893924836722143e−0011.905279478631172e−0080.9−1.186653691831187e+000−1.186653690555469e+0001.275718419790906e−0091.0−1.386294358347456e+000−1.386294361119891e+0002.772434948283831e−009Comparison of absolute errors using the present method and method in [10] for Example 5.3.


## 6. Conclusion

We have solved the Lane-Emden equation by using hybrid functions and the collocation method. The properties of the hybrid functions are used to reduce the equation to the solution of nonlinear algebraic equations. Illustrative examples are given to demonstrate the validity and applicability of the proposed method. We believe that the proposed method is applicable to higher-order differential equations and to other sets of orthogonal polynomials.



---

*Source: 316534-2012-02-12.xml*