1 Introduction

We consider the following derivative dependent Emden–Fowler boundary value problems as

$$\begin{aligned} \left\{ \begin{array}{ll} \displaystyle \big (r(t)y'(t)\big )'=s(t)f\big (t,y(t),r(t)y'(t)\big ),~~~~~~~~~~~~~~~~t \in (0,1), \,\\ y(0)=\gamma _4, ~\hbox {or}~\lim _{t \rightarrow 0^+}r(t)\ y'(t)=0,~~ \gamma _1 y(1)+\gamma _2 y'(1)=\gamma _3, \end{array} \right. \end{aligned}$$
(1)

where \(\gamma _1>0\), \(\gamma _2\), \(\gamma _3\), and \(\gamma _4\) are real constants. The Emden-Fowler type Eq. (1) arises in many fields of mathematical sciences and astrophysics such as in the study of heat explosion [1], in calculation of oxygen concentration inside a spherical cell [2], to measure heat sources in human head [3], in shallow membrane cap theory [4], in modeling thermal explosion in a rectangular slab [5, 6].

Note that the Eq. (1) is called doubly singular boundary value problem [8], where \(r(t)=t^{a}v(t)\), \(v(0)\ne 0,\) \(s(t)=t^{b}z(t)\), \(z(0)\ne 0\) with \(r(0)=0\) and s(t) is allowed to be discontinuous at \(t=0\). The existence and uniqueness results of solution of these problems can be found in [7,8,9,10,11].

Finding numerical solution of such problems is very challenging due to singularity at the origin and strong nonlinearity of the form \(f(t,y(t),r(t)y'(t))\). Numerous numerical methods for solving (1) when \(f(t,y(t),r(t)y'(t))=f(t,y(t))\) have been developed like the finite difference method [12,13,14], the spline finite difference method [15], the parametric-spline method [16], the cubic spline method [17], the optimal parametric iteration method [18], the B-spline collocation method [19], the Adomian decomposition method (ADM) with Green’s function [20,21,22,23,24,25], the Laguerre wavelets collocation method [26], the classical polynomial approximation method [27], the modified variational iteration method [28], the Mickens’ type non-standard finite difference schemes [29], the homotopy analysis method [30, 31], the homotopy perturbation method [32], the Haar-wavelet collocation method [33, 34], the Haar wavelet quasi-linearization method [35, 36], the advanced Adomian decomposition method [37] and the Bernstein collocation method [38].

To the best of our knowledge there is very few methods provided so far for numerical solution of the derivative dependent Emden–Fowler boundary value problems such as the modified Adomian decomposition method [24, 25], the improved homotopy analysis method [39] and the B-spline collocation method [40].

In this paper, we propose an efficient collocation method based on the Bernstein polynomials for the numerical solution of the equivalent integral form of the derivative dependent Emden–Fowler boundary value problems (1). The Bernstein collocation method (BCM) is used to convert the integral equations into a system of nonlinear equations. Then a suitable iterative technique is used to find numerical solutions of the system of nonlinear equations. The error analysis of the proposed method is provided. The accuracy of the proposed method is examined by calculating the maximum absolute error \(L_{\infty }\) and the \(L_{2}\) error of some numerical examples. To check the efficiency of the present method the obtained numerical results are compared with the results obtained by the other known techniques.

2 Integral form of derivative dependent Emden-Fowler BVPs

2.1 For Dirichlet-Robin boundary conditions

Consider the following derivative dependent Emden-Fowler equation with Dirichlet-Robin BCs

$$\begin{aligned} \left\{ \begin{array}{ll} \big (r(t)y'(t)\big )'=s(t)f\big (t,y(t),r(t)y'(t)\big ),~~~~~~~~~~~~~~~~t \in (0,1),\,\\ y(0)=\gamma _4,\,\gamma _1 y(1)+\gamma _2 y'(1)=\gamma _3. \end{array} \right. \end{aligned}$$
(2)

Integrating the Eq. (2) from t to 1 and then from 0 to t and changing the order of integration and applying the boundary conditions, we obtain the equivalent integral equation

$$\begin{aligned} y(t)=\gamma _4 +\frac{(\gamma _3 -\gamma _1 \gamma _4)}{\gamma _1 h(1)+\gamma _2 h'(1)}h(t) +\int \limits _{0}^{1}G(t,\xi )\; s(\xi )\; f\big ( \xi ,y(\xi ),r(\xi )\ y'(\xi ) \big )d\xi ,~~~t \in (0,1), \end{aligned}$$
(3)

where \(G(t,\xi )\) is given by

$$ G\,(t,\xi ) = \left\{ {\begin{array}{*{20}l} {h(t) - \frac{{\gamma _{1} h(\xi )h(t)}}{{\gamma _{1} h(1) + \gamma _{2} h^{\prime}(1)}},~~~} \hfill & {t \le \xi ,} \hfill \\ {h(\xi ) - \frac{{\gamma _{1} h(t)h(\xi )}}{{\gamma _{1} h(1) + \gamma _{2} h^{\prime}(1)}},} \hfill & {\xi \le t,} \hfill \\ \end{array} } \right.$$
(4)

where \(h(t)= \int \limits _{0}^{t} \frac{1}{r(\xi )} d\xi \), \(h(1)= \int \limits _{0}^{1} \frac{1}{r(\xi )} d\xi \) and \(h'(1)= \frac{1}{r(1)}\).

2.2 For Neumann-Robin boundary conditions

Similarly, consider the derivative dependent Emden-Fowler equation with Neumann-Robin BCs

$$\begin{aligned} \left\{ \begin{array}{ll} \big (r(t)y'(t)\big )'=s(t)f\big (t,y(t),r(t)y'(t)\big ),~~~~~~~~~~~~~~~~t \in (0,1),\, \\ \displaystyle \lim _{t \rightarrow 0^+}r(t)\ y'(t)=0,~~\gamma _1 \ y(1)+\gamma _2 \ y'(1)=\gamma _3. \end{array} \right. \end{aligned}$$
(5)

Integrating the Eq. (5) from t to 1 and then from 0 to t and changing the order of integration and applying the boundary conditions, we obtain an integral equation

$$\begin{aligned} y(t)=\frac{\gamma _3}{\gamma _1} +\int \limits _{0}^{1}G(t,\xi )\; s(\xi )\; f\big ( \xi ,y(\xi ),r(\xi )\ y'(\xi ) \big )d\xi ,~~~t \in (0,1), \end{aligned}$$
(6)

with

$$ G(t,\xi ) = \left\{ {\begin{array}{*{20}l} {\int\limits_{\xi }^{1} {\frac{1}{{r(t)}}} dt + \frac{{\gamma _{2} }}{{\gamma _{1} r(1)}},} \hfill & {t \le \xi ,{\mkern 1mu} } \hfill \\ {\int\limits_{\xi }^{1} {\frac{1}{{r(t)}}} dt - \int\limits_{\xi }^{t} {\frac{1}{{r(t)}}} dt + \frac{{\gamma _{2} }}{{\gamma _{1} r(1)}},~~~~} \hfill & {\xi \le t.} \hfill \\ \end{array} } \right.$$
(7)

3 The Bernstein collocation method

he Bernstein polynomials play a prominent role in many areas of mathematical sciences. One of the important property of these polynomials is that they all vanish, except at the end points of the interval [0, 1]. This gives more flexibility in which to impose boundary conditions at the end points of the interval. These polynomials have several other useful properties, such as the continuity, the positivity and complete basis formation over the interval [0, 1]. These polynomials have frequently been used to solve various differential and integral equations [41,42,43,44,45,46,47,48,49,50,51].

Definition 1

The Bernstein polynomials [41] of degree n are defined as

$$\begin{aligned} B_{i,n}(t)=\left( {\begin{array}{c}n\\ i\end{array}}\right) t^i(1-t)^{n-i},~~~~~i=0,1,2,\cdots n,~~~~~~~t \in [0,1], \end{aligned}$$
(8)

where \(\displaystyle \left( {\begin{array}{c}n\\ i\end{array}}\right) =\frac{n!}{i! (n-i)!}\).

A recursive definition can also be used to generate these polynomials,

$$\begin{aligned}B_{i,n}(t)=(1-t)B_{i,n-1}(t)+ tB_{i-1,n-1}(t).\end{aligned}$$

The derivative of the Bernstein polynomials is given by

$$\begin{aligned}\frac{d B_{i,n}(t)}{dt}=n[B_{i-1,n-1}(t)-B_{i,n-1}(t)],\end{aligned}$$

and their finite integral is

$$\begin{aligned}\int _0^1 B_{i,n}(t)dt=\frac{1}{n+1}.\end{aligned}$$

Definition 2

The Bernstein polynomials form a complete basis with the following properties

  1. (i)

    \(B_{i,n}(t)=0\),    when   \(i<0\) or \(i>n,\)

  2. (ii)

    \(B_{i,n}(0)=B_{i,n}(1)=0\),    when \(i=1,2,\cdots n-1\),

  3. (iii)

    They form the partition of unity:

    $$\begin{aligned}\displaystyle \sum _{i=0}^{n}B_{i,n}(t)=1.\end{aligned}$$

    and their derivative verify the partition of nullity:

    $$\begin{aligned}\displaystyle \sum _{i=0}^{n}\frac{d^pB_{i,n}(t)}{dt^p}=1,~p\ge 0.\end{aligned}$$

    This property is closely related to the capability of an approximation to reproduce exactly a polynomial solution [52].

Note that an excellent performance in terms of error can be reached with Bernstein expansion for relatively low order approximations, but for a higher degree of the Bernstein polynomial there may be an increase in the numerical dissipation due to the evaluation of binomial terms and powers of a very high order. This drawback can be relieved by using the binomial multiplicative formula:

$$\begin{aligned}\left( {\begin{array}{c}n\\ i\end{array}}\right) = \prod _{l=1}^i\frac{n-l+1}{l},\end{aligned}$$

which allows a more efficient computation of binomial terms [47].

Any function \(v(t) \in L^{2}[0,1]\) can be approximated by the Bernstein basis polynomials as

$$\begin{aligned} v(t)=\sum _{i=0}^{\infty }a_{i}B_{i,n}(t). \end{aligned}$$
(9)

For numerical purpose, we consider the first \((n+1)\) terms of the above expansion as

$$\begin{aligned} v(t)\approx \sum _{i=0}^{n}a_{i}B_{i,n}(t). \end{aligned}$$
(10)

The collocation points on an interval [0, 1] is defined as

$$\begin{aligned} t_j=t_0+\frac{j}{n},~~~~j=0,1,2,\ldots n,~~~0\le t_0 <1. \end{aligned}$$
(11)

Such collocation points are considered for which maxima are reached for the Bernstein polynomial.

In next subsection, we establish a collocation method based on Bernstein polynomials for finding numerical solution of the integral Eqs. (3) and (6).

3.1 Dirichlet-Robin boundary conditions

To establish a numerical algorithm, we reconsider Eq. (3) as follows:

$$\begin{aligned} y(t)=\gamma _4 +\bigg (\frac{\gamma _3 -\gamma _1 \gamma _4}{\gamma _1 h(1)+\gamma _2 h'(1)} \bigg )h(t) +\int \limits _{0}^{1}G(t,\xi )\; s(\xi )\; f(\xi ,y(\xi ),r(\xi )\ y'(\xi ))d\xi ,~~~t \in (0,1). \end{aligned}$$
(12)

In Eq. (12), we consider

$$\begin{aligned} \psi (t)=f(t,y(t),r(t)y'(t)). \end{aligned}$$
(13)

On approximating y(t), \(y'(t)\) and \(\psi (t)\) by the Bernstein basis polynomials, we get

$$\begin{aligned}&y(t)\approx \sum _{i=0}^{n}a_{i}B_{i,n}(t), \end{aligned}$$
(14)
$$\begin{aligned}&y'(t)\approx \sum _{i=0}^{n}a_{i}B'_{i,n}(t),~~\text {where}~~'=\frac{d}{dt}, \end{aligned}$$
(15)
$$\begin{aligned}&\psi (t)\approx \sum _{i=0}^{n}b_{i}B_{i,n}(t). \end{aligned}$$
(16)

Substituting the expression from (14) and (15) into (12), we obtain

$$\begin{aligned} \sum _{i=0}^{n}a_{i}B_{i,n}(t)=\gamma _4 +\bigg (\frac{\gamma _3 -\gamma _1 \gamma _4}{\gamma _1 h(1)+\gamma _2 h'(1)} \bigg )h(t)+\sum _{i=0}^{n}b_{i}\int \limits _{0}^{1} G(t,\xi )\; s(\xi )\; B_{i,n}(\xi )d\xi , \end{aligned}$$
(17)

which can be written as

$$\begin{aligned} \sum _{i=0}^{n}a_{i}B_{i,n}(t)=\gamma _4 +\bigg (\frac{\gamma _3 -\gamma _1 \gamma _4}{\gamma _1 h(1)+\gamma _2 h'(1)} \bigg )h(t)+ \sum _{i=0}^{n}b_{i}K_i(t), \end{aligned}$$
(18)

where

$$\begin{aligned} K_i(t)=\int \limits _{0}^{1} G(t,\xi )\; s(\xi )\; B_{i,n}(\xi )d\xi ,~~~i=0,1,2,\ldots n. \end{aligned}$$
(19)

On differentiating (18) w.r.t. t, we get

$$\begin{aligned} \sum _{i=0}^{n}a_{i}B'_{i,n}(t)=\bigg (\frac{\gamma _3 -\gamma _1 \gamma _4}{\gamma _1 h(1)+\gamma _2 h'(1)} \bigg )h'(t)+ \sum _{i=0}^{n}b_{i}K'_i(t). \end{aligned}$$
(20)

where

$$\begin{aligned}K'_i(t)=\displaystyle \frac{d}{dt}\bigg (\int \limits _{0}^{1} G(t,\xi )\; s(\xi )\; B_{i,n}(\xi )d\xi \bigg ),~~~~~~i=0,1,2,\ldots n.\end{aligned}$$

Using the expressions of y(t), \(y'(t)\) and \(\psi (t)\) from Eqs. (14), (15) and (16), Eq. (13) takes form

$$\begin{aligned} \sum _{i=0}^{n}b_{i}B_{i,n}(t)=f\bigg (t, ~\sum _{i=0}^{n}a_{i}B_{i,n}(t), ~r(t)\sum _{i=0}^{n}a_{i}B'_{i,n}(t) \bigg ). \end{aligned}$$
(21)

Upon substituting the expressions from Eqs. (18) and (20) into (21) and inserting the collocation points \(t_j\) defined in (11), we obtain the nonlinear system of equations as

$$\begin{aligned}&\sum _{i=0}^{n}b_{i}B_{i,n}(t_j)-f\Bigg [t_j,~ \gamma _4 + \frac{(\gamma _3 -\gamma _1 \gamma _4)}{\gamma _1 h(1)+\gamma _2 h'(1)} \ h(t_j)+\sum _{i=0}^{n}b_{i}K_i(t_j),\nonumber \\&\quad r(t_j)\bigg ( \frac{(\gamma _3 -\gamma _1 \gamma _4)}{\gamma _1 h(1)+\gamma _2 h'(1)}\ h'(t_j)+ \sum _{i=0}^{n}b_{i}K'_i(t_j)\bigg )\Bigg ]=0,~~~~~~~~~~~j=0,1,2,\ldots n, \end{aligned}$$
(22)

where \(b_0,b_1,\ldots ,b_n\) are the unknowns. The nonlinear system of Eq. (22) is solved numerically by the Newton’s iteration method to get the unknowns \(b_i\), which are then substituted in Eq. (18) to get the numerical solution of (12).

3.2 Neumann-Robin boundary conditions

Let us reconsider the integral Eq. (6) as

$$\begin{aligned} y(t)=\frac{\gamma _3}{\gamma _1} +\int \limits _{0}^{1}G(t,\xi ) s(\xi ) f(\xi ,y(\xi ),r(\xi )y'(\xi ))d\xi , ~~~t \in (0,1). \end{aligned}$$
(23)

Following similar steps of previous subsection, we substitute the expressions from Eqs. (13), (14), (15) and (16) into Eq. (23) and get

$$\begin{aligned} \sum _{i=0}^{n}a_{i}B_{i,n}(t)=\frac{\gamma _3}{\gamma _1}+\sum _{i=0}^{n}b_{i}\int \limits _{0}^{1} G(t,\xi )\; s(\xi )\; B_{i,n}(\xi )d\xi , \end{aligned}$$
(24)

which can further be written as

$$\begin{aligned} \sum _{i=0}^{n}a_{i}B_{i,n}(t)=\frac{\gamma _3}{\gamma _1}+ \sum _{i=0}^{n}b_{i}K_i(t), \end{aligned}$$
(25)

and

$$\begin{aligned} \sum _{i=0}^{n}a_{i}B'_{i,n}(t)= \sum _{i=0}^{n}b_{i}K'_i(t). \end{aligned}$$
(26)

Using (25) and (26) into (21) and inserting the collocation points \(t_j\), we obtain the nonlinear system of equations as

$$\begin{aligned} \sum _{i=0}^{n}b_{i}B_{i,n}(t_j)-f\bigg (t_j,~ \frac{\gamma _3}{\gamma _1}+ \sum _{i=0}^{n}b_{i}K_i(t_j),~ r(t_j) \sum _{i=0}^{n}b_{i}K'_i(t_j)\bigg )=0,~~ j=0,1,2\ldots , n, \end{aligned}$$
(27)

with the unknowns \(b_0,b_1,\cdots ,b_{n}.\) Solving the nonlinear system of Eqs. (27) by Newton’s iteration method, we obtain the unknown coefficients which will be substituted in Eq. (25) to get the numerical solution of (23).

Remark 1

In the present analysis, the nonlinear systems of Eqs. (22) and (27) lead to full matrices which are generally computationally demanding. But in this method, we have need solve a very small sized matrix to reach the desired accuracy. So, it is computationally efficient to use the Bernstein collocation method for solving these nonlinear systems of equations.

4 Error analysis

Let \({\mathbb {X}}=C[0,1]\bigcap C^1(0,1]\) be the Banach space with the norm [7, 8] defined as

$$\begin{aligned} \Vert y\Vert = \displaystyle \max \{\Vert y\Vert _0, \Vert y\Vert _1\},~y \in {\mathbb {X}}, \end{aligned}$$
(28)

where \(\Vert y\Vert _0\) and \(\Vert y\Vert _1\) are defined as

$$\begin{aligned} \Vert y\Vert _0= \displaystyle \max _{t \in [0,1]} |y(t)|, \end{aligned}$$
(29)

and

$$\begin{aligned} \Vert y\Vert _1= \displaystyle \max _{t \in [0,1]} |r(t)y'(t)|. \end{aligned}$$
(30)

We consider the following integral equation

$$\begin{aligned} y(t)=g(t)+ \int \limits _{0}^{1}G(t,\xi ) \;s(\xi )\; f(\xi ,y(\xi ),r(\xi )y'(\xi ))d\xi , ~~~~~~t \in (0,1). \end{aligned}$$
(31)

Note that the integral Eqs. (3) and (6) are special cases of (31) when \(g(t)=\gamma _4 +\frac{\gamma _3 -\gamma _1 \gamma _4}{\gamma _1 h(1)+\gamma _2 h'(1)}h(t)\) and \(g(t)=\frac{\gamma _3}{\gamma _1}\), respectively.

Theorem 1

(See [53]) If \(v(t) \in C[0,1]\), the sequence \(\{B_{n}(v)\}\) converges uniformly to v, where \(B_{n}(v)= \sum _{i=0}^{n}a_{i}\ B^n_{i}(t)\) is the Bernstein approximation function. In other words for any \(\epsilon > 0\) there exists a number \(n \in {\mathbb {N}}\) such that \(\Vert B_{n}(v)-v\Vert <\epsilon .\)

Theorem 2

(See [54]) If v(t) is bounded and \(v''(t)\) exists in [0, 1], then the error bound for Bernstein’s approximation function is obtained as

$$\begin{aligned} \Vert B_{n}(v)-v\Vert \le \frac{\Vert v''\Vert }{2n}\max _{t \in [0,1]} \big (t(1-t)\big )=\frac{\Vert v''\Vert }{8n}, \end{aligned}$$
(32)

and the rate of convergence of Bernstein’s approximation function is precisely \(\nicefrac {1}{n}\) [55], provided \(v''(t) \ne 0\).

Theorem 3

Let y(t) and \(y_{n}(t)\) be the exact and the approximate solutions of the integral Eq. (31). Assume that the nonlinear function \(f(t,y,ry')\) satisfies the Lipschitz condition

$$\begin{aligned} |f(t,y,ry')-f(t,y_n,ry'_n)| \le l_1|y-y_n|+l_2|r(y'-y'_n)|, \end{aligned}$$
(33)

where \(l_1\) and \(l_2\) are the Lipschitz constants. Then the error bound for Bernstein collocation method is estimated as

$$\begin{aligned} \Vert y-y_{n}\Vert \le \frac{wlm}{4n}, \end{aligned}$$
(34)

where \(l=\max \{l_1, l_2\}\), \(m=\max \{m_1, m_2\}\), \(w=\Vert y''\Vert \),

$$\begin{aligned}m_1=\max _{t \in [0,1]}\int \limits _{0}^{1}\big |G(t,\xi ) \ s(\xi )\big |d\xi<\infty ,~~m_2=\displaystyle \max _{t \in [0,1]}\int \limits _{0}^{1}\big |r(t)G_t(t,\xi ) \ s(\xi )\big |d\xi <\infty . \end{aligned}$$

Proof

Consider

$$\begin{aligned} \Vert y-y_{n}\Vert _0&= \displaystyle \max _{t \in [0,1]}\bigg | \int _{0}^{1}G(t,\xi )\;s(\xi )\;\bigg (f \big (\xi , y(\xi ), r(\xi )y'(\xi )\big )-f \big (\xi , y_n(\xi ), r(\xi )y'_n(\xi )\big )\bigg ) d\xi \bigg |\\&\le \displaystyle \max _{t \in [0,1]}\bigg | \int _{0}^{1}G(t,\xi )\;s(\xi )d\xi \bigg | \times \max _{\xi \in [0,1]} \bigg |f \big (\xi , y(\xi ), r(\xi )y'(\xi )\big )-f \big (\xi , y_{n}(\xi ), r(\xi )y'_n(\xi )\big )\bigg |. \end{aligned}$$

Applying the Lipschitz condition, the above inequality becomes

$$\begin{aligned} \Vert y-y_{n}\Vert _0&\le m_1 \max _{\xi \in [0,1]} \bigg \{l_1\big |y(\xi )-y_n(\xi )\big |+l_2\big |r(\xi ) (y'(\xi )-y'_n(\xi ))\big |\bigg \}\nonumber \\&\le 2 lm_1 \ \max \bigg \{\Vert y-y_n\Vert _0,\Vert y-y_n\Vert _1\bigg \}\nonumber \\&= 2 lm_1\ \Vert y-y_{n}\Vert . \end{aligned}$$
(35)

In the same way, we obtain

$$\begin{aligned} \Vert y-y_{n}\Vert _1&= \max _{t \in [0,1]}\bigg | \int _{0}^{1}r(t)G_t(t,\xi )\;s(\xi )\;\bigg (f \big (\xi , y(\xi ), r(\xi )y'(\xi )\big )-f \big (\xi , y_n(\xi ), r(\xi )y'_n(\xi )\big )\bigg ) d\xi \bigg |\\&\le \displaystyle \max _{t \in [0,1]}\bigg | \int _{0}^{1}r(t)G_t(t,\xi )\;s(\xi )d\xi \bigg | \times \max _{\xi \in [0,1]} \bigg |f \big (\xi , y(\xi ), r(\xi )y'(\xi )\big )-f \big (\xi , y_{n}(\xi ), r(\xi )y'_n(\xi )\big )\bigg | . \end{aligned}$$

Using the Lipschitz condition, we get

$$\begin{aligned} \Vert y-y_{n}\Vert _1&\le m_2 \max _{\xi \in [0,1]} \big \{l_1 \big |y(\xi )-y_n(\xi )\big |+l_2 \big |r(y'(\xi )-y'_n(\xi ))\big |\bigg \}\nonumber \\&\le 2lm_2 \max \bigg \{\big \Vert y-y_n \big \Vert _0, \big \Vert y-y_n\big \Vert _1 \bigg \} \nonumber \\&= 2lm_2 \Vert y-y_{n}\Vert . \end{aligned}$$
(36)

From Eqs. (35) and (36), we obtain

$$\begin{aligned} \Vert y-y_{n}\Vert&=\max \bigg \{\big \Vert y-y_n\big \Vert _0, \big \Vert y-y_n\big \Vert _1\bigg \} \nonumber \\&\le \max \bigg \{2lm_1 \big \Vert y-y_{n}\big \Vert , 2lm_2 \big \Vert y-y_{n}\big \Vert \bigg \}\nonumber \\&\le 2lm \Vert y-y_{n}\Vert = 2lm \max _{\xi \in [0,1]}|y(\xi )-y_n(\xi )|. \end{aligned}$$
(37)

Replacing \(y_n(\xi )\) by the Bernstein solution \(B_{n}\big (y(\xi )\big )\), Eq. (37) reduces to

$$\begin{aligned} \Vert y-y_{n}\Vert \le 2lm \max _{\xi \in [0,1]}|y(\xi )-B_{n}(y(\xi ))|. \end{aligned}$$
(38)

Using the result from Eq. (32), the Eq. (38) becomes

$$\begin{aligned} \Vert y-y_{n}\Vert \le 2lm \frac{w}{2n} \max _{\xi \in [0,1]} \big (\xi (1-\xi )\big )=\frac{wlm}{4n}. \end{aligned}$$
(39)

\(\square \)

5 Numerical results

We examine the accuracy of the proposed method by solving the several derivative dependent Emden-Fowler type singular BVPs. For comparison purpose, we define the maximum absolute error as

$$\begin{aligned} L_{\infty }=\max _{t \in [0,1]} |y(t)-y_{n}(t)|,~~n=1,2,\ldots , \end{aligned}$$

and the \(L_2\) error as

$$\begin{aligned} L_{2}=\bigg (\sum _{j=1}^{n}|y(t_j)-y_{n}(t_j)|^2\bigg )^{1/2}. \end{aligned}$$

Here y(t) is the exact solution and \(y_{n}(t)\) is the Bernstein solution. The maximum absolute error is defined as

$$\begin{aligned} E_{n}=\max _{t \in [0,1]} |y(t)-\psi _n(t)|, ~~n=1,2,\ldots , \end{aligned}$$

where \(\psi _n(t) =\sum _{j=0}^{n}y_{j}(t)\) denotes Adomian decomposition method solution [24].

Example 1

Consider the following derivative dependent Emden-Fowler BVP [24] as

$$\begin{aligned} \left\{ \begin{array}{ll} \displaystyle \big (t^k y'(t)\big )'=t^{k +l -2} \big (l t y'(t)+l\big (k+l-1\big )y(t)\big ),~~~t \in (0,1),~~~~~~l>0,\\ y(0)=1,~~~~~~y(1)=e. \end{array} \right. \end{aligned}$$
(40)

Its exact solution is given by \(y(t)=e^{t^l}\). The equivalent integral form of (40) is

$$\begin{aligned} y(t)=1 +\frac{(e -1)}{(1-k)^2}t^{1-k} +\int \limits _{0}^{1}G(t,\xi )\; \xi ^{k +l -2}\; \bigg (l\xi y'+l\big (k+l-1\big )y(\xi )\bigg )d\xi , \end{aligned}$$
(41)

where \(G(t,\xi )\) is

$$ G(t,\xi ) = \left\{ {\begin{array}{*{20}l} {\frac{{t^{{1 - k}} }}{{1 - k}}(1 - \xi ^{{1 - k}} ),} \hfill & {t \le \xi ,} \hfill \\ {\frac{{\xi ^{{1 - k}} }}{{1 - k}}(1 - t^{{1 - k}} ),} \hfill & {\xi \le t.} \hfill \\ \end{array} } \right.$$
(42)

We compare the numerical results of maximum absolute errors \(L_{\infty }\) and \(E_n\) obtained by BCM and the ADM [24] of Example 1 for \(l=1\) and \(l=2.5\) with different values of \(k=0.25,~0.50,~0.75\) in Tables 1 and 2. In addition, the numerical results of the \(L_2\) error are shown in Tables 3 and 4. From the numerical results, it is observed that the BCM converges faster than the ADM [24]. It can be seen that as the degree of the Bernstein polynomial increases, the numerical errors decreases significantly.

Table 1 Comparison of numerical results of maximum absolute errors of Example 1 when \(l=1\)
Table 2 Comparison of numerical results of maximum absolute errors of Example 1 when \(l=2.5\)
Table 3 Numerical results of \(L_2\) error of Example 1 when \(l=1\)
Table 4 Numerical results of \(L_2\) error of Example 1 when \(l=2.5\)

Example 2

Consider the following Emden-Fowler equation with derivative dependence [24]

$$\begin{aligned} \left\{ \begin{array}{ll} \big (t^k y'(t)\big )'=t^{k -1} \big (-t y'(t)e^{y(t)}-ke^{y(t)}\big ),~~~t \in (0,1), \, \\ y(0)=\ln \big (\frac{1}{2}\big ),~~~y(1)=\ln \big (\frac{1}{3}\big ). \end{array} \right. \end{aligned}$$
(43)

Its exact solution is given by \(y(t)=\ln \bigg (\frac{1}{2+t}\bigg )\). The equivalent integral form of (43) is

$$\begin{aligned} y(t)=\ln \big (\frac{1}{2}\big ) +\frac{\big (\ln \big (\frac{1}{3}\big ) -\ln \big (\frac{1}{2}\big )\big )}{(1-k)^2}t^{1-k} +\int \limits _{0}^{1}G(t,\xi )\; \xi ^{k -1}\; \bigg (-\xi y(\xi )'e^{y(\xi )}-ke^{y(\xi )}\bigg )d\xi , \end{aligned}$$
(44)

where \(G(t,\xi )\) is

$$ G(t,\xi ) = \left\{ {\begin{array}{*{20}l} {\frac{{t^{{1 - k}} }}{{1 - k}}(1 - \xi ^{{1 - k}} ),} \hfill & {t \le \xi ,} \hfill \\ {\frac{{\xi ^{{1 - k}} }}{{1 - k}}(1 - t^{{1 - k}} ),} \hfill & {\xi \le t.} \hfill \\ \end{array} } \right.$$
(45)

Comparison of the numerical results of \(L_{\infty }\) and \(E_n\) obtained by the BCM and the ADM [24] of Example 2 is given in Table 5. In addition, the numerical results of the \(L_2\) error is shown in Table 6.

Table 5 Comparison of numerical results of maximum absolute error of Example 2
Table 6 Numerical results of \(L_2\) error of Example 2

Example 3

Consider the following derivative dependent Emden-Fowler BVP [24]

$$\begin{aligned} \left\{ \begin{array}{ll} \big (t^k y'(t)\big )'=t^{k +l -2} \bigg (lt e^{y(t)} y'(t)+l\big (k+l-1\big )e^{y(t)}\bigg ),~~~t \in (0,1),\\ y(0)=\ln \big (\frac{1}{4}\big ),~~~y(1)=\ln \big (\frac{1}{5}\big ). \end{array} \right. \end{aligned}$$
(46)

Its exact solution is given by \(y(t)=\ln \big (\frac{1}{4+t^l}\big )\). The equivalent integral form of (46) is

$$\begin{aligned} y(t)=\ln \bigg (\frac{1}{4}\bigg ) +\frac{\big (\ln \big (\frac{1}{5}\big )-\ln \big (\frac{1}{4}\big )\big )}{(1-k)^2}t^{1-k} +\int \limits _{0}^{1}G(t,\xi )\; \xi ^{k +l -2}\; \bigg (l\xi e^{y(\xi )} y'(\xi )+l\big (k+l-1\big )e^{y(\xi )}\bigg )d\xi , \end{aligned}$$
(47)

where \(G(t,\xi )\) is

$$ G(t,\xi ) = \left\{ {\begin{array}{*{20}l} {\frac{{t^{{1 - k}} }}{{1 - k}}(1 - \xi ^{{1 - k}} ),} \hfill & {t \le \xi ,{\mkern 1mu} } \hfill \\ {\frac{{\xi ^{{1 - k}} }}{{1 - k}}(1 - t^{{1 - k}} ),} \hfill & {\xi \le t.} \hfill \\ \end{array} } \right. $$
(48)

In Tables 7 and 8, we provide the numerical results of maximum absolute errors obtained by the BCM and the ADM [24] of Example 3 for \(l=1\) and \(l=3.5\) with \(k=0.25,~0.50,~0.75\), respectively. We also present the \(L_2\) error in Tables 9 and 10. It has been observed that the BCM converges faster and as the value of n increases, the \(L_{\infty }\) and \(L_2\) errors decrease rapidly.

Table 7 Comparison of numerical results of maximum absolute error of Example 3 when \(l=1\)
Table 8 Comparison of numerical results of maximum absolute error of Example 3 when \(l=3.5\)
Table 9 Numerical results of \(L_2\) error of Example 3 when \(l=1\)
Table 10 Numerical results of \(L_2\) error of Example 3 when \(l=3.5\)

Example 4

Consider the following derivative dependent Emden-Fowler BVP [25]

$$\begin{aligned} \left\{ \begin{array}{ll} \displaystyle \big (t^k y'(t)\big )'=t^{k +l-2} \Big (t y'(t)+y(t)(k+l-1)\Big ),~~~t \in (0,1),~~l>0,\\ \displaystyle \lim _{t \rightarrow 0^+}r(t)\ y'(t)=0,~~~y(1)=e. \end{array} \right. \end{aligned}$$
(49)

Its exact solution is given by \(y(t)=e^{t^l}\). The equivalent integral form of (49) is

$$\begin{aligned} y(t)=e +\int \limits _{0}^{1}G(t,\xi )\;\xi ^{k +l -2} \bigg (\xi y'(\xi )+y(\xi )\big (k+l-1\big )\bigg )ds, \end{aligned}$$
(50)

where \(G(t,\xi )\) is

$$ G(t,\xi ) = \left\{ {\begin{array}{*{20}l} {\frac{1}{{1 - k}}(1 - \xi ^{{1 - k}} ),} \hfill & {t \le \xi ,} \hfill \\ {\frac{1}{{1 - k}}(1 - t^{{1 - k}} ),} \hfill & {\xi \le t.} \hfill \\ \end{array} } \right. $$
(51)

The numerical results of maximum absolute error \(L_{\infty }\) and \(L_{2}\) error of Example 4 are provided in Table 11 for \(k=2\) and different values of \(l=1,~2,~4\). It can be seen that as the degree of the Bernstein polynomial increases, the numerical errors decreases significantly.

Table 11 Numerical results of maximum absolute error \(L_{\infty }\) and \(L_{2}\) error of Example 4 for \(k=2\)

Remark 2

From the numerical results, it can be seen that a smaller value of \(n\le 10\) is sufficient for obtaining an excellent approximation. Also increasing the value of n results in an increment of computational time and the numerical results of \(L_{\infty }\) and \(\L _2\) errors are increased or become constant because a problem of truncation error occurs when the degree of the Bernstein polynomial is raised. So, in this case, it is numerically advisable to use a smaller value of n. However, for a high-order collocation scheme, if no truncation of decimal positions could be achieved, the solution would be better than those coming from a lower number of evaluation points.

6 Conclusion

We have considered the derivative dependent Emden–Fowler boundary value problems, which arise in various mathematical modeling such as heat conduction problem [56], the unsteady poiseuille flow in a pipe [57], and electroelastic dynamic problem [58]. We have proposed the Bernstein collocation approach for the numerical solution of the equivalent integral form of the derivative dependent Emden-Fowler equation with two sets of boundary conditions. The error analysis of the Bernstein collocation method has been established under quite general conditions. The proposed method gives better numerical results which can be seen from Tables 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11. The accuracy and efficiency of the present method have been checked by evaluating the maximum absolute error and the \(L_{2}\) error of several numerical examples.