1 Introduction

Chambre [6] discusses that in the theory of thermal explosion critical condition for inflammability is achieved when we have

amount of heat developed by the chemical reaction = amount lost to the surroundings.

The mathematical formulation for the thermal balance between the heat generated by the chemical reaction and that conducted away is described as

$$\begin{aligned} \lambda \nabla ^2 T=-Q W \end{aligned}$$
(1)

where T is temperature of the gas, Q the heat of reaction, \(\lambda \) the thermal conductivity, W the reaction velocity, and \(\nabla ^2\) is Laplacian. Author assumes that the reaction is monomolecular and that its velocity is governed by Arrhenius law, so that

$$\begin{aligned} W =ca \exp {(-E/RT)}, \end{aligned}$$
(2)

where c is the concentration of the reactant, a the frequency factor, and E the energy of activation of the reaction. Hence

$$\begin{aligned} \nabla ^2 T= - (Q/\lambda )ca\exp {(-E/ RT)}. \end{aligned}$$
(3)

After some approximations and circular symmetry Chambre arrived at the following Poisson Boltzmann equation

$$\begin{aligned} \frac{d^2\theta }{d^2z}+\frac{k}{z}\frac{d\theta }{dz}=-\delta \exp {\theta } \end{aligned}$$
(4)

where \(\delta \) is appropriate constant, k is the geometry of the vessel:

  1. (i)

    \(k=0\) for infinite plane-parallel vessel,

  2. (ii)

    \(k=1\) for cylindrical vessel where length is much greater than radius,

  3. (iii)

    \(k=2\) for spherical vessel.

Chambre imposed boundary conditions as

$$\begin{aligned} \theta '(0)=0,~\theta (1)=0. \end{aligned}$$

In this article, motivated by Chambre’s [6] work we propose to use Micken’s type NSFD schemes to solve the following second order non-linear singular boundary value problems of the form:

$$\begin{aligned} \left. \begin{aligned} w''(t)+\left( \frac{c}{t}\right) w'(t)=g(t,w),~ 0<t<1,\\ w'(0)=0,\quad m~w(1)+n~w'(1)=\beta , \end{aligned}\right\} \end{aligned}$$
(5)

where cmn and \( \beta \) are real constants and \(c\ge 1\). We assume that g(tw) is continuous and Lipschitz in \(D = \left\{ (t,w) \in [0,1] \times \mathbb {R}\right\} \). Various real life problems are governed by non-linear second order singular boundary value problems (SBVP) [3, 6, 7, 10, 11, 13, 14]. For both exact [9, 15, 21,22,23] and numerical results [1, 2, 8, 12, 19, 25, 26, 28] a huge literature is available in these papers as well as in their references.

Numerical instabilities are found due to the use of FD methods which have been shown in [16]. Therefore NSFD were proposed to remove these instabilities. One way to characterize these instabilities is to say that they are extra solutions that occur in FD and that do not correspond to any solution of ordinary differential equations (ODE). Also in FD, different step sizes exhibit different behavioral patterns which creates a problem in their selection. It is observed that the central difference scheme allows for the existence of chaotic orbits for all positive time steps for the logistic differential equation [27, 29]. Also for decay equation, Euler central scheme has numerical instabilities for all step sizes and therefore it is unstable.

The idea of solving these type of problems through NSFD schemes originates from the works of Mickens [16] and Ron Buckmire [4, 5]. Very recently in [18] authors have further studied importance of NSFD schemes. They also pointed out that the use of the central difference scheme forces all the fixed-points to become unstable.

SBVPs are solved more accurately and efficiently through NSFD than FD schemes. The NSFD scheme helps in approximating the solution easily near the singularity where the FD schemes generally fail (see [4]).

The paper is organised as follows. In second section, details of the NSFD methods have been given which are used to solve the singular, non-linear ODE problems. We have mentioned three methods here. First is from Mickens [16], second and third are from Buckmire [4, 5].

In third section we have shown the convergence of the three schemes proposed in [4, 5, 16].

In fourth section, we have considered 9 test problems and are discretized by using the NSFD schemes defined in Sect. 2. Then the system of non-linear equations thus obtained are solved by using Newton Raphson method. Numerical solutions and their absolute errors produced by NSFD schemes are compared with the analytical solutions and also with the standard FD schemes for step size \(h=0.0125\). Three kinds of graphs for each problem have been plotted. First kind of graphs show that as we decrease the step size, the approximate solution tends towards the analytical solution. In the second kind of graphs, the error between the analytical solution and the numerical solution obtained by the NSFD scheme and the FD scheme are drawn, which shows that the accuracy of NSFD scheme is better than the standard FD scheme. In the third kind of graphs, the absolute errors between the exact and NSFD solutions are given which illustrate that as we decrease our step size absolute errors decrease.

The article ends with the conclusions.

2 Non-standard finite difference methods (NSFD)

Here we will construct qualitatively stable methods for some nonlinear, singular second order ode problems. We consider ODE of the form defined by Eq. (5) where g(tw) is non-zero real valued functions of t and w.

2.1 Method 1

By applying the Micken’s rules [16, 17] of NSFD schemes,

$$\begin{aligned} \frac{d^2w}{dt^2}\Bigg |_{t=t_i}= \Big (\frac{w_{i+1}-2w_{i}+w_{i-1}}{\varphi }\Big ), \end{aligned}$$
(6)

where \( \varphi (h)\rightarrow h^2+O(h^4)\) as \(h\rightarrow 0\), and

$$\begin{aligned} \frac{dw}{dt}\Bigg |_{t=t_i}\rightarrow \Big (\frac{w_{i+1}-\chi (h) w_{i}}{\varphi }\Big ), \end{aligned}$$
(7)

where \(\chi (h)\) and \(\varphi (h)\) are, respectively called the numerator and denominator functions; they satisfy the requirements \( \chi (h)\rightarrow 1+o(h^2)\), \(\varphi (h)\rightarrow h+o(h^2)\) as \(h \rightarrow 0\).

Here, we have \(h = \delta t,~ t \rightarrow t_{i} = ih,~ w(t)\rightarrow w_{i}\), where i is an integer. It should be noted that, in general, the numerator function can always be selected to be \(\chi (h) = 1\).

The linear and non-linear terms of w(t) should be in general be modelled non-locally on the computational grid in many different ways. For example

$$\begin{aligned}&w\approx 2w-w\rightarrow 2w_{i}-w_{i+1}, \end{aligned}$$
(8)
$$\begin{aligned}&w^3 \approx a(w_{i+1})^2 w_{i}+b w_{i}^3 ,~ a+b=1,~ a,b \in \mathbb {R}. \end{aligned}$$
(9)

2.2 Method 2

We apply Mickens-type NSFD schemes for nonlinear singular boundary value problems in cylindrical coordinates [4, 5]. We write

$$\begin{aligned} w''(t)+\left( \frac{1}{t}\right) w'(t)=\frac{1}{t}(t w'(t))', \end{aligned}$$
(10)

