937
Views
2
CrossRef citations to date
0
Altmetric
Research Article

Solving Lane–Emden equations with boundary conditions of various types using high-order compact finite differences

ORCID Icon, ORCID Icon & ORCID Icon
Article: 2214303 | Received 15 Jun 2022, Accepted 04 May 2023, Published online: 29 May 2023

Abstract

In this study, a high-order compact finite difference method is used to solve Lane–Emden equations with various boundary conditions. The norm is to use a first-order finite difference scheme to approximate Neumann and Robin boundary conditions, but that compromises the accuracy of the entire scheme. As a result, new higher-order finite difference schemes for approximating Robin boundary conditions are developed in this work. We test the applicability and performance of the method using different examples of Lane–Emden equations. Convergence analysis is provided, and it is consistent with the numerical results. The results are compared with the exact solutions and published results from other methods. The method produces highly accurate results, which are displayed in tables and graphs.

Mathematics Subject Classifications (2010):

1. Introduction

Lane–Emden equations model a wide range of problems in physics and astrophysics, with applications including stellar structure, thermal explosions, isothermal gas spheres, radiative cooling, thermionic currents, and the thermal behaviour of a spherical cloud of gas [Citation1–8]. They are singular ordinary differential equations first studied by astrophysicist Jonathan Homer Lane [Citation9]. He later collaborated with Robert Emden to investigate them further. They considered the thermal behaviour of a spherical cloud of gas acting under the mutual attraction of its molecules and subject to the classical laws of thermodynamics. Due to these important applications, the Lane–Emden equation is among the most numerically investigated differential equations. One of the challenges with solving them is dealing with the singularity at x = 0. The Lane–Emden equations have been solved using various analytical and numerical methods, such as Adomian decomposition method [Citation10–13], variational iterational method [Citation14–17], Taylor series method [Citation18], differential transformation method [Citation19], modified Homotopy analysis method [Citation20], finite difference method [Citation21–23], spline method [Citation24–27], the optimal iteration method [Citation28], Adomaian decomposition method with Green's function [Citation29,Citation30], Chebyshev economization method [Citation31], optimal homotopy analysis method [Citation32], Haar wavelet collocation method [Citation33], Sin-Galerkin method [Citation34], differential transform method [Citation35], homotopy perturbation method [Citation36], asymptotic method [Citation37], Bernstein polynomials method [Citation38], to name a few.

Compact finite difference schemes (CFDS) have gained popularity in numerical approximations in recent years. Lele [Citation39] gave an in-depth description of CFDS for various applications such as interpolation, filtering, and evaluating derivatives. The CFDS has been applied to solve differential equations such as Poisson's equation [Citation40], Burger's equation [Citation41,Citation42], American option pricing problems [Citation43], Navier–Stokes equation [Citation44], integro-differential equation [Citation45,Citation46], Korteweg–de Vries equation [Citation47], Black–Scholes equation [Citation48,Citation49], dynamical systems [Citation50,Citation51], and many more [Citation52–56]. Their main advantage is that, with few grid points, they attain very high order accuracy.

In this paper, we use higher-order compact finite difference schemes to solve Lane–Emden equations of the form: (1) y(x)+αxy(x)=f(x,y)for0x1,(1) subject to the boundary conditions y(0)=α1,y(1)=β1,y(0)=α2,y(1)=β2,y(0)=γ1,α3y(1)+β3y(1)=γ2,where α,α1,α2,α3,β1,β2,β3,γ1,γ2 are constants. We assume the following conditions on f(x,y):

  • f(x,y),fy(x,y)C(Ω),

  • fy(x,y)0 on Ω, where Ω:={(0,1]×R}.

To maintain the same level of accuracy at the boundary points as in the interior points, the compact finite schemes are adjusted at the boundaries. In this work, we develop new compact schemes for Robin boundary conditions. In most cases, Neumann or Robin boundary conditions are approximated using first-order schemes, even if a higher-order method is used to solve the equation. The disadvantage is that the accuracy of the whole method is affected. To deal with the singularity at x = 0, we apply L‘Hospital‘s rule [Citation27] to Equation (Equation1). Thus, Equation (Equation1) reduces to (2) y+U(x)y=G(x,y),(2) where G(x,y)={f(x,y),if x0,1α+1f(x,y),if x=0,and U(x)={αx,if x0,0,if x=0.The rest of the paper is laid out as follows. In Section 2, we discuss the quasilinearization technique. In Section 3, we present the derivations of the sixth-order compact finite difference schemes. In Section 4, we discuss the development of compact finite difference schemes with various boundary conditions. We discuss the convergence of the method in Section 5. The results and discussion are presented in Section 6, followed by the conclusions in Section 7.

2. Quasilinearization

Before applying the CFDS, we must first linearize Equation (Equation2). To this end, we use the quasilinearization (QLM) technique that Bellman and Kalaba introduced [Citation57]. The QLM reduces the nonlinear Lane–Emden equations into a sequence of linear Lane–Emden equations, which we solve iteratively until a set tolerance level is reached. One of the key factors motivating many academics to employ the quasilinearization method is its quadratic convergence and numerical stability [Citation58]. In [Citation59], Keller discusses the method's stability and convergence properties.

We expand the nonlinear function G(x,y) in Equation (Equation2) using Taylor's series up to the first-order terms to get (3) yr+1+U(x)yr+1=G(x,yr)+(yr+1yr)G(x,yr)yr(3) (4) yr+1+a1yr+1+a0yr+1=R(x,yr)(4) where a0=G(x,yr)yra1=U(x)R(x,yr)=G(x,yr)+a0yr

3. Compact finite difference schemes at interior nodes

In this section, we present the derivations of the sixth-order CFDS for approximating first and second derivatives. We consider a function f(x) defined on x[a,b], where a and b are arbitrary constants. We discretize the domain into N number of nodes with a uniform step size h=(ba)/(N1) and nodes xi=a+ih,0iN1.

3.1. First derivative approximation

The general formula for approximating the first derivatives is given by (5) Afi1+fi+Afi+1=a1fi2+a2fi1+a3fi+a4fi+1+a5fi+2+T1,(5) where fi=f(xi) and T1 is the truncation error. A,ai(i=1,5) are constants to be determined. The values of these constants are obtained by expanding both sides of Equation (Equation5) using the Taylor series expansion about xi and matching the coefficients of fi(n), with n=1,2,,6 for a sixth-order accurate scheme. That results in six algebraic equations that are solved to obtain the following constants: A=13,a1=136h,a2=79h,a3=0,a4=79h,a5=136h.Therefore, the scheme for approximating the first derivative is given by (6) 13fi1+fi+13fi+1=136hfi279hfi1+79hfi+1+136hfi+2+T1(i).(6) The first unmatched coefficients of Taylor series expansion are used to determine the truncation error, which is given by T1(i)=h75040(128a1f(7)(x)+a2f(7)(x)a4f(7)(x)128a5f(7)(x))=h61260f(7)(x).

3.2. Second derivative approximation

The general formula for approximating second derivatives is given by (7) Afi1+fi+Afi+1=a1fi2+a2fi1+a3fi+a4fi+1+a5fi+2+T2,(7) with T2 being the truncation error. Similarly, the values of these constants are obtained by expanding both sides of Equation (Equation7) using the Taylor series expansion about xi and matching the coefficients of fi(n), with n=1,2,,6 for a sixth-order accurate scheme. That results in six algebraic equations that are solved to obtain the following constants. A=211,a1=344h2,a2=1211h2,a3=5122h2,a4=1211h2,a5=344h2.Therefore, the scheme for approximating the second derivative is given by (8) 211fi1+fi+211fi+1=344h2fi2+1211h2fi15122h2fi+1211h2fi+1+344h2fi+2+T2(i).(8) Similarly, the first unmatched coefficients of Taylor series expansion are used to determine the truncation error, which is given by T2=h840320(256a1f(8)(x)a2f(8)(x)a4f(8)(x)256a5f(8)(x))=23h655440f(8)(x).

4. Compact finite difference schemes at boundary points

In this section, we develop sixth-order CFDS for approximating first and second derivatives for arbitrary functions with Dirchlet, Neumaan, and Robin boundary conditions. To accommodate the boundary conditions and maintain a sixth-order accuracy at the boundaries, the schemes are adjusted appropriately. To that end, we use one-sided compact finite difference schemes, specifically for the points x0,x1,xN1 and xN. The procedure of deriving the schemes at the boundary is similar to the previous section. The derivatives at the interior points x2,x3,,xN2 are approximated using Equations (Equation6) and (Equation8) described in Section 2.

4.1. Dirichlet boundary conditions

In this subsection, we develop sixth-order compact finite difference schemes for approximating first and second derivatives for arbitrary functions with Dirichlet boundary conditions.

4.1.1. First derivative approximation

The one-sided schemes for the first derivative at the boundary points are given as follows:

At i = 1, we use (9) f1+13f2=451180hf1+1003180hf2203hf3+559hf412536hf5+6760hf6745hf7.(9) At i = 2, we use (10) 13f1+f2+13f3=3536hf1+712hf2736hf3+1hf4712hf5+736hf6136hf7.(10) At i = N−1, we use (11) 13fN+fN1+13fN2=3536hfN712hfN1+736hfN21hfN3+712hfN4736hfN5+136hfN6.(11) Finally, at i = N, we use (12) fN+13fN1=451180hfN1003180hfN1+203hfN2559hfN3+12536hfN46760hfN5+745hfN6.(12) The sixth-order accurate compact finite difference approximation matrix for approximating the first derivative of an arbitrary function with Dirichlet boundary condition is obtained by combining Equation (Equation6) with Equations (Equation9Equation12).

4.1.2. Second derivative approximation

The one-sided schemes for the second derivative at the boundary points are given as follows: At i = 1, we have (13) f1+211f2=1057198h2f122147990h2f2+9561220h2f3513499h2f4+399299h2f543522h2f6+11029198h2f73145h2f8.(13) At i = 2, we have (14) 211f1+f2+211f3=1811h2f19322h2f2+5411h2f320744h2f4+4211h2f52111h2f6+6118h2f7344h2f8.(14) At i = N−1, we have (15) 211fN+fN1+211fN2=1811h2fN9322h2fN1+5411h2fN220744h2fN3+4211h2fN42111h2fN5+6118h2fN6344fN7.(15) Lastly, at i = N, we have (16) fN+211fN1=1057198h2fN22147990h2fN1+9561220h2fN2513499h2fN3+399299h2fN443522h2fN5+11029198h2fN63145h2fN7.(16) The sixth-order accurate differentiation matrix for approximating the second derivative of an arbitrary function with Dirichlet boundary condition is obtained by combining Equation (Equation8) with Equations (Equation13Equation16).

4.2. Neumaan boundary conditions

4.2.1. First derivative approximation

The one-sided schemes for the first derivative at the boundary points are given as follows: At i = 2, we use (17) f2+13f3=463f115184hf2+701252hf3311189hf4+1921hf571252hf6+29756hf7.(17) At i = 3, we use (18) 13f2+f3+13f4=5441f1373441hf2+2529hf3+921323hf4+31441hf52147hf6+5264hf7.(18) At i = N−2, we use (19) 13fN1+fN2+13fN3=5441fN+373441hfN12529hfN2921323hfN331441hfN4+2147hfN55264hfN6,(19) and at i = N−1, we have (20) fN1+13fN2=463fN+15184hfN1701252hfN2+311189hfN31921hfN4+71252hfN529756hfN6.(20)

4.2.2. Second derivative approximation

The one-sided schemes for the second derivative at the boundary points are given as follows:

At i = 2, we have (21) f2+211f3=8683267hf1+5511732670h2f26394110890h2f3+31288739204h2f4194753267h2f5+31161089h2f67780198010h2f7+634165340h2f8.(21) At i = 3, we have (22) 211f2+f3+211f4=351331hf1+16971331h2f234531331h2f3+55813993h2f44312662h2f5+1471331h2f6245786h2f7+51331h2f8.(22) At i = N−2, we have (23) 211fN1+fN2+211fN3=351331hfN+16971331h2fN134531331h2fN2+55813993h2fN34312662h2fN4+1471331h2fN5245786h2fN6+51331h2fN7.(23) At i = N−1, we have (24) fN1+211fN2=8683267hfN+5511732670h2fN16394110890h2fN2+31288739204h2fN3194753267h2fN4+31161089h2fN57780198010h2fN6+634165340h2fN7.(24)

4.3. Robin boundary conditions

This subsection presents novel formulations of the sixth-order compact finite difference schemes that incorporate Robin boundary conditions. We include the truncation errors as well.

4.3.1. First derivative approximation

We illustrate how the sixth-order compact schemes are formulated for first-derivative approximations at the boundaries. The one-sided schemes for the first derivative at the boundary points are given as follows:

At i = 1, we have (25) f1+13f2=a0(αaf1+βaf1)+a1f1+a2f2+a3f3+a4f4+a5f5+a6f6+T1(1).(25) The constants ai(i=1,6) are obtained similarly as in the previous section, and they are a0=1415βa,a1=197βa+840αah900βah,a2=136h,a3=13h,a4=19h,a5=136h,a6=1300h.The truncation error is T1(1)=h6630f(7)(x).At i = 2, we have (26) 13f1+f2+13f3=b0(αaf1+βaf1)+b1f0+b2f1+b3f2+b4f3+b5f4+b6f5+T1(2),(26) with the constants obtained as b0=16βa,b1=203βa+60αah360βah,b2=512h,b3=1918h,b4=19h,b5=124h,b6=1180h,and T1(2)=h6315f(7)(x).At i = N−1, we have (27) 13fN+fN1+13fN2=c0(αbfN+βbfN)+c1fN+c2fN1+c3fN2+c4fN3+c5fN4+c6fN5,(27) where c0=16βb,c1=203βb+60αbh360βbh,c2=512h,c3=1918h,c4=19h,c5=124h,c6=1180h.and T1(N1)=h6315f(7)(x)Finally, at i = N, we have (28) fN+13fN1=d0(αbfN+βbfN)+d1fN+d2fN1+d3fN2+d4fN3+d5fN4+d6fN5+T1(N).(28) Here, the constants are d0=1415βb,d1=197βb+840αbh900βbh,d2=136h,d3=13h,d4=19h,d5=136h,d6=1300h.and T1(N)=h6630f(7)(x).The sixth-order accurate compact finite difference approximation for approximating the first derivative of an arbitrary function with Robin boundary condition is obtained by combining Equation (Equation6) with Equations (Equation25Equation28), and is given by (29) A1f=B1f+K1+T1,(29) where A1=(1130000001311300000013113000000001311300000013113000000131)N×N,K1=(1415βaγa16βaγa0016βbγb1415βbγb)N×1B1=1h(840αah+197βa900βa136131913613000000000060αah+203βa360βa512191819124118000000000136790791360000000000000000001367907913600000000118012419191851260αbh203βb360βb0000000013001361913136840αbh197βb900βb)N×N,and T1={h6630f(7)(x),if i=1,h6315f(7)(x),if i=2,h61260f(7)(x),if 3iN2,h6315f(7)(x),if i=N1,h6630f(7)(x),if i=N.The first derivative f is therefore approximated by (30) f=D1f+H1,(30) where D1=A11B1 and H1=A11K1.

4.3.2. Second derivative approximation

The one-sided schemes for the second derivative at the boundary points are given as follows:

At i = 1, we have (31) f1+211f2=a0(αaf1+βaf1)+a1f1+a2f2+a3f3+a4f4+a5f5+a6f6+a7f7+T2(1).(31) The constants ai(i=1,6) are obtained similarly as in the previous section, and they are given as a0=21745hβa,a1=70933βa+4740hαa9900βh2,a2=3757330h2,a3=947132h2,a4=1307297h2,a5=24713h2,a6=7931650h2,a7=3315940h2and T2(1)=1997h655440f(8)(x).At i = 2, we have (32) 211f1+f2+211f3=b0(αaf1+βaf1)+b1f1+b2f2+b3f3+b4f4+b5f5+b6f6+b7f7+T2(2),(32) where the constants are b0=2144hβa,b1=351βa+420αah880βah2,b2=3944h2,b3=988h2,b4=1922h2,b5=63176h2,b6=21220h2,b7=188,and T2(2)=899h6110880f(8)(x).At i = N−1, we have (33) 211fN+fN1+211fN2=c0(αbfN+βbfN)+c1fN+c2fN1+c3fN2+c4fN3+c5fN4+c6fN5+c7fN6+T2(N1),(33) and the constants are c0=2144hβb,c1=351βb+420αbh880βbh2,c2=3944h2,c3=988h2,c4=1922h2,c5=63176h2,c6=21220h2,c7=188h2,and T2(N1)=899h6110880f(8)(x).Lastly, at i = N, we have (34) fN+211fN1=d0(αbfN+βbfN)+d1fN+d2fN1+d3fN2+d4fN3+d5fN4(34) (35) +d6fN5+d7fN6+T2(N).(35) The constants are d0=21745hβb,d1=70933βb4740hαbh9900βh2,d2=3757330h2,d3=947132h2,d4=1307297h2,d5=24713h2,d6=7931650h2,d7=3315940h2,and T2(N)=1997h655440f(8)(x).The sixth-order accurate compact finite difference approximation for approximating the second derivative of an arbitrary function with Robin boundary condition is obtained by combining Equation (Equation8) with Equations (Equation31Equation33), and is given by (36) A2f=B2f+K2+T2,(36) where A2=(12110000002111211000000211121100000000211121100000021112110000002111)N×N,K2=1h(217415βaγa2144βaγa002144βbγb217415βbγb)N×1,B2=1h2(47740αah70933βa9900βa3757330947132130729724713279316503315940420αah+351βa880βa3944988192263176212201883441211512212113440000000000000000000000000000000000000000000000344121151221211344188212206317619229883944420αbh+351βb880βb331594079316502471323071247947132375733047740αbh+70933βb9900βb)N×N,T2={1997h655440f(8)(x),if i=1,899h6110880f(8)(x),if i=2,23h655440f(8)(x),if 3iN2,899h6110880f(8)(x),if i=N1,1997h655440f(8)(x),if i=N.The second derivative f is therefore approximated by (37) f=D2f+H2,(37) where D2=A21B2 and H2=A21K2.

Therefore, to solve Equation (Equation4), we use Equations (Equation30) and (Equation37) to approximate the derivatives, and so we have (38) D2Y+H2+a~1(D1Y+H1)+a~0Y=G(x)(D2+a~1D1+a~0)Y=G(x)H2a~1H1,(38) where Y=[y1(x),y2(x),,yN(x)]T,a~1=diag{a1}anda~0=diag{a0}.

5. Convergence

In this section, we discuss the convergence of the proposed method described in the previous sections to solve Equation (Equation4). We only provide proof of convergence for the ordinary differential equation with Robin boundary conditions.

Theorem 5.1

Let Y=[y1(x),y2(x),,yN(x)] and Y¯=[y¯1(x),y¯2(x),,y¯N(x)] be vectors of the numerical solution and exact solution obtained by solving the linear system (Equation4), respectively. Then, provided hA2C21(A21E2+a~1A11C1)h2A2C21(a~1A11E1+a~0)<1, we have (39) EO(h7),(39) where a~1=diag{a1}anda~0=diag{a0}.

Proof.

Applying the sixth-order compact schemes (Equation29) and (Equation36) to Equation (Equation4), we obtain A21B2Y+A21K2+A21T2+a1(A11B1Y+A11K1+A11T1)+a0Y=G(x).The exact solution, Y¯, of Equation (Equation4) is given by (40) (A21B2+a~1(A11B1)+a~0)Y¯=A21k2a1A11k1+G+T,(40) where T=A21T2A11T1, a~1=diag(a1)anda~0=diag(a0). The approximate solution, Y, of Equation (Equation4) is given by (41) (A21B2+a~1A11B1+a~0)Y=A21k2a1A11k1+G,(41) Subtracting Equation (Equation41) from Equation (Equation40), we obtain (42) (A21B2+a~1A11B1+a~0)E=T,(42) where E is given by E=Y¯Y.We can write B1 and B2 as (43) B1=1hC1+Q1,B2=1h2C2+1hQ2,(43) where C1=(197900136131913613000000000020336051219181912411800000000013679079136000000000000000000136790791360000000011801241919185122033600000000013001361913136197900)N×N,Q1=(840αa900βa0060αa360βa0000060αb360βb00840αb900βb)N×N,C2=(709339900375733094713213072972471327931650331594000351880394498819226317621220188003441211512212113440000000000000000000018821220000000033159407931650000000000000000344121151221211344631761922988394435188024713230712479471323757330709339900)N×N,Q2=(47740αa9900βa00420αa880βa0000420αb351βb0047740αb9900βb)N×N.

Substituting Equation (Equation43) into Equation (Equation42), we obtain (44) (A21(1h2C2+1hQ2)+a~1A11(1hC1+Q1)+a~0)E=T(44) Multiplying Equation (Equation44) by h2, we obtain (45) (A21C2+h(A21Q2+a~1A11C1)+h2(a~1A11Q1+a~0))E=h2T.(45) We then multiply Equation (Equation45) by A2C21 to get (46) (I+hA2C21(A21Q2+a~1A11C1)+h2A2C21(a~1A11Q1+a~0))E=h2A2C21T.(46) Solving for E in Equation (Equation46), we obtain (47) E=(I+hA2C21(A21Q2+a~1A11C1)+h2A2C21(a~1A11Q1+a~0))1h2A2C21T.(47) Recall that if is a subordinate matrix norm and B is any matrix such that B<1, then the matrix I + B is invertible and (48) (I+B)111B.(48) Now, if hA2C21(A21Q2+a~1A11C1)h2A2C21(a~1A11Q1+a~0)<1, then I+hA2C21(A21Q2+a~1A11C1)+h2A2C21(a~1A11Q1+a~0) is invertible and it follows that the norm of E is Eh2A2C21T1hA2C21(A21Q2+a~1A11C1)h2A2C21(a~1A11Q1+a~0)O(h8)O(h)O(h7)

6. Numerical results

In this section, we consider numerous examples, including real-life problems. To check the accuracy, we compute the maximum absolute error (L) between the exact and numerical solutions, that is L=max0im|y¯(xi)y(xi)|,where y(xi) and y¯(xi) represent the 6th-order compact finite difference method (CFDM) solution and exact solution at the grid point xi, respectively. In addition, we compute the numerical rate of convergence, which is defined as ROC=log(E1E2)log(h1h2).where E1 and E2 are absolute errors corresponding to grids with a step size h1 and h2, respectively. We compare the results with published results obtained using other methods.

Example 6.1

Consider the Lane–Emden equation with Dirichlet-type boundary conditions y(x)+0.5xy(x)+e2y(x)0.5ey(x)=0,with boundary conditions: y(0)=ln(2)andy(1)=0,Exactsolution:y(x)=ln(2x2+1).

We present the results of Example 6.1 in Table . We display the maximum absolute error computed using different values of grid points N. Table  also compares the error obtained by the present method with that obtained by the Haar wavelet collation method [Citation33] and Adomian decomposition method and Green‘s function [Citation29]. Table  shows that our method produces more accurate results than those in [Citation29,Citation33]. For instance, the error in CFDM solution for N = 64 is about 1012, whereas the error by the Haar wavelet collocation method [Citation33] for N = 1024 is about 1008. Our results are also better compared to the results of [Citation29] obtained by Green‘s function. The agreement between the exact and numerical solutions is depicted in Figure , with the errors from the different values of N again shown in Figure . In Figure , we present the convergence plots of the quasilinearization technique. The method reaches full convergence after only 6 iterations.

Figure 1. Comparison of the exact and approximate solution plots for Example 6.1, showing a good agreement between the two.

Figure 1. Comparison of the exact and approximate solution plots for Example 6.1, showing a good agreement between the two.

Figure 2. Error plots for the approximation of Example 6.1 for varying values of N.

Figure 2. Error plots for the approximation of Example 6.1 for varying values of N.

Figure 3. Convergence plots for the approximation of Example 6.1 for varying values of N, showing convergence after 6 iterations.

Figure 3. Convergence plots for the approximation of Example 6.1 for varying values of N, showing convergence after 6 iterations.

Table 1. Maximum absolute error (L) for Example 6.1.

Example 6.2

Consider the Lane–Emden equation with Dirichlet-type boundary conditions y(x)+0.5xy(x)+x2ey(x)(1416x4ey(x))=0,with boundary conditions: y(0)=ln(14)andy(1)=ln(15),Exactsolution:y(x)=ln(1x4+4).

The maximum absolute errors (L) of Example 6.2 are presented in Table  along with the results obtained in [Citation33]. Table  shows that the proposed method gives accurate results with fewer grid points compared to the results in [Citation33]. Figure  depicts the solution of Example 6.2. The errors are also shown in Figure  for the different values of N. Figure  shows that 5 iterations of the quasilinearization are required to reach full convergence.

Table 2. Maximum absolute error (L) for Example 6.2.

Figure 4. Comparison of the exact and approximate solution plots for Example 6.2, showing a good agreement between the two.

Figure 4. Comparison of the exact and approximate solution plots for Example 6.2, showing a good agreement between the two.

Figure 5. Error plots for the approximation of Example 6.2 for varying values of N.

Figure 5. Error plots for the approximation of Example 6.2 for varying values of N.

Figure 6. Convergence plots for the approximation of Example 6.2 for varying values of N.

Figure 6. Convergence plots for the approximation of Example 6.2 for varying values of N.

Example 6.3

Consider the Lane–Emden equation with Neumaan-type boundary conditions y(x)+2xy(x)+ey(x)(64x2ey(x))=0,with boundary conditions: y(0)=0andy(1)=25,Exactsolution:y(x)=ln(1x2+4).

The results of Example 6.3 are similar to those of the previous examples. Figure  shows the plots of the exact and numerical solution, which are in good agreement. The maximum absolute error and rates of convergence (ROC) are presented in Table , with results from Singh et al. [Citation33] included. As shown in the table, the proposed method gives accurate results with fewer grid points compared to the results in [Citation33]. Plots of the maximum absolute errors for various values of N are shown in Figure . Finally, Figure  shows the convergence plots for the various N values. It can be seen from the plot that the method reaches full convergence after 5 iterations.

Figure 7. Comparison of the exact and approximate solution plots for Example 6.3 showing a good agreement between the two.

Figure 7. Comparison of the exact and approximate solution plots for Example 6.3 showing a good agreement between the two.

Table 3. Maximum absolute error (L) for Example 6.3.

Figure 8. Error plots for the approximation of Example 6.3 for varying values of N.

Figure 8. Error plots for the approximation of Example 6.3 for varying values of N.

Figure 9. Convergence plots for the approximation of Example 6.3 for varying values of N showing convergence after 5 iterations.

Figure 9. Convergence plots for the approximation of Example 6.3 for varying values of N showing convergence after 5 iterations.

Example 6.4

Consider the Lane–Emden equation describing the equilibrium of the isothermal gas sphere y(x)+2xy(x)+y5(x)=0,with boundary conditions: y(0)=0andy(1)=34,Exactsolution:y=33+3x2.

For Example 6.4, we also compute the approximate solution using the proposed CFDM for various values of N. Likewise, the error norm and rates of convergence are presented in Table . Table  presents the comparison of results obtained by CFDM, Taylor wavelet method [Citation60], variation iteration method [Citation17], and finite difference method [Citation21]. It can be seen from the table that CFDM produces better results. A graphical comparison of the CFDM results and the exact solution is shown in Figure . Plots of the absolute errors for various N values is shown in Figure . Lastly, Figure  shows the convergence plots for the various N values. The plot indicates the method reaches full convergences after 5 iterations.

Figure 10. Comparison of the exact and approximate solution plots for Example 6.4, showing a good agreement between the two.

Figure 10. Comparison of the exact and approximate solution plots for Example 6.4, showing a good agreement between the two.

Figure 11. Error plots for the approximation of Example 6.4 for varying values of N.

Figure 11. Error plots for the approximation of Example 6.4 for varying values of N.

Figure 12. Convergence plots for the approximation of Example 6.4 for varying values of N, showing convergence after 5 iterations.

Figure 12. Convergence plots for the approximation of Example 6.4 for varying values of N, showing convergence after 5 iterations.

Table 4. Maximum absolute error (L) and ROC for Example 6.4.

Example 6.5

Consider the Lane–Emden equation with boundary conditions that arise in a thermal explosion in a cylindrical vessel. y(x)+1xy(x)+ey(x)=0,with boundary conditions: y(0)=0andy(1)=0,Exactsolution:y=2ln(422(322)x2+1).

As we did before, in Example 6.5, we also compute the approximate solution using the proposed CFDM for various values of N. Likewise, the error norms and convergence rates are presented in Table . Table  presents the comparison of results obtained by CFDM, quartic trigonometric B-spline collocation method [Citation27] and finite difference method [Citation21]. It can be seen from the table that CFDM produces better results. A graphical comparison of the CFDM results and the exact solution is shown in Figure . Plots of the absolute errors for various N values is shown in Figure . Lastly, Figure  shows the convergence plots for the various N values. The plot indicates the method reaches full convergences after 6 iterations.

Table 5. Maximum absolute error (L) and ROC for Example 6.5.

Figure 13. Comparison of the exact and approximate solution plots for Example 6.5, showing good agreement between the two.

Figure 13. Comparison of the exact and approximate solution plots for Example 6.5, showing good agreement between the two.

Figure 14. Error plots for the approximation of Example 6.5 for varying values of N.

Figure 14. Error plots for the approximation of Example 6.5 for varying values of N.

Figure 15. Convergence plots for the approximation of Example 6.5 for varying values of N, showing convergence after 6 iterations.

Figure 15. Convergence plots for the approximation of Example 6.5 for varying values of N, showing convergence after 6 iterations.

Example 6.6

Consider the Lane–Emden equation with Neumann-Robin type boundary conditions y(x)+2xy(x)+ey(x)=0,subject to y(0)=0and2y(1)+y(1)=0.

The analytic solution of Example 6.6 is unknown. We have solved the above example using the proposed CFDM for different values of N. Table  presents the approximate solutions and compared with the solution acquired by B-spline collocation [Citation27] and Haar wavelet collocation method [Citation33,Citation61]. Table  shows that our results agree with results in [Citation27,Citation33,Citation61]. Figure  shows the approximate solution of Example 6.6.

Figure 16. Approximate solution plots for Example 6.6 for N = 20.

Figure 16. Approximate solution plots for Example 6.6 for N = 20.

Table 6. Maximum absolute error (L) for Example 6.6.

Example 6.7

Consider the Lane–Emden equation with Dirichlet-type boundary conditions y(x)+2xy(x)+ny(x)y(x)+k=00x1subject to y(0)=ln(2)and5y(1)+y(1)=5

Like the previous example, the analytic solution of Example 6.7 is unknown. We have solved the above example using the proposed CFDM for different values of N. Table  presents the approximate solutions with comparisons with solutions acquired by Taylor wavelet method [Citation60] and Haar wavelet collocation method [Citation33]. Table  shows that our results agree with results in [Citation33,Citation60]. Figure  shows the approximate solution of Example 6.7.

Figure 17. Approximate solution plots for Example 6.7 for N = 20.

Figure 17. Approximate solution plots for Example 6.7 for N = 20.

Table 7. Maximum absolute error (L) for Example 6.7.

7. Conclusion

In this paper, we presented a highly accurate compact finite difference method (CFDM) to solve Lane–Emden equations with various types of boundary conditions. Convergence of the CFDM was established by using properties of the standard matrix norm. By computing the absolute error norm and rates of convergence, the high accuracy of CFDM is confirmed by comparing its numerical results against the numerical results of the Haar wavelet collation method [Citation33,Citation61] and Adomian decomposition method and Green‘s function [Citation29], Taylor wavelet method [Citation60], variation iteration method [Citation17], finite difference method [Citation21] and B-spline collocation method [Citation27]. We also observe that the CFDM approximate solution is in excellent agreement with the exact solution in all of the considered examples. Numerical results further confirm that the rate of convergence of the presented CFDM is seven, consistent with the theoretical approximation.

Disclosure statement

The authors declare that they have no conflict of interest.

References

  • Chandrasekhar S. An introduction to study of stellar structure. New York: Dover; 1967.
  • Lima PM, Morgado L. Numerical modeling of oxygen diffusion in cells with Michaelis–Menten uptake kinetics. J Math Chem. 2010;48(1):145–158.
  • Dz̆urina J, Grace SR, Jadlovská I, et al. Oscillation criteria for second-order Emden–Fowler delay differential equations with a sublinear neutral term. Math Nachr. 2020;293:910–922.
  • Li T, Rogovchenko YV. Oscillation of second-order neutral differential equations. Math Nachr. 2015;288(10):1150–1162.
  • Li T, Rogovchenko YV. Oscillation criteria for second-order superlinear Emden–Fowler neutral differential equations. Monatsh Math. 2017;184:489–500.
  • Li T, Rogovchenko YV. On asymptotic behavior of solutions to higher-order sublinear Emden–Fowler delay differential equations. Appl Math Lett. 2017;67:53–59.
  • Frassu S, Li T, Viglialoro G. Improvements and generalizations of results concerning attraction-repulsion chemotaxis models. Math Methods Appl Sci.. 2022;45(17):11067–11078. doi:10.1002/mma.843711078.
  • Frassu S, Viglialoro G. Boundedness criteria for a class of indirect (and direct) chemotaxis-consumption models in high dimensions. Appl Math Lett. 2022;132:108108.
  • Lane JH. ARR.X–On the law of electric conduction in metals. Am J Sci Arts (1820–1879). 1846;1(2):230.
  • Hosseini SG, Abbasbandy S. Solution of Lane–Emden type equations by combination of the spectral method and Adomian decomposition method. Math Probl Eng. 2015;2015:1–10. doi:10.1155/2015/534754.
  • Liao S. A new analytic algorithm of Lane–Emden type equations. Appl Math Comput. 2003;142(1):1–16. doi:10.1016/S0096-3003(02)00943-8.
  • Wazwaz AM. A new algorithm for solving differential equations of Lane–Emden type. Appl Math Comput. 2001;118(2–3):287–310. doi:10.1016/S0096-3003(99)00223-4.
  • Mittal RC, Nigam R. Solution of a class of singular boundary value problems. Numer Algorithms. 2008;47(2):169–179.
  • Ghorbani A, Bakherad M. A variational iteration method for solving nonlinear Lane–Emden problems. New Astron. 2017;54:1–6. doi:10.1016/j.newast.2016.12.004.
  • Wazwaz AM, Rach R. Comparison of the Adomian decomposition method and the variational iteration method for solving the Lane–Emden equations of the first and second kinds. Kybernetes. 2011;40(9/10):1305–1318.
  • Wazwaz AM. Variational iteration method for solving nonlinear singular boundary value problems arising in various physical models. Commun Nonlinear Sci Numer Simul. 2011;16(10):3881–3886. doi:10.1016/j.cnsns.2011.02.026.
  • Kanth AR, Aruna K. He's variational iteration method for treating nonlinear singular boundary value problems. Comput Math Appl. 2010;60(3):821–829. doi:10.1016/j.camwa.2010.05.029.
  • Sharma P, Gupta VG. Solving singular initial value problems of Emden–Fowler and Lane–Emden type. Int J Appl Math Comput. 2009;1(4):206–212.
  • Khan Y, Svoboda Z, Šmarda Z. Solving certain classes of Lane–Emden type equations using the differential transformation method. Adv Differ Equ. 2012;2012(1):1–11.
  • Singh OP, Pandey RK, Singh VK. An analytic algorithm of Lane–Emden type equations arising in astrophysics using modified homotopy analysis method. Comput Phys Commun. 2009;180(7):1116–1124. doi:10.1016/j.cpc.2009.01.012.
  • Chawla MM, Subramanian R, Sathi HL. A fourth order method for a singular two-point boundary value problem. BIT Numer Math. 1988;28(1):88–97.
  • Pandey RK, Singh AK. On the convergence of fourth-order finite difference method for weakly regular singular boundary value problems. Int J Comput Math. 2004;81(2):227–238. doi:10.1080/00207160310001650116.
  • Jamet P. On the convergence of finite-difference approximations to one-dimensional singular boundary-value problems. Numer Math. 1970;14(4):355–378.
  • Kadalbajoo MK, Kumar V. B-spline method for a class of singular two-point boundary value problems using optimal grid. Appl Math Comput. 2007;188(2):1856–1869. doi:10.1016/j.amc.2006.11.050.
  • Çağlar H, Çağlar N, Özer M. B-spline solution of non-linear singular boundary value problems arising in physiology. Chaos Solitons Fract. 2009;39(3):1232–1237. doi:10.1016/j.chaos.2007.06.007.
  • Alam MP, Begum T, Khan A. A new spline algorithm for solving non-isothermal reaction diffusion model equations in a spherical catalyst and spherical biocatalyst. Chem Phys Lett. 2020;754:137651. doi:10.1016/j.cplett.2020.137651.
  • Alam MP, Begum T, Khan A. A high-order numerical algorithm for solving Lane–Emden equations with various types of boundary conditions. Comput Appl Math. 2021;40(6):1–28. doi:10.1007/s40314-021-01591-7.
  • Singh R, Das N, Kumar J. The optimal modified variational iteration method for the Lane–Emden equations with Neumann and Robin boundary conditions. Eur Phys J Plus. 2017;132(6):1–11. doi:10.1140/epjp/i2017-11521-x.
  • Singh R, Kumar J, Nelakanti G. Numerical solution of singular boundary value problems using Green's function and improved decomposition method. J Appl Math Comput. 2013;43:409–425. doi:10.1007/s12190-013-0670-4.
  • Singh R, Kumar J. An efficient numerical technique for the solution of nonlinear singular boundary value problems. Comput Phys Commun. 2014;185(4):1282–1289. doi:10.1016/j.cpc.2014.01.002.
  • Kanth AR, Reddy YN. A numerical method for singular two point boundary value problems via Chebyshev economizition. Appl Math Comput. 2003;146(2–3):691–700. doi:10.1016/S0096-3003(02)00613-6.
  • Danish M, Kumar S, Kumar S. A note on the solution of singular boundary value problems arising in engineering and applied sciences: use of OHAM. Comput Chem Eng. 2012;36:57–67. doi:10.1016/j.compchemeng.2011.08.008.
  • Singh R, Garg H, Guleria V. Haar wavelet collocation method for Lane–Emden equations with Dirichlet, Neumann and Neumann–Robin boundary conditions. J Comput Appl Math. 2019;346:150–161. doi:10.1016/j.cam.2018.07.004.
  • Al-Khaled K. Theory and computation in singular boundary value problems. Chaos Solitons Fract. 2007;33(2):678–684. doi:10.1016/j.chaos.2006.01.047.
  • Kanth AR, Aruna K. Solution of singular two-point boundary value problems using differential transformation method. Phys Lett A. 2008;372(26):4671-4673. doi:10.1016/j.physleta.2008.05.019.
  • Yildirim A, Agirseven D. The homotopy perturbation method for solving singular initial value problems. Int J Nonlinear Sci Numer Simul. 2009;10(2):235–238. doi:10.1515/IJNSNS.2009.10.2.235.
  • Iqbal S, Javed A. Application of optimal homotopy asymptotic method for the analytic solution of singular Lane–Emden type equation. Appl Math Comput. 2011;217(19):7753–7761. doi:10.1016/j.amc.2011.02.083.
  • Isik OR, Sezer M. Bernstein series solution of a class of Lane–Emden type equations. Math Probl Eng. 2013;2013:1–9. doi:10.1155/2013/423797.
  • Lele SK. Compact finite difference schemes with spectral-like resolution. J Comput Phys. 1992;103(1):16–42.
  • Gupta MM, Kouatchou J, Zhang J. Comparison of second-and fourth-order discretizations for multigrid Poisson solvers. J Comput Phys. 1997;132(2):226–232.
  • Sari M, Gürarslan G. A sixth-order compact finite difference scheme to the numerical solutions of Burgers’ equation. Appl Math Comput. 2009;208(2):475–483.
  • Liao W. An implicit fourth-order compact finite difference scheme for one-dimensional Burgers’ equation. Appl Math Comput. 2008;206(2):755–764.
  • Zhao J, Davison M, Corless RM. Compact finite difference method for American option pricing. J Comput Appl Math. 2007;206(1):306–321. doi:10.1016/j.cam.2006.07.006.
  • Shah A, Yuan L, Khan A. Upwind compact finite difference scheme for time-accurate solution of the incompressible Navier–Stokes equations. Appl Math Comput. 2010;214(9):320–3213.
  • Zhao J, Corless RM. Compact finite difference method for integro-differential equations. Appl Math Comput. 2006;177(1):271–288. doi:10.1016/j.amc.2005.11.007.
  • Zhao J. Compact finite difference methods for high order integro-differential equations. Appl Math Comput. 2013;221:66–78. doi:10.1016/j.amc.2013.06.030.
  • Li J, Visbal MR. High-order compact schemes for nonlinear dispersive waves. J Sci Comput. 2006;26(1):1–23.
  • Düring B, Fournié M, Jüngel A. High order compact finite difference schemes for a nonlinear Black–Scholes equation. Int J Theor Appl Finance. 2003;6(07):767–789.
  • Fournie M. High order compact finite difference schemes for a nonlinear Black–Scholes equation. University of Konstanz Center of Finance and Econometrics Discussion Paper (01/07); 2001.
  • Mathale D, Dlamini PG, Khumalo M. Compact finite difference relaxation method for chaotic and hyperchaotic initial value systems. Comput Appl Math. 2018;37(4):5187–5202.
  • Kouagou JN, Dlamini PG, Simelane SM. On the multi-domain compact finite difference relaxation method for high dimensional chaos: the nine-dimensional Lorenz system. Alex Eng J. 2020;59(4):2617–2625. doi:10.1016/J.AEJ.2020.04.025.
  • Dlamini PG, Khumalo M. A new compact finite difference quasilinearization method for nonlinear evolution partial differential equations. Open Math. 2017;15(1):1450–1462.
  • Zhao J. Highly accurate compact mixed methods for two point boundary value problems. Appl Math Comput. 2007;188(2):1402–1418. doi:10.1016/j.amc.2006.11.006.
  • Zhao J, Zhang T, Corless RM. Convergence of the compact finite difference method for second-order elliptic equations. Appl Math Comput. 2006;182(2):1454–1469. doi:10.1016/j.amc.2006.05.033.
  • Pettigrew MF, Rasmussen HA. Compact method for second-order boundary value problems on nonuniform grids. Comput Math Appl. 1996;31(9):1–16. doi:10.1016/0898-1221(96)00037-5.
  • Holsapple R, Venkataraman R, Doman D. New, fast numerical method for solving two-point boundary-value problems. J Guid Control Dyn. 2004;27(2):301–304. doi:10.2514/1.1329.
  • Bellman RE, Kalaba RE. Quasilinearization and nonlinear boundary-value problems. New York: Elsevier; 1965.
  • Mandelzweig VB, Tabakin F. Quasilinearization approach to nonlinear problems in physics with application to nonlinear ODEs. Comput Phys Commun. 2001;141(2):268–281.
  • Keller HB. Numerical solution of two point boundary value problems. Philadelphia; Society for Industrial and Applied Mathematics: 1976. (CBMS regional conference series in applied mathematics; vol. 24).
  • Gümgüm S. Taylor wavelet solution of linear and nonlinear Lane–Emden equations. Appl Numer Math. 2020;158:44–53. doi:10.1016/j.apnum.2020.07.019.
  • Singh R, Shahni J, Garg H, et al. Haar wavelet collocation approach for Lane–Emden equations arising in mathematical physics and astrophysics. Eur Phys J Plus. 2019;134(11):548. doi:10.1140/epjp/i2019-12889-1.