and approximate \(tw'\) from [4] as

$$\begin{aligned} t \frac{dw}{dt}\Bigg |_{t=t_i}\approx \frac{w_{i+1}-w_{i}}{\log (t_{i+1}/t_{i})}. \end{aligned}$$
(11)

So, by using Eq. (11) in (10), we get

$$\begin{aligned} \frac{1}{t}(tw'(t))'\Bigg |_{t=t_i}\approx \frac{1}{t_{i}*h}\left( \frac{w_{i+1}-w_{i}}{\log \Big (\frac{t_{i+1}}{t_{i}}\Big )}-\frac{w_{i}-w_{i-1}}{\log \Big ( \frac{t_{i}}{t_{i-1}}\Big )}\right) . \end{aligned}$$
(12)

2.3 Method 3

We apply Mickens-type NSFD schemes [4] for non-linear singular boundary value problems in spherical coordinates. We write

$$\begin{aligned} w''(t)+\Big (\frac{2}{t}\Big )w'(t)=\frac{1}{t^2}(t^2 w'(t))', \end{aligned}$$
(13)

and from [4] we approximate \(t^2 \frac{dw}{dt}\) as follows:

$$\begin{aligned} t^2 \frac{dw}{dt}\Bigg |_{t=t_i}\approx \big (t_{i}*t_{i+1}\big ) \Bigg ( \frac{w_{i+1}-w_{i}}{t_{i+1}-t_{i}}\Bigg ). \end{aligned}$$
(14)

So, using Eq. (14) in (13) , we get

$$\begin{aligned} \frac{1}{t^2}(t^2 w'(t))'\Bigg |_{t=t_i}\approx \frac{1}{t_{i}^2*h}\Bigg (t_{i}*t_{i+1} \frac{w_{i+1}-w_{i}}{t_{i+1}-t_{i}}-t_{i}*t_{i-1} \frac{w_{i}-w_{i-1}}{t_{i}-t_{i-1}}\Bigg ). \end{aligned}$$
(15)

3 Convergence of difference scheme

Here we establish the convergence of proposed three NSFD schemes for the nonlinear SBVP defined by Eq. (5) subject to boundary condition \(w'(0)=0,~w(1)=\beta \).

3.1 Convergence of NSFD for Method 1

Consider the NSFD scheme of (5) as defined in Sect. 2.1,

$$\begin{aligned} \left( \frac{w_{i+1}-2w_{i}+w_{i-1}}{\varphi }\Big )+\frac{c}{t_{i}}\Big (\frac{w_{i+1}-w_{i}}{\chi }\right) =g_{i},~i=1(1)N-1. \end{aligned}$$
(16)

The boundary conditions become

$$\begin{aligned} w'_{0}=0 ~ \text{ and } ~ w_{N}=\beta . \end{aligned}$$
(17)

Here we take \(\varphi =4 \sin ^{2}\big (\frac{h}{2}\big )\) and \( \chi =\sin {(h)}\). So, our difference scheme takes the following form:

$$\begin{aligned}&-\,w_{i-1}+\left( 2+ \frac{2 c \tan (h/2)}{ih}\right) w_{i}-\left( 1+ \frac{2 c \tan (h/2)}{ih}\right) w_{i+1}\nonumber \\&\quad +\,4 \sin ^{2}\left( \frac{h}{2}\right) g_{i}=0,~i=1(1)N-1. \end{aligned}$$
(18)

The exact solution w(t) of (18) satisfies

$$\begin{aligned}&-w(t_{i-1})+\left( 2+ \frac{2 c \tan (h/2)}{ih}\right) w(t_{i})-\left( 1+ \frac{2 c \tan (h/2)}{ih}\right) w(t_{i+1})\nonumber \\&\quad +\,4 \sin ^{2}\left( \frac{h}{2}\right) g(t_{i},w(t_{i}))+ T _{i}=0,~i=1(1)N-1, \end{aligned}$$
(19)

where \( T_{i}\) is the truncation error given below:

$$\begin{aligned} T_{i}(h)= \frac{c h^2}{2i}w''(\xi _{i}),~ t_{i-1}< \xi _{i} < t_{i+1}. \end{aligned}$$
(20)

Subtracting (19) from (18) and applying Mean Value Theorem, and substituting \(\varepsilon _{i}=w_{i}-w(t_{i})\), we get the error equation

$$\begin{aligned}&-\varepsilon _{i-1}+\left( 2+ \frac{2 c \tan (h/2)}{ih}\right) \varepsilon _{i}-\left( 1+ \frac{2 c \tan (h/2)}{ih}\right) \varepsilon _{i+1}\nonumber \\&\quad +\,4 \sin ^{2}\left( \frac{h}{2}\right) g_{w_{i}}\varepsilon _{i}- T _{i}=0,~i=2(1)N-2. \end{aligned}$$
(21)

For \(i=1\), using boundary condition \(w'_0=0=w_1-w_0\), we get

$$\begin{aligned} \left( 1+ \frac{2 c \tan (h/2)}{h}\right) \varepsilon _{1}-\left( 1+ \frac{2 c \tan (h/2)}{h}\right) \varepsilon _{2}+4 \sin ^{2}\left( \frac{h}{2}\right) g_{w_{1}}\varepsilon _{1}- T _{1}=0. \end{aligned}$$
(22)

For \(i=N-1\) and using the boundary condition \(w_N=\beta \), we get

$$\begin{aligned}&-\varepsilon _{N-2}+\left( 2+ \frac{2 c \tan (h/2)}{(N-1)h}\right) \varepsilon _{N-1}-\left( 1+ \frac{2 c \tan (h/2)}{(N-1)h}\right) \varepsilon _{N}\nonumber \\&\quad +\,4 \sin ^{2}\left( \frac{h}{2}\right) g_{w_{N-1}}\varepsilon _{N-1}- T _{N-1}=0, \end{aligned}$$
(23)

where \(\varepsilon _{N}=w_N-w(t_N)=\beta -\beta =0\).

In the matrix notation, we write (21), (22) and (23) as

$$\begin{aligned} ME=T, \end{aligned}$$
(24)

where \(M=D+Q\), \(E=[\varepsilon _{1},\varepsilon _{2},\ldots ,\varepsilon _{N-1}]^T\), \( T=[T_{1},T_{1},\ldots , T_{N-1}]^T\),

$$\begin{aligned} D= \left( \begin{array}{c@{\quad }c@{\quad }c@{\quad }c} 1+ \frac{2 c \tan (h/2)}{h} &{} -\left( 1+ \frac{2 c \tan (h/2)}{h}\right) &{}&{} 0 \\ -1 &{} 2+ \frac{2 c \tan (h/2)}{2h}&{} -\left( 1+ \frac{2 c \tan (h/2)}{2h}\right) &{} 0\\ &{} \ddots &{} \ddots &{} \ddots \\ 0 &{} &{} -1 &{} 2+ \frac{2 c \tan (h/2)}{(N-1)h} \end{array} \right) , \end{aligned}$$

and

$$\begin{aligned} Q= 4 \sin ^{2}\left( \frac{h}{2}\right) \begin{pmatrix} g_{w_{1}}\\ &{}\ddots \\ &{}&{}{g_{w_{N-1}}}\\ \end{pmatrix}. \end{aligned}$$

We now show that the matrix \(M=D+Q\) is an irreducible, monotone matrix such that \( M\ge D \) and \(Q\ge 0 \).

Since D is tridiagonal matrix where \( a_{i,j}=0\) for \( |i-j|>1\) and \(a_{i,i-1}\ne 0\) for \(i=2(1)N-1\) and \( a_{i,i+1}\ne 0\) for \(i=1(1)N-2\). So, D is irreducible. Also D is diagonally dominant, i.e.,

$$\begin{aligned} |a_{i,i}| \ge \sum _{j=1, i \ne j} ^{j=N-1} |a_{i,j}|, i=1(1)N-1. \end{aligned}$$

So, D is irreducibly diagonally dominant matrix and it has also non-positive off diagonal elements. So, D is monotone. Since \( g_{w_{i}}>0, ~ i=1(1)N-1\), so, we have \( Q \ge 0\)

$$\begin{aligned} M=D+Q\ge D. \end{aligned}$$

Also, D is monotone. Now, Q is diagonal matrix with positive entries. Hence \(M=D+Q\) is also irreducibly diagonal dominant and have non-positive off-diagonal elements. Therefore M is also monotone and \(M \ge D\). So, we have \( 0<M^{-1}\le D^{-1}. \)

From (24), we have

$$\begin{aligned} E= M^{-1}T, \end{aligned}$$

and

$$\begin{aligned} \Vert E\Vert \le \Vert M^{-1}\Vert \Vert T \Vert \le \Vert D^{-1}\Vert \Vert T \Vert . \end{aligned}$$
(25)

Let \(W=(1,1,\ldots , 1)^{T}\) and \(P=(P_{1},P_{2},\ldots , P_{N-1})^T = DW\) denote the vector of row sums of D.

$$\begin{aligned} P&= \begin{bmatrix} 0 \\ 0 \\ \vdots \\ 1+ \frac{2 c \tan (h/2)}{(N-1)h} \end{bmatrix}. \end{aligned}$$
(26)

Also, let \( Z=(Z_{1},Z_{2},\ldots , Z_{N-1})^T\) where \(Z_{j}=2-\frac{(t_{j}+1)^2}{2}\), and \(S=(S_{1},S_{2},\ldots , S_{N-1})^T = DZ\). We next obtain bounds for \(D^{-1}=(d_{ij}^{-1}).\) Now

$$\begin{aligned} S_{1}= & {} \left( 1+ \frac{2 c \tan (h/2)}{h} \right) (Z_{1}-Z_{2}) = \left( 1+ \frac{c \tan (h/2)}{h/2} \right) h \left( 1+\frac{3h}{2}\right) \\> & {} h\left( 1+ \frac{ c \tan (h/2)}{h/2} \right) , \end{aligned}$$

hence

$$\begin{aligned} S_{1}>h\left( 1+ \frac{ c \tan (h/2)}{h/2} \right) , \end{aligned}$$
(27)

Now \(S_{k}=D_{k-1}Z_{k-1}+D_{k}Z_{k}+D_{k+1}Z_{k+1},~k=2(1)N-2\),

$$\begin{aligned} S_k= & {} (-1)Z_{k-1}+ \left( 2+ \frac{2 c \tan (h/2)}{kh} \right) Z_{k}-\left( 1+ \frac{2 c \tan (h/2)}{kh} \right) Z_{k+1},\\= & {} (-1)(Z_{k-1}-Z_{k})+ \left( 1+ \frac{2 c \tan (h/2)}{kh} \right) (Z_{k}-Z_{k+1}),\\= & {} -h (1+x_{k}-h/2)+h \left( 1+ \frac{2 c \tan (h/2)}{kh}\right) (1+x_{k}+h/2), \\= & {} h(1+x_{k})\frac{c \tan (h/2)}{kh/2}+\frac{h^2}{2} \left( 2+\frac{2 c \tan (h/2)}{kh} \right) , \\= & {} h(1+kh)\frac{c \tan (h/2)}{kh/2}+\frac{h^2}{2} \left( 2+\frac{2 c \tan (h/2)}{kh} \right) , \end{aligned}$$

hence

$$\begin{aligned}&S_k> h \left( \frac{c \tan (h/2)}{k h/2}\right) ,~k=2(1)N-2. \end{aligned}$$
(28)

Since \( D^{-1} S =Z \) and \( Z_{i}< \frac{3}{2} \) for \(i= 1(1)N-2\), then \( d^{-1}_{i,1} S_{1} \le Z_{i} <(3/2), ~ i=1(1)N-2\),

$$\begin{aligned}&d^{-1}_{i,1}< \frac{3}{2h \left( 1+ \frac{ c \tan (h/2)}{h/2} \right) }, ~ i=1(1)N-2, \end{aligned}$$
(29)
$$\begin{aligned}&\sum _{k=2}^{N-2} d^{-1}_{i,k} S_{k}\le Z_{i}< \frac{3}{2},\nonumber \\&h \sum _{k=2}^{N-2} d^{-1}_{i,k} \left[ \frac{c \tan (h/2)}{kh/2}\right]< \frac{3}{2},\nonumber \\&\sum _{k=2}^{N-2} d^{-1}_{i,k} < \frac{6 h/2}{2c h \tan {h/2}}, \end{aligned}$$
(30)

where \(\max _k\left[ \frac{c}{k} \frac{\tan (h/2)}{h/2}\right] =\frac{c}{2}\frac{\tan (h/2)}{h/2}\).

Now since \(P_{N-1}=\left( 1+ \frac{2 c \tan (h/2)}{(N-1)h} \right) \) then with the help of \(D^{-1} P = W\), we obtain

$$\begin{aligned} d^{-1}_{i,N-1}=\frac{1}{\left( 1+ \frac{ c \tan (h/2)}{(N-1)(h/2)} \right) }, \end{aligned}$$
(31)

and thus from Eqs. (20), (25), (29)–(31), we get

$$\begin{aligned}&|e_{i}|\le d^{-1}_{i,1}|T_{1}|+ \sum _{k=2}^{N-2} d^{-1}_{i,k}|T_{k}|+d^{-1}_{i,N-1}|T_{N-1}|,\\&\quad \le \left[ \frac{3}{2h \left( 1+ \frac{ c \tan (h/2)}{h/2} \right) }+\frac{6 h/2}{2c h \tan {h/2}}+\frac{1}{\left( 1+ \frac{ c \tan (h/2)}{(N-1)(h/2)} \right) }\right] \sup _{i}\left\{ \frac{c h^2}{2i}w''(\xi _{i})\right\} . \end{aligned}$$

For limiting case when h is sufficiently small then \( \tan \frac{h}{2}= \frac{h}{2}\) and since \(i \ge 1, N-1\ge 1\) so, \( \frac{1}{i}\le 1\) and \(\frac{1}{N-1} \le 1\),

$$\begin{aligned} |e_{i}|\le \lambda h, \end{aligned}$$
(32)

where \( \lambda = \frac{3(3c+2)}{4(c+1)}\displaystyle \sup _{[0,1]}w''(t)\).

Now in view of \(\Vert E \Vert _{\infty } \leqslant \Vert D^{-1} T \Vert _{\infty }\), we have

$$\begin{aligned} \Vert E \Vert _{\infty } =O(h). \end{aligned}$$

Similarly we establish the convergence for NSFD schemes described in Sects. 2.2 and 2.3.

3.2 Convergence of NSFD for Method 2

Consider the NSFD for (5) subject to boundary condition \(w'(0)=0,~w(1)=\beta \) given in Sect. (2.2) with \(c=1\). Here we will we get, the error equation as given below

$$\begin{aligned}&-\left( \frac{1}{\ln \left( \frac{i}{i-1}\right) }\right) \varepsilon _{i-1}+\left( \frac{1}{\ln \left( \frac{i+1}{i}\right) }+\frac{1}{\ln \left( \frac{i}{i-1}\right) }\right) \varepsilon _{i}-\left( \frac{1}{\ln \left( \frac{i+1}{i}\right) }\right) \varepsilon _{i+1}+i h^2 g_{w_{i}}\varepsilon _{i}\nonumber \\&\quad - \,T _{i}=0,~i=2(1)N-2, \end{aligned}$$
(33)

where

$$\begin{aligned} T_{i}= \frac{h^2}{12i}\left[ t^2 w^{iv}(\xi _{i})+2tw'''(\xi _{i})-w''(\xi _{i})+\frac{w'}{t}(\xi _{i})\right] ,~ t_{i-1}< \xi _{i} < t_{i+1}. \end{aligned}$$
(34)

For \(i=1\), using boundary condition \(w'(0)=0\), we get \(w_1-w_0=0\) and hence

$$\begin{aligned} \frac{1}{\ln 2}(\varepsilon _{1}-\varepsilon _{2})+h^2 g_{w_{1}}\varepsilon _{1}- T _{1}=0. \end{aligned}$$
(35)

For \(i=N-1\), using the boundary condition \(w(1)=\beta \) and that \(\varepsilon _N=w_N-w(t_n)=\beta -\beta =0\), we get

$$\begin{aligned} -\frac{1}{\ln \frac{N-1}{N-2}}\varepsilon _{N-2}+\left( \frac{1}{\ln \frac{ N}{N-1}}+\frac{1}{\ln \frac{N-1}{N-2}}\right) \varepsilon _{N-1}+h^2 g_{w_{N-1}}\varepsilon _{N-1}-T_{N-1}=0. \end{aligned}$$
(36)

In the matrix notation, we write (33), (34), (35) and (36) as

$$\begin{aligned} ME=T, \end{aligned}$$
(37)

where \(M=D+Q\), \(E=[\varepsilon _{1},\varepsilon _{2},\ldots ,\varepsilon _{N-1}]^T\), \( T=[T_{1},T_{1},\ldots , T_{N-1}]^T,\)

$$\begin{aligned} D= & {} \left( \begin{array}{c@{\quad }c@{\quad }c@{\quad }c} \frac{1}{\ln 2} &{} -\frac{1}{\ln 2} &{}&{} 0 \\ -\frac{1}{\ln 2} &{} \left( \frac{1}{\ln 2}+\frac{1}{\ln (3/2)}\right) &{} -\frac{1}{\ln (3/2)} &{} 0\\ &{} \ddots &{} \ddots &{} \ddots \\ 0 &{} &{} -\frac{1}{\ln \left( \frac{N-1}{N-2}\right) } &{} \frac{1}{\ln \left( \frac{N}{N-1}\right) }+\frac{1}{\ln \left( \frac{N-1}{N-2}\right) } \end{array} \right) ,\\ Q= & {} i h^2 \begin{pmatrix} g_{w_{1}}\\ &{}\ddots \\ &{}&{}{g_{w_{N-1}}}\\ \end{pmatrix}. \end{aligned}$$

Similarly to convergence analysis of method 2.1 we can show that M is an irreducible and monotone matrix. Also \(\Vert E\Vert \le \Vert M^{-1}\Vert \Vert T \Vert \le \Vert D^{-1}\Vert \Vert T \Vert \). Here we get matrix P as

$$\begin{aligned} P&= \begin{bmatrix} 0 \\ 0 \\ \vdots \\ \frac{1}{\ln \left( N/N-1\right) } \end{bmatrix}. \end{aligned}$$
(38)

Also, let \(Z=(Z_{1},Z_{2},\ldots , Z_{N-1})^T\), where \(Z_{j}=2-\frac{(t_{j}+1)^2}{2}\). And \(S=(S_{1},S_{2},\ldots , S_{N-1})^T = DZ\). In the same way, here we get

$$\begin{aligned}&S_{1}>\frac{h}{\ln 2}, \end{aligned}$$
(39)
$$\begin{aligned}&S_{k}> h \left[ \frac{1}{\ln \left( (k+1)/k\right) }-\frac{1}{\ln \left( k/k-1\right) }\right] , ~k=2(1)N-2. \end{aligned}$$
(40)

We next obtain bounds for \( D^{-1}=(d_{ij}^{-1}) \) in the same way as done above and put them in the equation given below,

$$\begin{aligned} |e_{i}|\le & {} d^{-1}_{i,1}|T_{1}|+ \sum _{k=2}^{N-2} d^{-1}_{i,k}|T_{k}|+d^{-1}_{i,N-1}|T_{N-1}|\\\le & {} \frac{1}{h}\left[ \frac{3}{2} \ln 2 + \frac{3}{2} 2+h \ln \frac{N}{N-1}\right] \sup _{i}T_{i}(h) \le \lambda h, \end{aligned}$$

where \(\max \left[ \frac{1}{\ln \left( (k+1)/k\right) }-\frac{1}{\ln \left( k/k-1\right) }\right] <2\) and \( \lambda =\left[ \frac{\ln 2+2}{8}\right] \displaystyle \sup _{[0,1]}\Big [t^2 w^{(iv)}(t)+2tw'''(t)-w''(t)+\frac{w'}{t}\Big ]\). Now in view of \(\Vert E \Vert _{\infty } \leqslant \Vert D^{-1} T \Vert _{\infty }\), we have

$$\begin{aligned} \Vert E \Vert _{\infty } =O(h). \end{aligned}$$

3.3 Convergence of NSFD for Method 3

Consider the NSFD scheme described in Sect. 2.2 for (5) subject to \(w'(0)=0\) and \(w(1)=\beta \) with \(c=2\). Here we will we get, the error equation

$$\begin{aligned} -\left( \frac{t_{i-1}}{t_{i}}\right) \varepsilon _{i-1}+\left( \frac{t_{i-1}+t_{i+1}}{t_{i}}\right) \varepsilon _{i}-\left( \frac{t_{i+1}}{t_{i}}\right) \varepsilon _{i+1}+h^2 g_{w_{i}}\varepsilon _{i}- T _{i}=0,~i=2(1)N-2, \end{aligned}$$
(41)

where

$$\begin{aligned} T_{i}= \frac{h^2}{12i^2}\left[ t^2w^{iv}(\xi _{i})+4tw'''(\xi _{i})\right] ,~ t_{i-1}< \xi _{i} < t_{i+1}. \end{aligned}$$
(42)

For \(i=1\), using boundary condition \(w'(0)=0\), we get

$$\begin{aligned} 2(\varepsilon _{1}-\varepsilon _{2})+h^2 g_{w_{1}}\varepsilon _{1}- T _{1}= 0. \end{aligned}$$
(43)

For \(i=N-1\), using the boundary condition \(w(1)=\beta \), we get

$$\begin{aligned} -\frac{N-2}{N-1}\varepsilon _{N-2}+2\varepsilon _{N-1}+h^2 g_{w_{N-1}}\varepsilon _{N-1}- T_{N-1}=0. \end{aligned}$$
(44)

In the matrix notation, we write (41), (42), (43) and (44) as

$$\begin{aligned} ME=T, \end{aligned}$$
(45)

where \(M=D+Q\), \(E=[\varepsilon _{1},\varepsilon _{2},\ldots ,\varepsilon _{N-1}]^T\), \( T=[T_{1},T_{1},\ldots , T_{N-1}]^T\),

$$\begin{aligned} D= & {} \left( \begin{array}{c@{\quad }c@{\quad }c@{\quad }c} 2 &{} -2 &{}&{} 0 \\ -\frac{1}{2} &{} 2 &{} -\frac{3}{2} &{} 0\\ &{} \ddots &{} \ddots &{} \ddots \\ 0 &{} &{} -\left( \frac{N-2}{N-1}\right) &{} 2 \end{array} \right) ,\\ Q= & {} h^2 \begin{pmatrix} g_{w_{1}}\\ &{}\ddots \\ &{}&{}{g_{w_{N-1}}}\\ \end{pmatrix}. \end{aligned}$$

Similarly we can show that M is an irreducible and monotone matrix. Also \(\Vert E\Vert \le \Vert M^{-1}\Vert \Vert T \Vert \le \Vert D^{-1}\Vert \Vert T \Vert \). Here we get matrix P as

$$\begin{aligned} P&= \begin{bmatrix} 0 \\ 0 \\ \vdots \\ \frac{N}{N-1} \end{bmatrix}. \end{aligned}$$
(46)

Also, let \( Z=(Z_{1},Z_{2},\ldots , Z_{N-1})^T\)   where \(Z_{j}=2-\frac{(t_{j}+1)^2}{2}\). And \(S=(S_{1},S_{2},\ldots , S_{N-1})^T = DZ\). Here we get

$$\begin{aligned} S_{1}= & {} 3h^2+2h>2h, \end{aligned}$$
(47)
$$\begin{aligned} S_{k}= & {} 3h^2+\frac{2h}{k}>\frac{2h}{k},~k=2(1)N-2. \end{aligned}$$
(48)

We next obtain bounds for \( D^{-1}=(d_{ij}^{-1}) \) and put them in the equation given below,

$$\begin{aligned} |e_{i}|\le d^{-1}_{i,1}|T_{1}|+ \sum _{k=2}^{N-2} d^{-1}_{i,k}|T_{k}|+d^{-1}_{i,N-1}|T_{N-1}|\le \left[ \frac{3}{4h}+\frac{3}{2h}+\frac{N}{N-1}\right] *T_{i} \le \lambda h \end{aligned}$$

where \(\lambda =\frac{3}{16}\displaystyle \sup _{[0,1]}\left[ t^2w^{iv}(t)+4tw'''(t)\right] .\) Now in view of \(\Vert E \Vert _{\infty } \leqslant \Vert D^{-1} T \Vert _{\infty }\), we have

$$\begin{aligned} \Vert E \Vert _{\infty } =O(h). \end{aligned}$$

4 Non-linear singular BVPs: Lane Emden type equations

4.1 Problem 1

Polytropes in hydrostatic equilibrium as simple models of a star: Polytropes can be described by the equation of state in which the pressure P is given as a power-law in density \(\rho \)

$$\begin{aligned} P=\kappa \rho ^\gamma \end{aligned}$$

where \(\kappa \) and \(\gamma \) are constants.

The equation of hydrostatic equilibrium is given by

$$\begin{aligned} \frac{dP}{dr}=-\,\rho (r)\frac{G M(r)}{r^2}. \end{aligned}$$

By solving it for M(r) and comparing it to what we obtain from considering the spherical shell in hydrostatic equilibrium \(dM = 4\pi r^2\rho dr\) we get

$$\begin{aligned} \frac{1}{r^2}\frac{d}{dr}\left( \frac{r^2}{\rho }\frac{dP}{dr}\right) =-\,4\pi G \rho . \end{aligned}$$

Since \(P=\kappa \rho ^\gamma \) we get

$$\begin{aligned} \frac{1}{r^2}\frac{d}{dr}\left( \frac{r^2}{\rho }\kappa \gamma \rho ^{\gamma -1}\frac{d\rho }{dr}\right) =-\,4\pi G \rho . \end{aligned}$$

Substitute \(\rho \equiv \lambda \theta ^n\), \(\gamma \equiv \frac{n+1}{n}\) and then \(\xi \equiv \frac{r}{\alpha }\), \(\alpha \equiv \sqrt{\frac{n+1}{4\pi G}\kappa \lambda ^{(1-n)/n}}\) we obtain the so called Lane Emden for polytropes in hydrostatic equilibrium:

$$\begin{aligned} \frac{1}{\xi ^2}\frac{d}{d\xi }\left( \xi ^2\frac{d\theta }{d\xi }\right) =-\,\theta ^n. \end{aligned}$$

The above SBVP was derived by Chandrasekhar [7].

In (5) we take \(c=2\) and \(g(t,w) = w^\beta \) and \(\beta =5\) (or \(n=5\) in the above equation) and write the following SBVP:

$$\begin{aligned} w''(t)+\frac{2}{t}w'(t)+[w(t)]^5=0, \end{aligned}$$
(49)

with boundary condition

$$\begin{aligned} w'(0)=0 ~ \text{ and }~ w(1)=\frac{\sqrt{3}}{2}. \end{aligned}$$

Analytical solution of the above problem is:

$$\begin{aligned} w(t)=\frac{1}{\sqrt{1+\frac{t^2}{3}}}. \end{aligned}$$
(50)

4.1.1 Mathematical illustrations

Applying NSFD scheme as described above in Sect. 2.1 to the above problem, we get

$$\begin{aligned} \left( \frac{w_{i+1}-2w_{i}+w_{i-1}}{\varphi }\Big )+\frac{2}{t_{i}}\Big (\frac{w_{i+1}-w_{i}}{\chi }\right) +[w_{i-1}]^5= & {} 0\nonumber \\ \Big (\frac{1}{\varphi }+\frac{2}{\chi *t_{i}}\Big )w_{i+1}-\Big (\frac{2}{\varphi }+\frac{2}{\chi *t_{i}}\Big )w_{i}+\Big (\frac{1}{\varphi }\Big )w_{i-1}+[w_{i-1}]^5= & {} 0 \end{aligned}$$
(51)

where \(\varphi =4 \sin ^{2}\big (\frac{h}{2}\big )\) and \( \chi =\sin {(h)}\).

The nonlinear term \(w_{i}^5\) is approximated non-locally by the term  \(w_{i-1}^5 \). Here \(h=t_i-t_{i-1}\) is the step size. Now, we discretize the inner boundary condition \(w'(0)=0\) by using backward Euler method,

$$\begin{aligned} \frac{w_{1}-w_{0}}{h}=0 \Rightarrow w_{0}=w_{1}. \end{aligned}$$

The outer boundary condition can be dicretized as \(w_N=w(t_N)=\frac{\sqrt{3}}{2}\).

4.1.2 Numerical illustrations

Table 1 Analytic and NSFD solutions of Problem 1

t

NSFD (W1)

NSFD (W2)

NSFD (W3)

NSFD (W4)

Analytic

FD

0

0.994312521

0.997301048

0.999051

0.999923

1

1.000163654

0.1

0.994312521

0.996682835

0.998901

0.9983425

0.998337488

0.998525527

0.2

0.991072907

0.992740998

0.993692

0.99339242

0.993399268

0.993582356

0.3

0.984593678

0.985489555

0.985382

0.98532142

0.985329278

0.985504418

0.4

0.974969408

0.975154355

0.974381

0.9743613

0.974354704

0.974519309

0.5

0.962384523

0.961498659

0.960665

0.9607711

0.960768923

0.960920933

0.6

0.947102766

0.945639849

0.9451061

0.94492053

0.944911183

0.945049084

0.7

0.929449782

0.927935575

0.9271935

0.92715193

0.927145541

0.927268353

0.8

0.909792535

0.908464262

0.9079459

0.90785121

0.907841299

0.9079486

0.9

0.888517674

0.888005817

0.887505486

0.88736231

0.887356

0.887448355

figure a

Fig. 1 Comparison of NSFD solutions as \(h\rightarrow 0\) with analytical solution for Problem 1

Table 2 Absolute Errors in solution of Problem 1

t

E1

E2

E3

E4

E in FD

0

0.005687479

0.002698952

0.000949

7.7E\(-\)05

0.000163654

0.1

0.004024968

0.001654654

0.000563512

5.01154E\(-\)06

0.000188039

0.2

0.002326361

0.00065827

0.000292732

6.84781E\(-\)06

0.000183088

0.3

0.0007356

0.000160277

5.27218E\(-\)05

7.85818E\(-\)06

0.000175139

0.4

0.000614704

0.000799652

2.62963E\(-\)05

6.59628E\(-\)06

0.000164605

0.5

0.0016156

0.000729737

0.000103923

2.17713E\(-\)06

0.00015201

0.6

0.002191583

0.000728666

0.000194917

9.34743E\(-\)06

0.000137901

0.7

0.002304242

0.000790034

4.79591E\(-\)05

6.38911E\(-\)06

0.000122812

0.8

0.001951236

0.000622963

0.000104601

9.91092E\(-\)06

0.000107301

0.9

0.001161165

0.000649307

0.000148976

5.80049E\(-\)06

9.18457E\(-\)05

figure b

Fig. 2 Numerical errors in NSFD and FD for \(h=0.0125\) for Problem 1

figure c

Fig. 3 Error in NSFD solutions as \(h\rightarrow 0\) for Problem 1

4.2 Problem 2

Thermal explosion in cylindrical vessel: In the thermal explosion, the following two point nonlinear SBVP \((c = 1)\) and \(g(t,w) = e^{w(t)})\) arises, which has been derived by Chamber [6],

$$\begin{aligned} w''(t)+\frac{1}{t}w'(t)+ e^{w(t)}=0, ~ 0<t<1, \end{aligned}$$
(52)

with boundary condition

$$ \begin{aligned} w'(0)=0 ~ \& ~ w(1)=0. \end{aligned}$$

Analytical solution of the above problem is:

$$\begin{aligned} w(t)=2 \ln \Big ( \frac{B+1}{Bx^2+1}\Big ), \end{aligned}$$

where \( B=3-2\sqrt{2}.\)

4.2.1 Mathematical illustrations

Above problem can be written as

$$\begin{aligned} \frac{1}{t}*(t*w'(t))'+\exp w(t)=0. \end{aligned}$$
(53)

After discretizing it, we get

$$\begin{aligned} \frac{1}{t_{i}}*(t_{i}*w'(t_{i}))'+\exp w(t_{i})=0. \end{aligned}$$
(54)

Applying NSFD scheme 2.2 to the above problem, we get

$$\begin{aligned} \frac{1}{t_{i}*h}\left( \frac{w_{i+1}-w_{i}}{\ln \Big (\frac{t_{i+1}}{t_{i}}\Big )}-\frac{w_{i}-w_{i-1}}{\ln \Big ( \frac{t_{i}}{t_{i-1}}\Big )}\right) +\exp w_{i}=0, \end{aligned}$$
(55)

that is

$$\begin{aligned}&\left( \frac{1}{t_{i}h\times \ln \big (\frac{t_{i+1}}{t_{i}}\Big )}\right) w_{i+1}-\left( \frac{1}{t_{i}h\times \ln \big (\frac{t_{i+1}}{t_{i}}\Big )}+\frac{1}{t_{i}h\times \ln \big (\frac{t_{i}}{t_{i-1}}\Big )}\right) w_{i}\nonumber \\&\quad +\,\left( \frac{1}{t_{i}h\times \ln \big (\frac{t_{i}}{t_{i-1}}\Big )}\right) w_{i-1}+\exp w_{i}=0. \end{aligned}$$
(56)

Here \(h=t_i-t_{i-1}\) is the step size.

Now using the non-standard finite difference method, we discretize the inner boundary condition since \(w'(0)=0\), so \(tw'\) must be zero at its first grid point, i.e.,

$$\begin{aligned} \Bigg (\frac{1}{t_{0}h\times \ln \big (\frac{t_{1}}{t_{0}}\Big )}\Bigg )( w_{1}-w_{0})+\exp w_{0}=0. \end{aligned}$$
(57)

The outer boundary condition can be dicretized as \(w_N=w(t_N)=0\).

4.2.2 Numerical illustrations

Table 3 Analytic and NSFD solutions of Problem 2

t

NSFD (W1)

NSFD (W2)

NSFD (W3)

NSFD (W4)

Analytic

FD

0

0.310600377

0.315837

0.316213

0.316562

0.316694368

0.316264073

0.1

0.310600377

0.312594201

0.313097553

0.313223749

0.313266063

0.313054366

0.2

0.301144158

0.302545108

0.30289766

0.302985969

0.303015636

0.302861647

0.3

0.284653686

0.285697177

0.285959617

0.286025344

0.286047478

0.285928733

0.4

0.261481022

0.26226734

0.262465086

0.26251461

0.26253134

0.262438741

0.5

0.231913687

0.232500053

0.232647529

0.232684465

0.232696997

0.232625621

0.6

0.196259942

0.196684376

0.196791145

0.196817886

0.196827019

0.196773669

0.7

0.154860498

0.1551507

0.155223717

0.155242006

0.15524832

0.155210861

0.8

0.108085861

0.108263218

0.108307853

0.108319034

0.108322977

0.108299491

0.9

0.056329533

0.056411183

0.056431736

0.056436885

0.056438816

0.056427608

figure d

Fig. 4 Comparison of NSFD solutions as \(h\rightarrow 0\) with analytical solution for Problem 2

Table 4 Absolute Errors in solution of Problem 2

t

E1

E2

E3

E4

E in FD

0

0.006093991

0.000857368

0.000481368

0.000132368

0.000430295

0.1

0.002665687

0.000671862

0.000168511

4.23142E\(-\)05

0.000211697

0.2

0.001871478

0.000470528

0.000117976

2.9667E\(-\)05

0.000153989

0.3

0.001393793

0.000350302

8.78617E\(-\)05

2.21345E\(-\)05

0.000118746

0.4

0.001050319

0.000264

6.62547E\(-\)05

1.67304E\(-\)05

9.25997E\(-\)05

0.5

0.00078331

0.000196944

4.9468E\(-\)05

1.25321E\(-\)05

7.1376E\(-\)05

0.6

0.000567077

0.000142642

3.58743E\(-\)05

9.13241E\(-\)06

5.33494E\(-\)05

0.7

0.000387822

9.76201E\(-\)05

2.4603E\(-\)05

6.31347E\(-\)06

3.74591E\(-\)05

0.8

0.000237115

5.97584E\(-\)05

1.51237E\(-\)05

3.94263E\(-\)06

2.34854E\(-\)05

0.9

0.000109283

2.76332E\(-\)05

7.07977E\(-\)06

1.93078E\(-\)06

1.12079E\(-\)05

figure e

Fig. 5 Numerical errors in NSFD and FD for \(h=0.0125\) for Problem 2

figure f

Fig. 6 Error in NSFD solutions as \(h\rightarrow 0\) for Problem 2

4.3 Problem 3

We consider the nonlinear differential equation by taking \(b_{0}={0.5}\) in example 1 of [20]

$$\begin{aligned} \left( \sqrt{t} w'(t)\right) '= \frac{5*t^{3.5}\left( 5*t^5\exp w(t)-4.5\right) }{4+t^5}, ~0<t<1, \end{aligned}$$
(58)

with boundary condition

$$ \begin{aligned} w'(0)=0 \; \& \; w(1)=\ln (1/5). \end{aligned}$$

Analytical solution of the above problem is:

$$\begin{aligned} w(t)= \ln \Bigg ( \frac{1}{4+t^5}\Bigg ). \end{aligned}$$

4.3.1 Mathematical illustrations

Above problem can be written as

$$\begin{aligned} \sqrt{t} w''(t)+ \frac{1}{2 \sqrt{t}}*w'(t)= \frac{5*t^{3.5}\left( 5*t^5\exp w(t)-4.5\right) }{4+t^5}. \end{aligned}$$

Dividing by \( \sqrt{t} \) on both sides, we get

$$\begin{aligned} \frac{1}{t} \big (tw'(t)\big )' - \frac{1}{2t^2}\big (t*w'(t)\big )= \frac{5*t^{3}\left( 5*t^5\exp w(t)-4.5\right) }{4+t^5}. \end{aligned}$$

After discretizing it, we get

$$\begin{aligned} \frac{1}{t_{i}} \big (t_{i}w'(t_{i})\big )' - \frac{1}{2t_{i}^2}\big (t_{i}*w'(t_{i})\big )= \frac{5*t_{i}^{3}\left( 5*t_{i}^5\exp w(t_{i})-4.5\right) }{4+t_{i}^5}. \end{aligned}$$

Applying Nonstandard finite difference scheme to the above problem, we get

$$\begin{aligned}&\frac{1}{t_{i}*h}\Bigg (\frac{w_{i+1}-w_{i}}{\ln \Big (\frac{t_{i+1}}{t_{i}}\Big )}-\frac{w_{i}-w_{i-1}}{\ln \Big ( \frac{t_{i}}{t_{i-1}}\Big )}\Bigg )-\frac{1}{2*t_{i}^2}\Bigg (\frac{w_{i+1}-w_{i}}{\ln \Big (\frac{t_{i+1}}{t_{i}}\Big )}\Bigg )\nonumber \\&\quad = \frac{5*t_{i}^{3}\left( 5*t_{i}^5\exp w(t_{i})-4.5\right) }{4+t_{i}^5}, \end{aligned}$$
(59)

By modelling non-linear terms nonlocally on the computational grid, we get

$$\begin{aligned}&\Bigg (\frac{1}{t_{i}h\times \ln \big (\frac{t_{i+1}}{t_{i}}\Big )}-\frac{1}{2*t_{i}^2 \times \ln \big (\frac{t_{i+1}}{t_{i}}\Big )}\Bigg ) w_{i+1}\nonumber \\&\quad -\,\Bigg (\frac{1}{t_{i}h\times \ln \big (\frac{t_{i+1}}{t_{i}}\Big )}+\frac{1}{t_{i}h\times \ln \big (\frac{t_{i}}{t_{i-1}}\Big )}-\frac{1}{2*t_{i}^2 \times \ln \big (\frac{t_{i+1}}{t_{i}}\Big )}\Bigg ) w_{i}\nonumber \\&\quad +\,\Bigg (\frac{1}{t_{i}h\times \ln \big (\frac{t_{i}}{t_{i-1}}\Big )}\Bigg ) w_{i-1}= \frac{25 t_{i}^3 t_{i+1}^5}{4+t_{i}^2 t_{i+1}^3}\exp w_{i}-\frac{22.5 t_{i}^3}{4+t_{i}^5}. \end{aligned}$$
(60)

Here \(h=t_i-t_{i-1}\) is the step size.

Now using the NSFD method, we discretize the inner boundary condition since \(w'(0)=0\), so \(tw'\) must be zero at its first grid point i.e.,

$$\begin{aligned} \Bigg (\frac{1}{t_{0}h\times \ln \big (\frac{t_{1}}{t_{0}}\Big )}\Bigg )( w_{1}-w_{0})-\Bigg (\frac{1}{2 t_{0}^2\times \ln \big (\frac{t_{1}}{t_{0}}\Big )}\Bigg )( w_{1}-w_{0})=0. \end{aligned}$$
(61)

The outer boundary condition can be dicretized as \( w(1)= w_N = \ln (1/5)\).

4.3.2 Numerical illustrations

Table 5 Analytic and NSFD solutions of Problem 3

t

NSFD (W1)

NSFD (W2)

NSFD (W3)

NSFD (W4)

Analytic

FD

0

\(-\) 1.387531417

\(-\) 1.386085024

\(-\) 1.386109839

\(-\) 1.386297508

\(-\) 1.386296861

\(-\) 1.386299777

0.1

\(-\) 1.387531417

\(-\) 1.386085024

\(-\) 1.386116345

\(-\) 1.386295508

\(-\) 1.386296861

\(-\) 1.3863022

0.2

\(-\) 1.387609369

\(-\) 1.386165898

\(-\) 1.386219228

\(-\) 1.386375308

\(-\) 1.386374358

\(-\) 1.38637915

0.3

\(-\) 1.388156389

\(-\) 1.386714916

\(-\) 1.386591871

\(-\) 1.386903172

\(-\) 1.386901677

\(-\) 1.386904987

0.4

\(-\) 1.390189617

\(-\) 1.388731807

\(-\) 1.38898212

\(-\) 1.388854361

\(-\) 1.38885109

\(-\) 1.388859532

0.5

\(-\) 1.395623342

\(-\) 1.394105507

\(-\) 1.393893568

\(-\) 1.394074361

\(-\) 1.394076502

\(-\) 1.394072317

0.6

\(-\) 1.407472669

\(-\) 1.405833473

\(-\) 1.405561245

\(-\) 1.405548351

\(-\) 1.405547818

\(-\) 1.40554287

0.7

\(-\) 1.42988375

\(-\) 1.428088553

\(-\) 1.427617241

\(-\) 1.427452891

\(-\) 1.427453099

\(-\) 1.427450767

0.8

\(-\) 1.467836303

\(-\) 1.465988428

\(-\) 1.465392298

\(-\) 1.465032998

\(-\) 1.465031602

\(-\) 1.465030002

0.9

\(-\) 1.526380196

\(-\) 1.524923482

\(-\) 1.524386807

\(-\) 1.523985998

\(-\) 1.523986772

\(-\) 1.523985495

figure g

Fig. 7 Comparison of NSFD solutions as \(h\rightarrow 0\) with analytical solution for Problem 3

Table 6 Absolute Errors in solution of Problem 3

t

E1

E2

E3

E4

E in FD

0

0.001234556

0.000211837

0.000187022

6.46422E\(-\)07

2.91592E\(-\)06

0.1

0.001234556

0.000211837

0.000180516

1.35358E\(-\)06

5.33841E\(-\)06

0.2

0.001235011

0.00020846

0.00015513

9.49846E\(-\)07

4.79216E\(-\)06

0.3

0.001254712

0.000186761

0.000309806

1.49532E\(-\)06

3.31003E\(-\)06

0.4

0.001338527

0.000119282

0.00013103

3.2711E\(-\)06

8.44202E\(-\)06

0.5

0.001546841

2.90059E\(-\)05

0.000182933

2.14013E\(-\)06

4.1844E\(-\)06

0.6

0.001924851

0.000285655

1.34271E\(-\)05

5.32648E\(-\)07

4.94811E\(-\)06

0.7

0.002430651

0.000635454

0.000164142

2.07632E\(-\)07

2.33182E\(-\)06

0.8

0.002804702

0.000956826

0.000360696

1.39636E\(-\)06

1.59996E\(-\)06

0.9

0.002393424

0.00093671

0.000400035

7.74396E\(-\)07

1.27675E\(-\)06

figure h

Fig. 8 Numerical errors in NSFD and FD for \(h=0.0125\) for Problem 3

figure i

Fig. 9 Error in NSFD solutions as \(h\rightarrow 0\) for Problem 3

4.4 Problem 4

We consider the following differential equation by taking \(b_{0}={0.75}\) in example 1 of [20]

$$\begin{aligned} (t^{0.75}* w'(t))'= \frac{5*t^{3.75}(5*t^5\exp w(t)-4.75)}{4+t^5}, ~0<t<1, \end{aligned}$$
(62)

with boundary condition

$$ \begin{aligned} w'(0)=0 \; \& \; w(1)=\ln (1/5). \end{aligned}$$

Analytical solution of the above problem is:

$$\begin{aligned} w(t)= \ln \Bigg ( \frac{1}{4+t^5}\Bigg ). \end{aligned}$$

4.4.1 Mathematical illustrations

Above problem can be written as

$$\begin{aligned} (t^{0.75} * w''(t))+\Bigg ( \frac{3}{4*{t^{0.25}}}\Bigg )*w'(t)= \frac{5*t^{3.75}(5*t^5\exp w(t)-4.75)}{4+t^5}. \end{aligned}$$

Dividing by \( {t^{0.75}} \) on both sides, we get

$$\begin{aligned} \frac{1}{t} \big (t w'(t)\big )' - \frac{1}{4t^2}\big (t*w'(t)\big )= \frac{5*t^{3}(5*t^5\exp w(t)-4.75)}{4+t^5}. \end{aligned}$$

After discretizing it, we get

$$\begin{aligned} \frac{1}{t_{i}} \big (t_{i}w'(t_{i})\big )' - \frac{1}{4t_{i}^2}\big (t_{i}*w'(t_{i})\big )= \frac{5*t_{i}^{3}(5*t_{i}^5\exp w(t_{i})-4.75)}{4+t_{i}^5}. \end{aligned}$$

Applying NSFD scheme to the above problem, we get

$$\begin{aligned}&\frac{1}{t_{i}*h}\left( \frac{w_{i+1}-w_{i}}{\ln \Big (\frac{t_{i+1}}{t_{i}}\Big )}-\frac{w_{i}-w_{i-1}}{\ln \Big ( \frac{t_{i}}{t_{i-1}}\Big )}\right) -\frac{1}{4*t_{i}^2}\left( \frac{w_{i+1}-w_{i}}{\ln \Big (\frac{t_{i+1}}{t_{i}}\Big )}\right) \\&\quad = \frac{5*t_{i}^{3}(5*t_{i}^5\exp w_{i}-4.75)}{4+t_{i}^5}, \end{aligned}$$

By modelling non-linear terms nonlocally on the computational grid, we get

$$\begin{aligned}&\Bigg (\frac{1}{t_{i}h\times \ln \big (\frac{t_{i+1}}{t_{i}}\big )}-\frac{1}{4*t_{i}^2 \times \ln \big (\frac{t_{i+1}}{t_{i}}\big )}\Bigg ) w_{i+1}\nonumber \\&\quad -\,\Bigg (\frac{1}{t_{i}h\times \ln \big (\frac{t_{i+1}}{t_{i}}\big )}+\frac{1}{t_{i}h\times \ln \big (\frac{t_{i}}{t_{i-1}}\big )}-\frac{1}{4*t_{i}^2 \times \ln \big (\frac{t_{i+1}}{t_{i}}\big )}\Bigg ) w_{i}\nonumber \\&\quad +\,\Bigg (\frac{1}{t_{i}h\times \ln \big (\frac{t_{i}}{t_{i-1}}\big )}\Bigg ) w_{i-1}= \frac{25 t_{i}^8}{4+ t_{i-1}^5}\exp w_{i}-\frac{23.75 t_{i}^3}{4+t_{i}^2 t_{i+1}^3}. \end{aligned}$$
(63)

Here \(h=t_{i}-t_{i-1}\) is the step size. Now using the non-standard finite difference method, we discretize the inner boundary condition since \(w'(0)=0\), so \(tw'\) must be zero at its first grid point, i.e.,

$$\begin{aligned} \Bigg (\frac{1}{t_{0}h\times \ln \big (\frac{t_{1}}{t_{0}}\Big )}\Bigg )( w_{1}-w_{0})-\Bigg (\frac{1}{4*t_{0}^2\times \ln \big (\frac{t_{1}}{t_{0}}\Big )}\Bigg )( w_{1}-w_{0})=0. \end{aligned}$$
(64)

The outer boundary condition can be dicretized as \( w(1)= w_N =\ln (1/5)\).

4.4.2 Numerical illustrations

Table 7 Analytic and NSFD solutions of Problem 4

t

NSFD (W1)

NSFD (W2)

NSFD (W3)

NSFD (W4)

Analytic

FD

0

\(-\) 1.387871361

\(-\) 1.386471195

\(-\) 1.386223505

\(-\) 1.386270664

\(-\) 1.386294361

\(-\) 1.386347681

0.1

\(-\) 1.387871361

\(-\) 1.38647291

\(-\) 1.386225859

\(-\) 1.38627806

\(-\) 1.386296861

\(-\) 1.386350099

0.2

\(-\) 1.387926235

\(-\) 1.386546512

\(-\) 1.386303354

\(-\) 1.386362606

\(-\) 1.386374358

\(-\) 1.386427017

0.3

\(-\) 1.388402406

\(-\) 1.387069527

\(-\) 1.386833822

\(-\) 1.38687643

\(-\) 1.386901677

\(-\) 1.386952763

0.4

\(-\) 1.390277732

\(-\) 1.38902302

\(-\) 1.38879553

\(-\) 1.388863997

\(-\) 1.38885109

\(-\) 1.388899134

0.5

\(-\) 1.395423103

\(-\) 1.394274737

\(-\) 1.394050644

\(-\) 1.394039798

\(-\) 1.394076502

\(-\) 1.394119615

0.6

\(-\) 1.40683325

\(-\) 1.405809966

\(-\) 1.405577086

\(-\) 1.405535558

\(-\) 1.405547818

\(-\) 1.405583899

0.7

\(-\) 1.428712182

\(-\) 1.427819856

\(-\) 1.427563932

\(-\) 1.427455567

\(-\) 1.427453099

\(-\) 1.427480254

0.8

\(-\) 1.466259759

\(-\) 1.465508457

\(-\) 1.465229328

\(-\) 1.465029171

\(-\) 1.465031602

\(-\) 1.465048605

0.9

\(-\) 1.52497968

\(-\) 1.524448449

\(-\) 1.524204375

\(-\) 1.523981537

\(-\) 1.523986772

\(-\) 1.523994056

figure j

Fig. 10 Comparison of NSFD solutions as \(h\rightarrow 0\) with analytical solution for Problem 4

Table 8 Absolute Errors in solution of Problem 4

t

E1

E2

E3

E4

E in FD

0

0.001577

0.000176834

7.0856E\(-\)05

2.36971E\(-\)05

5.33203E\(-\)05

0.1

0.0015745

0.000176048

7.10024E\(-\)05

1.88012E\(-\)05

5.3238E\(-\)05

0.2

0.001551877

0.000172154

7.10044E\(-\)05

1.17524E\(-\)05

5.26587E\(-\)05

0.3

0.00150073

0.000167851

6.78545E\(-\)05

2.52463E\(-\)05

5.10868E\(-\)05

0.4

0.001426642

0.00017193

5.55599E\(-\)05

1.29074E\(-\)05

4.80438E\(-\)05

0.5

0.001346601

0.000198235

2.58579E\(-\)05

3.67037E\(-\)05

4.31139E\(-\)05

0.6

0.001285432

0.000262148

2.92676E\(-\)05

1.22596E\(-\)05

3.60806E\(-\)05

0.7

0.001259083

0.000366758

0.000110833

2.46779E\(-\)06

2.71548E\(-\)05

0.8

0.001228157

0.000476855

0.000197726

2.43089E\(-\)06

1.70028E\(-\)05

0.9

0.000992908

0.000461677

0.000217603

5.23519E\(-\)06

7.2841E\(-\)06

figure k

Fig. 11 Numerical errors in NSFD and FD for \(h=0.0125\) for Problem 4

figure l

Fig. 12 Error in NSFD solutions as \(h\rightarrow 0\) for Problem 4

4.5 Problem 5

Polytropes in hydrostatic equilibrium as simple models of a star: The following two point nonlinear SBVP \( (c = 2\) and \(g(t,w) = w^\beta )\), where  \(\beta \)  is a physical constant has been derived by Chandrasekhar [7]. Here we are taking the case when \(\beta = 1\).

$$\begin{aligned} w''(t)+\frac{2}{t}w'(t)+w(t)=0, ~0<t<1, \end{aligned}$$
(65)

with boundary condition

$$\begin{aligned} w'(0)=0\quad w(1)= \sin {1}. \end{aligned}$$

Analytical solution of the above problem is:

$$\begin{aligned} w(t)= \left( \frac{\sin {t}}{t}\right) . \end{aligned}$$
(66)

4.5.1 Mathematical illustrations

Applying NSFD scheme as described above in (2.3) to the above problem, we get

$$\begin{aligned} \frac{1}{t_{i}^2*h}\Bigg (t_{i}*t_{i+1} \frac{w_{i+1}-w_{i}}{t_{i+1}-t_{i}}-t_{i}*t_{i-1} \frac{w_{i}-w_{i-1}}{t_{i}-t_{i-1}}\Bigg )+w_{i}= & {} 0,\nonumber \\ \Big (\frac{t_{i}*t_{i+1}}{t_{i}^2*h^2}\Big )w_{i+1}- \Big (\frac{t_{i}*t_{i+1}}{t_{i}^2*h^2}+\frac{t_{i}*t_{i-1}}{t_{i}^2*h^2}\Big )w_{i}+\Big (\frac{t_{i}*t_{i-1}}{t_{i}^2*h^2}\Big )w_{i-1}+w_{i}= & {} 0. \end{aligned}$$
(67)

where \(h=t_{i}-t_{i-1}\) is the step size.

4.5.2 Numerical illustrations

Table 9 Analytic and NSFD solutions of Problem 5

t

NSFD (W1)

NSFD (W2)

NSFD (W3)

NSFD (W4)

Analytic

FD

0

0.998488547

0.999620798

0.999905215

0.999976866

1

1.000022634

0.1

0.998488547

0.998371272

0.998343447

0.998337049

0.998334166

0.998424728

0.2

0.993496105

0.993382532

0.993355631

0.993349458

0.993346654

0.993391908

0.3

0.98520865

0.985101206

0.985075828

0.985070032

0.985067356

0.985104589

0.4

0.973678043

0.973576917

0.973553637

0.97354835

0.973545856

0.973606775

0.5

0.958970255

0.958878585

0.958858067

0.958853347

0.958851077

0.95889549

0.6

0.941173644

0.941094038

0.941076834

0.941072777

0.941070789

0.941067611

0.7

0.92039222

0.920329286

0.920316063

0.920312601

0.920310982

0.920228369

0.8

0.896750362

0.896707841

0.896698854

0.896696322

0.896695114

0.89660596

0.9

0.870391135

0.870369842

0.870365247

0.870364026

0.870363233

0.8703153

figure m

Fig. 13 Comparison of NSFD solutions as \(h\rightarrow 0\) with analytical solution for Problem 5

Table 10 Absolute Errors in solution of Problem 5

t

E1

E2

E3

E4

E in FD

0

0.001511453

0.000379202

9.47851E\(-\)05

2.31338E\(-\)05

2.26343E\(-\)05

0.1

0.000154381

3.71054E\(-\)05

9.28045E\(-\)06

2.88218E\(-\)06

9.05617E\(-\)05

0.2

0.000149451

3.58783E\(-\)05

8.9771E\(-\)06

2.80437E\(-\)06

4.52539E\(-\)05

0.3

0.000141294

3.38504E\(-\)05

8.47228E\(-\)06

2.67639E\(-\)06

3.72335E\(-\)05

0.4

0.000132187

3.10616E\(-\)05

7.7817E\(-\)06

2.49382E\(-\)06

6.09195E\(-\)05

0.5

0.000119178

2.75077E\(-\)05

6.99014E\(-\)06

2.26967E\(-\)06

4.44131E\(-\)05

0.6

0.000102855

2.32495E\(-\)05

6.04526E\(-\)06

1.9877E\(-\)06

3.17842E\(-\)06

0.7

8.12387E\(-\)05

1.83045E\(-\)05

5.08137E\(-\)06

1.61939E\(-\)06

8.26132E\(-\)05

0.8

5.52479E\(-\)05

1.27275E\(-\)05

3.74032E\(-\)06

1.20881E\(-\)06

8.91539E\(-\)05

0.9

2.79018E\(-\)05

6.6092E\(-\)06

2.01397E\(-\)06

7.93069E\(-\)07

4.79333E\(-\)05

figure n

Fig. 14 Numerical errors in NSFD and FD for \(h=0.0125\) for Problem 5

figure o

Fig. 15 Error in NSFD solutions as \(h\rightarrow 0\) for Problem 5

4.6 Problem 6

Polytropes in hydrostatic equilibrium as simple models of a star: The following two point nonlinear SBVP \( (c = 2\) and \(g(t,w) = w^\beta )\), where  \(\beta \)  is a physical constant has been derived by Chandrasekhar [7]. Here we are taking the case when \(\beta = 0\).

$$\begin{aligned} w''(t)+\frac{2}{t}w'(t)+1=0, ~0<t<1, \end{aligned}$$
(68)

with boundary condition

$$\begin{aligned} w'(0)=0~ \text{ and }~ w(1)= \frac{1}{6}. \end{aligned}$$

Analytical solution of the above problem is:

$$\begin{aligned} w(t)= \left( \frac{1}{3}-\frac{t^2}{6}\right) . \end{aligned}$$
(69)

4.6.1 Mathematical illustrations

Applying NSFD scheme as described above in (2.3) to the above problem, we get

$$\begin{aligned} \frac{1}{t_{i}^2*h}\Bigg (t_{i}*t_{i+1} \frac{w_{i+1}-w_{i}}{t_{i+1}-t_{i}}-t_{i}*t_{i-1} \frac{w_{i}-w_{i-1}}{t_{i}-t_{i-1}}\Bigg )+1= & {} 0,\nonumber \\ \Big (\frac{t_{i}*t_{i+1}}{t_{i}^2*h^2}\Big )w_{i+1}-\Big (\frac{t_{i}*t_{i+1}}{t_{i}^2*h^2}+\frac{t_{i}*t_{i-1}}{t_{i}^2*h^2}\Big )w_{i}+\Big (\frac{t_{i}*t_{i-1}}{t_{i}^2*h^2}\Big )w_{i-1}+1= & {} 0, \end{aligned}$$
(70)

where \(h=t_{i+1}-t_{i}=t_{i}-t_{i-1}\) is the step size.

4.6.2 Numerical illustrations

Table 11 Analytic and NSFD solutions of Problem 6

t

NSFD (W1)

NSFD (W2)

NSFD (W3)

NSFD (W4)

Analytic

FD

0

0.331667827

0.332916864

0.333229227

0.333307441

0.3333333

0.333290917

0.1

0.331667827

0.331666864

0.331666725

0.331666817

0.331666667

0.331682038

0.2

0.326667827

0.326666861

0.326666728

0.326666818

0.326666667

0.326673276

0.3

0.318334493

0.318333524

0.318333396

0.318333488

0.318333333

0.318340846

0.4

0.306668512

0.306666872

0.30666674

0.306666821

0.306666667

0.306684483

0.5

0.291668923

0.291666869

0.291666837

0.291666827

0.291666667

0.291681745

0.6

0.273335863

0.273333536

0.273333627

0.273333488

0.273333333

0.273335831

0.7

0.251668757

0.251666843

0.251667238

0.25166677

0.251666667

0.251647285

0.8

0.226667826

0.226666788

0.226667282

0.226666716

0.226666667

0.226645107

0.9

0.198333769

0.198333402

0.198333731

0.198333359

0.198333333

0.19832179

figure p

Fig. 16 Comparison of NSFD solutions as \(h\rightarrow 0\) with analytical solution for Problem 6

Table 12 Absolute Errors in solution of Problem 6

t

E1

E2

E3

E4

E in FD

0

0.001665473

0.000416436

0.000104073

2.58586E\(-\)05

4.23825E\(-\)05

0.1

1.16001E\(-\)06

1.97084E\(-\)07

5.85398E\(-\)08

1.50308E\(-\)07

1.53714E\(-\)05

0.2

1.16001E\(-\)06

1.93959E\(-\)07

6.1144E\(-\)08

1.51783E\(-\)07

6.6093E\(-\)06

0.3

1.16001E\(-\)06

1.90834E\(-\)07

6.2446E\(-\)08

1.55014E\(-\)07

7.51309E\(-\)06

0.4

1.84501E\(-\)06

2.05417E\(-\)07

7.28625E\(-\)08

1.54112E\(-\)07

1.78162E\(-\)05

0.5

2.25602E\(-\)06

2.02084E\(-\)07

1.70518E\(-\)07

1.60297E\(-\)07

1.5078E\(-\)05

0.6

2.53002E\(-\)06

2.02639E\(-\)07

2.9389E\(-\)07

1.54315E\(-\)07

2.49728E\(-\)06

0.7

2.09002E\(-\)06

1.75953E\(-\)07

5.70999E\(-\)07

1.03296E\(-\)07

1.93814E\(-\)05

0.8

1.15918E\(-\)06

1.21563E\(-\)07

6.14931E\(-\)07

4.88593E\(-\)08

2.15595E\(-\)05

0.9

4.35189E\(-\)07

6.90742E\(-\)08

3.97581E\(-\)07

2.55243E\(-\)08

1.15411E\(-\)05

figure q

Fig. 17 Numerical errors in NSFD and FD for \(h=0.0125\) for Problem 6

figure r

Fig. 18 Error in NSFD solutions as \(h\rightarrow 0\) for Problem 6

4.7 Problem 7

We consider the following differential equation

$$\begin{aligned} w''(t)+\frac{1}{t}w'(t)+w(t)=4-9t+t^2-t^3, ~0<t<1, \end{aligned}$$
(71)

with boundary condition

$$ \begin{aligned} w'(0)=0 \; \& \; w(1)=0. \end{aligned}$$

Analytical solution of the above problem is:

$$\begin{aligned} w(t)= t^2-t^3. \end{aligned}$$

4.7.1 Mathematical illustrations

Above problem can be written as

$$\begin{aligned} \frac{1}{t}*(tw''(t)+w'(t))+w(t)= & {} 4-9t+t^2-t^3,\\ \frac{1}{t}*(t*w'(t))'+w(t)= & {} 4-9t+t^2-t^3. \end{aligned}$$

After discretizing it, we get

$$\begin{aligned} \frac{1}{t_{i}}*(t_{i}*w'(t_{i}))'+ w(t_{i})=4-9t_{i}+t_{i}^2-t_{i}^3. \end{aligned}$$
(72)

Applying NSFD scheme (2.2) to the above problem, we get

$$\begin{aligned} \frac{1}{t_{i}*h}\Bigg (\frac{w_{i+1}-w_{i}}{\ln \Big (\frac{t_{i+1}}{t_{i}}\Big )}-\frac{w_{i}-w_{i-1}}{\ln \Big ( \frac{t_{i}}{t_{i-1}}\Big )}\Bigg )+ w_{i}=4-9t_{i}+t_{i}^2-t_{i}^3, \end{aligned}$$
(73)

that is

$$\begin{aligned}&\Bigg (\frac{1}{t_{i}h\times \ln \big (\frac{t_{i+1}}{t_{i}}\Big )}\Bigg ) w_{i+1}\nonumber \\&\quad -\,\Bigg (-1+\frac{1}{t_{i}h\times \ln \big (\frac{t_{i+1}}{t_{i}}\Big )}+\frac{1}{t_{i}h\times \ln \big (\frac{t_{i}}{t_{i-1}}\Big )}\Bigg ) w_{i}\nonumber \\&\quad +\,\Bigg (\frac{1}{t_{i}h\times \ln \big (\frac{t_{i}}{t_{i-1}}\Big )}\Bigg ) w_{i-1}=4-9t_{i}+t_{i}^2-t_{i}^3. \end{aligned}$$
(74)

Here \(h=t_i-t_{i-1}\) is the step size. Now using the non-standard finite difference method, we discretize the inner boundary condition since \(w'(0)=0\), so \(tw'\) must be zero at its first grid point, i.e.,

$$\begin{aligned} \Bigg (\frac{1}{t_{0}h\times \ln \big (\frac{t_{1}}{t_{0}}\Big )}\Bigg )( w_{1}-w_{0})+w_{0}=4. \end{aligned}$$
(75)

The outer boundary condition can be dicretized as \(w(1)=w_N=0\).

4.7.2 Numerical illustrations

Table 13 Analytic and NSFD solutions of Problem 7

t

NSFD (W1)

NSFD (W2)

NSFD (W3)

NSFD (W4)

Analytic

FD

0

0.009559563

0.003003089

0.00090062

0.000261825

0

0.000337719

0.1

0.009559563

0.009153682

0.009040324

0.009010155

0.009

0.009037187

0.2

0.031043248

0.031765354

0.031942588

0.031985678

0.032

0.031983681

0.3

0.061458723

0.062616703

0.062905244

0.062976331

0.063

0.062982141

0.4

0.094271592

0.095569041

0.095893158

0.095973304

0.096

0.095975332

0.5

0.123308409

0.124577932

0.124895239

0.12497382

0.125

0.124973675

0.6

0.142491324

0.143623645

0.14390646

0.143976623

0.144

0.143975374

0.7

0.145776084

0.14669501

0.146924048

0.146981017

0.147

0.146979379

0.8

0.127134778

0.127784701

0.127946257

0.127986568

0.128

0.1279851

0.9

0.080547656

0.080887364

0.080971876

0.080992971

0.081

0.080992024

figure s

Fig. 19 Comparison of NSFD solutions as \(h\rightarrow 0\) with analytical solution for Problem 7

Table 14 Absolute Errors in solution of Problem 7

t

E1

E2

E3

E4

E in FD

0

0.009559563

0.003003089

0.00090062

0.000261825

0.000337719

0.1

0.000559563

0.000153682

4.03239E\(-\)05

1.01547E\(-\)05

3.71874E\(-\)05

0.2

0.000956752

0.000234646

5.74123E\(-\)05

1.4322E\(-\)05

1.63194E\(-\)05

0.3

0.001541277

0.000383297

9.47557E\(-\)05

2.3669E\(-\)05

1.7859E\(-\)05

0.4

0.001728408

0.000430959

0.000106842

2.66963E\(-\)05

2.46679E\(-\)05

0.5

0.001691591

0.000422068

0.000104761

2.61797E\(-\)05

2.63253E\(-\)05

0.6

0.001508676

0.000376355

9.35402E\(-\)05

2.33773E\(-\)05

2.46258E\(-\)05

0.7

0.001223916

0.00030499

7.59523E\(-\)05

1.89826E\(-\)05

2.06208E\(-\)05

0.8

0.000865222

0.000215299

5.37432E\(-\)05

1.34324E\(-\)05

1.48999E\(-\)05

0.9

0.000452344

0.000112636

2.81237E\(-\)05

7.02929E\(-\)06

7.97627E\(-\)06

figure t

Fig. 20 Numerical errors in NSFD and FD for \(h=0.0125\) for Problem 7

figure u

Fig. 21 Error in NSFD solutions as \(h\rightarrow 0\) for Problem 7

4.8 Problem 8

Equilibrium of isothermal gas sphere: We consider the following nonlinear SBVP [7]:

$$\begin{aligned} w''(t)+\frac{1}{t}w'(t)-[w(t)]^3+3[w(t)]^5=0,~ 0<t<1, \end{aligned}$$
(76)

with boundary conditions

$$\begin{aligned} w'(0)=0,\quad w(1)=\frac{1}{{\sqrt{2}}}. \end{aligned}$$

This equation arises in modelling the equilibrium of isothermal gas sphere. Analytical solution of the above problem is:

$$\begin{aligned} w(t)=\frac{1}{\sqrt{1+{t^2}}}. \end{aligned}$$
(77)

4.8.1 Mathematical illustrations

Above problem can be written as

$$\begin{aligned} \frac{1}{t}(t w'(t))'-[w(t)]^3+3[w(t)]^5=0. \end{aligned}$$
(78)

After discretizing it, we get

$$\begin{aligned} \frac{1}{t_{i}}(t_{i}w'(t_{i}))'-[w(t_{i})]^3+3[w(t_{i})]^5=0, \end{aligned}$$
(79)

Applying NSFD scheme 2.2 to the above problem, we get

$$\begin{aligned}&\frac{1}{t_{i}h}\Bigg (\frac{w_{i+1}-w_{i}}{\ln \Big (\frac{t_{i+1}}{t_{i}}\Big )}-\frac{w_{i}-w_{i-1}}{\ln \Big ( \frac{t_{i}}{t_{i-1}}\Big )}\Bigg )-(w_{i})^3+3(w_{i})^5=0, \end{aligned}$$
(80)
$$\begin{aligned}&\Bigg (\frac{1}{t_{i}h\times \ln \big (\frac{t_{i+1}}{t_{i}}\Big )}\Bigg ) w_{i+1}-\Bigg (\frac{1}{t_{i}h\times \ln \big (\frac{t_{i+1}}{t_{i}}\Big )}+\frac{1}{t_{i}h\times \ln \big (\frac{t_{i}}{t_{i-1}}\Big )}\Bigg ) w_{i}, \nonumber \\&+\,\Bigg (\frac{1}{t_{i}h\times \ln \big (\frac{t_{i}}{t_{i-1}}\Big )}\Bigg ) w_{i-1}-(w_{i})^3+3(w_{i})^5=0. \end{aligned}$$
(81)

Here \(h=t_i-t_{i-1}\) is the step size.

Now using the NSFD method, we discretize the inner boundary condition since \(w'(0)=0\), so \(tw'\) must be zero at its first grid point, i.e.,

$$\begin{aligned} \Bigg (\frac{1}{t_{0}h\times \ln \big (\frac{t_{1}}{t_{0}}\Big )}\Bigg )( w_{1}-w_{0})-(w_{0})^3+3(w_{0})^5=0. \end{aligned}$$
(82)

The outer boundary condition can be dicretized as \(w(1)=w_N=\frac{1}{\sqrt{2}}\).

4.8.2 Numerical illustrations

Table 15 Analytic and NSFD solutions of Problem 8

t

NSFD (W1)

NSFD (W2)

NSFD (W3)

NSFD (W4)

Analytic

FD

0

0.996332253

0.998871634

0.999677271

0.99997214

1

0.999885538

0.1

0.996332253

0.995429323

0.995169214

0.99504235

0.99503719

0.995079661

0.2

0.98277194

0.981194759

0.980783562

0.980589015

0.980580676

0.980644482

0.3

0.960235379

0.958487455

0.958003395

0.95783625

0.957826285

0.957894974

0.4

0.930749026

0.929098487

0.928580805

0.92847424

0.928476691

0.928541545

0.5

0.896366768

0.894959087

0.894489422

0.894428333

0.894427191

0.894483312

0.6

0.859019184

0.857913896

0.857520941

0.8574998

0.857492926

0.857537843

0.7

0.820329393

0.819538202

0.819239468

0.819232346

0.819231921

0.819264993

0.8

0.781560027

0.781064889

0.780858965

0.780862401

0.780868809

0.780890166

0.9

0.743618689

0.743386195

0.743284162

0.74329

0.743294146

0.743304417

figure v

Fig. 22 Comparison of NSFD solutions as \(h\rightarrow 0\) with analytical solution for Problem 8

Table 16 Absolute Errors in solution of Problem 8

t

E1

E2

E3

E4

E in FD

0

0.003667747

0.001128366

0.000322729

2.786E\(-\)05

0.000114462

0.1

0.001295063

0.000392133

0.000132023

5.15979E\(-\)06

4.24711E\(-\)05

0.2

0.002191264

0.000614083

0.000202887

8.33931E\(-\)06

6.38066E\(-\)05

0.3

0.002409093

0.000661169

0.000177109

9.96478E\(-\)06

6.86887E\(-\)05

0.4

0.002272335

0.000621797

0.000104114

2.45089E\(-\)06

6.48545E\(-\)05

0.5

0.001939577

0.000531896

6.22315E\(-\)05

1.142E\(-\)06

5.61206E\(-\)05

0.6

0.001526258

0.00042097

2.80156E\(-\)05

6.87429E\(-\)06

4.49171E\(-\)05

0.7

0.001097473

0.000306281

7.547E\(-\)06

4.25481E\(-\)07

3.30725E\(-\)05

0.8

0.000691218

0.000196079

9.84399E\(-\)06

6.40844E\(-\)06

2.13562E\(-\)05

0.9

0.000324542

9.20484E\(-\)05

9.98383E\(-\)06

4.14625E\(-\)06

1.02708E\(-\)05

figure w

Fig. 23 Numerical errors in NSFD and FD for \(h=0.0125\) for Problem 8

figure x

Fig. 24 Error in NSFD solutions as \(h\rightarrow 0\) for Problem 8

4.9 Problem 9

Thermal distribution in the human head: The following two point nonlinear SBVP \( (c = 2\) and \(g(t,w) = e^{-w(t)})\) has been derived by Duggan and Goodman [11] which describes the thermal distribution profile in the human head

$$\begin{aligned} w''(t)+\frac{2}{t}w'(t)+ e^{-w(t)}=0, ~ 0<t<1, \end{aligned}$$
(83)

with boundary condition

$$ \begin{aligned} w'(0)=0 ~ \& ~2w(1)+w'(1)=0. \end{aligned}$$

Analytical solution of the above problem is:

$$\begin{aligned} w(t)= \ln \Big ( \frac{B+1}{Bx^2+1}\Big ), \end{aligned}$$

where \( B=3-2\sqrt{2}\).

4.9.1 Mathematical illustrations

Above problem can be written as

$$\begin{aligned} \frac{1}{t^2}(t^2w'(t))'+ e^{-w(t)}=0. \end{aligned}$$
(84)

After discretizing it, we get

$$\begin{aligned} \frac{1}{t_{i}^2}(t_{i}^2 w'(t_{i}))'+e^{-w(t_{i})}=0, \end{aligned}$$
(85)

Applying NSFD scheme as described above in (2.3) to the above problem, we get

$$\begin{aligned} \frac{1}{t_{i}^2 h}\Bigg (t_{i}*t_{i+1} \frac{w_{i+1}-w_{i}}{t_{i+1}-t_{i}}-t_{i}*t_{i-1} \frac{w_{i}-w_{i-1}}{t_{i}-t_{i-1}}\Bigg )+e^{-w_{i}}= & {} 0,\nonumber \\ \Big (\frac{t_{i}*t_{i+1}}{t_{i}^2*h^2}\Big )w_{i+1}-\Big (\frac{t_{i}*t_{i+1}}{t_{i}^2*h^2}+\frac{t_{i}*t_{i-1}}{t_{i}^2*h^2}\Big )w_{i}+\Big (\frac{t_{i}*t_{i-1}}{t_{i}^2*h^2}\Big )w_{i-1}+e^{-w_{i}}= & {} 0,\nonumber \\ \end{aligned}$$
(86)

where   \(h=t_{i}-t_{i-1}\) is the step size.

4.9.2 Numerical illustrations

Table 17 Analytic, FD and NSFD solutions of Problem 9

t

NSFD (W1)

NSFD (W2)

NSFD (W3)

NSFD (W4)

Analytic

FD

0

0.266263465

0.268451865

0.269316716

0.269692931

0.269195827

0.1

0.266263465

0.267495248

0.268122301

0.268439455

0.268756903

0.267966449

0.2

0.262417516

0.263660205

0.264292812

0.264612699

0.26493282

0.264131907

0.3

0.255974454

0.257242592

0.257887677

0.25821368

0.258539792

0.257734361

0.4

0.246894301

0.248207425

0.24887461

0.249211433

0.249548183

0.248743821

0.5

0.235122416

0.236506816

0.237208719

0.237562447

0.237915891

0.237099948

0.6

0.220590786

0.222079284

0.222831647

0.223209958

0.22358771

0.22275

0.7

0.203215373

0.20484866

0.205670897

0.206083078

0.206494486

0.205625033

0.8

0.182895848

0.184722875

0.185638095

0.186095721

0.186552018

0.185664293

0.9

0.159513476

0.161592358

0.162628197

0.163145114

0.163659686

0.162760884

1

0.132927843

0.135328001

0.13651715

0.137110278

0.137698751

0.13678735

Here the analytic solution has been taken from Table 7 of [24].

figure y

Fig. 25 Comparison of NSFD solutions as \(h\rightarrow 0\) with analytical solution for Problem 9

Table 18 Absolute Errors in solution of Problem 9

t

E1

E2

E3

E4

E in FD

0.1

0.002493438

0.001261655

0.000634602

0.000317448

0.000790454

0.2

0.002515304

0.001272615

0.000640008

0.000320121

0.000800913

0.3

0.002565338

0.0012972

0.000652115

0.000326112

0.000805431

0.4

0.002653882

0.001340758

0.000673573

0.00033675

0.000804362

0.5

0.002793475

0.001409075

0.000707172

0.000353444

0.000815943

0.6

0.002996924

0.001508426

0.000756063

0.000377752

0.00083771

0.7

0.003279113

0.001645826

0.000823589

0.000411408

0.000869453

0.8

0.00365617

0.001829143

0.000913923

0.000456297

0.000887725

0.9

0.00414621

0.002067328

0.001031489

0.000514572

0.000898802

1

0.004770908

0.00237075

0.001181601

0.000588473

0.0009114

figure z

Fig. 26 Numerical errors in NSFD and FD for \(h=0.0125\) for Problem 9

figure aa

Fig. 27 Error in NSFD solutions as \(h\rightarrow 0\) for Problem 9

5 Remark

Here W1, W2, W3, W4 represent NSFD solutions and E1, E2, E3, E4 represent error in solutions for \(h=0.1\), \(h=0.05\), \(h=0.025\), \(h=0.0125\) respectively. In Figs. 1, 4, 7, 10, 13, 16, 19, 22 and 25, we have shown how NSFD solutions are behaving qualitatively in the same way as \(h\rightarrow 0\).

The numerical errors generated by NSFD and FD for \(h=0.0125\) are shown in Figs. 2, 5, 8, 11, 14, 17, 20, 23 and 26. We can see that errors in NSFD is very less as compared to FD even in the neighbourhood of singular point \(t=0\). And in Figs. 3, 6, 9, 12, 15, 18, 21, 24 and 27 we show that \(E \rightarrow 0\) as \(h\rightarrow 0\).

In Tables 1, 3, 5, 7, 9, 11, 13, 15 and 17, we have computed the values of NSFD solutions for various h and compared them with solutions of FD and Exact. In Tables 2, 4, 6, 8, 10, 12, 14, 16 and 18, we have compared the errors in NSFD for various h and also the errors in FD and NSFD for \(h=0.0125\).

6 Conclusions

The tables of approximate solution obtained from non-standard schemes show that the NSFD schemes give better results than standard schemes for non-linear SBVPs. They tackle singular BVP more accurately and efficiently than the FD schemes. These schemes are also quite stable as they rarely contain any instabilities [16]. The solution is easily approximated by NSFD near the singularity at the origin where the FD methods usually fail. The non-linear terms which are approximated non-locally on the computational grid also increases the accuracy and efficiency of the solution.