1 Introduction

The well-known Thomas-Fermi equation has been proposed independently by Thomas [1] and Fermi [2] in 1927 which is given by \(y''(x)=x^{- \frac{1}{2}}y^{\frac{3}{2}}(x)\) with \(y(0)=1,\displaystyle \lim _{x \rightarrow \infty }y(x)=0\). It is used to determine the electrical potential in an atom. It is a significant nonlinear differential equation arising in a semi-infinite interval. However, it is boundary conditions (BCs) that represent the physical content of a problem. Hence, for practical purposes, most studies are conducted for finite intervals instead of a semi-infinite interval. In [3], the author has studied the following generalized Thomas-Fermi equation

$$\begin{aligned} \left\{ \begin{array}{ll} (x^{k}y'(x))'=cx^{k+l}y^{m}(x), ~~x \in (0,1),~~0\le k<1,~~~~~l> -2,\\ y(0)=\delta _4,~~~\delta _1 y(1)+\delta _2 y'(1)=\delta _3,~\delta _1>0,~\delta _2,~\delta _3,~\delta _4. \end{array} \right. \end{aligned}$$
(1.1)

Thomas-Fermi equation has been used to study the charge densities and potential in many scientific models. For instance, in atoms [4, 5], molecules [6], atoms in strong magnetic fields [7] and metals and crystals [8]. Various numerical methods have been used to find accurate and reliable solution of Thomas-Fermi equation such as, decomposition method [9], sweep method [10], variational method [11], optimal parametric iteration method [12], fixed-point method [13], Hermite collocation method, genetic algorithms hybrid with sequential quadratic method [14], quasilinearization method [15, 16] and Abel’s method [17]. In this work, we present a numerically efficient method based on the Chebyshev wavelet theory for the numerical solution of the more general Thomas-Fermi type boundary value problems (BVPs) [18] as

$$\begin{aligned} \left\{ \begin{array}{ll} \big (g(x)y'(x)\big )'= h(x) \phi \big (x,y(x)\big ),~~~~~~~x \in (0,1),\\ y(0)=\delta _4~~~~\hbox {or}~~~~y'(0)=0~~~~~~\hbox {and}~~~~\delta _1 y(1)+\delta _2 y'(1)=\delta _3. \end{array} \right. \end{aligned}$$
(1.2)

Here \(g(x)=x^{a}u(x)\), \(u(0)\ne 0,\) \(h(x)=x^{b}v(x)\), \(v(0)\ne 0\), \(g(0)=0\) and h(x) is allowed to be discontinuous at \(x=0\). The existence-uniqueness results of the general Thomas-Fermi type BVPs of type (1.2) have been established in [19, 20, 32]. We assume the following conditions on g(x), h(x) and \(\phi (x,y(x))\):

  1. (i)

    \(g(x)\in C[0,1]\cap C^{1}(0,1]\), \(g(x)>0\), and \(h(x)>0\) in (0, 1];

  2. (ii)

    \(\frac{1}{g(x)}\in L^{1}[0,1]\), and \( \int \limits _{0}^{1}\frac{1}{g(x)}\left( \int \limits _{x}^{1}h(s){\text {d}}s\right) {\text {d}}x<\infty \), (for Dirichlet-Robin BCs);

  3. (iii)

    \(h(x)\in L^{1}[0,1]\), and \(\int \limits _{0}^{1}\frac{1}{g(x)} \left( \int \limits _{0}^{x}h(s) {\text {d}}s\right) {\text {d}}x<\infty \), (for Neumann-Robin BCs);

  4. (iv)

    The nonlinear function \(\phi (x,y)\) satisfies the Lipschitz condition, \(|\phi (x,y)-\phi (x,y^{*})| \le L|y-y^{*}|\), where L is the Lipschitz constant.

Numerous scientific phenomenon in mathematical physics, astrophysics and chemistry are modeled using the BVPs of type (1.2) with \(g(x)=h(x)=x^2\). Such as equilibrium of gas sphere [21], oxygen tension in a spherical cell [22], sources of heat in the human head [23]. Several numerical techniques have been applied to approximate the numerical solution of the particular case of (1.2) such as finite difference method (FDM) [24,25,26], spline FDM [27], parametric spline method [28], cubic spline method [29], variational iteration method [30], Hermite functions collocation method [31], Adomian decomposition method (ADM) with inverse integral operator [32], Sinc-collocation method [33], Tau method [34], B-spline collocation method [35], Green’s function coupled with improved decomposition method [36], Hermite spline method [37], ADM with Green’s function [38,39,40,41], Laguerre wavelets collocation method [42], classical polynomial approximation method [43], modified variational iteration method [44], optimal homotopy analysis method (OHAM) [45, 46], Mickens’ type non-standard FDM [47], HAM with Green’s function [48, 49], homotopy perturbation method [50], Haar-wavelet collocation method (HWCM) [51, 52], neural networks-based integrated intelligent computing method [53], HWQM [54, 55], nonstandard finite difference technique [56], ADM with unequal step-size partitions method [57], and Bernstein collocation method [58, 59].

In recent years, the theory of wavelets has gained popularity among science and engineering fields, such as image processing, signal analysis, and numerical analysis. Wavelets have various beneficial properties such as simple applicability, orthogonality, and the exact representation of polynomials to a certain degree. One of the famous bases of wavelet analysis is the Chebyshev wavelet. Currently, the Chebyshev wavelet is becoming famous in numerical approximations because of its good accuracy. The use of Chebyshev wavelets for the numerical approximation of differential, integral, integro–differential, and variational problems can be seen in [60,61,62,63,64,65,66,67,68,69].

In this paper, a numerically efficient method based on the Chebyshev wavelets for the numerical approximation of BVPs (1.2) is provided. First, the concerned problems are converted into equivalent integral equations. The collocation technique based on Chebyshev wavelets is applied to obtain a system of nonlinear equations that is then solved by the Newton-Raphson method. The current method’s accuracy is tested by calculating the \(L_{\infty }\) and the \(L_{2}\)-norm errors of several numerical problems. There are various advantages of using Chebyshev wavelets coupled with the collocation technique. The main advantage is that high accurate approximate solutions are achieved using a few number of collocation points. Their application on Thomas-Fermi type equations can be seen from the numerical simulation Sect. 5, where several examples of Thomas-Fermi type equations have been solved significantly using the current method. The developed method provides more accurate results than piecewise constant orthogonal functions like Haar wavelets [55]. The Wavelet technique allows the creation of a high-speed algorithm when compared with algorithms ordinarily used. The limitation of the present method is that computation time increases and convergence of solution slows down with a larger value of N.

2 Review of Chebyshev wavelets

2.1 Wavelets and Chebyshev wavelets

The wavelets are defined as a group of continuous functions generated from dilation and translation of a basis wavelet called as the mother wavelet \(\psi (x) \) (see details [70,71,72]), given by

$$\begin{aligned} \psi _{c,d}(x)=\frac{1}{\sqrt{|c|}}\psi \Big (\frac{x-d}{c}\Big ),~~ c,~d \in {\mathbb {R}},~c\ne 0, \end{aligned}$$
(2.1)

where c is dilation parameter and d is translation parameter.

An orthogonal family of discrete wavelets can be constructed by discretization of parameters c and d as \(c=c_0^{-j}\), \(d=rd_0c_0^{-j}\) given by

$$\begin{aligned} \psi _{j,r}(x)=|c_0|^{-\frac{j}{2}}\psi (c_0^jx-rd_0), ~~~~c_0>1,d_0>1,~~~j, r \in {\mathbb {Z}}^+. \end{aligned}$$
(2.2)

Particularly, if \(c_0 = 2\) and \(d_0 = 1\), then Eq. (2.2) forms an orthonormal basis of \(L^{2}({\mathbb {R}})\).

We define the Chebyshev wavelets [61] on interval [0, 1] as

$$\begin{aligned} \psi _{n,m}(x)=\left\{ \begin{array}{ll} \displaystyle 2^{\frac{r}{2}}{\tilde{T}}_m(2^rx-2n+1),~~~&{} x \in \bigg [\frac{n-1}{2^{r-1}}, \frac{n}{2^{r-1}}\bigg ], \\ \displaystyle 0, &{} \text {elsewhere}, \end{array} \right. \end{aligned}$$
(2.3)

where \(n=1,2,\ldots ,2^{r-1}\), \(r=1,2, \ldots \), \(m=0,1,2,\ldots M-1\) and \({\tilde{T}}_m(x)\) is given by

$$\begin{aligned} {\tilde{T}}_m(x)=\left\{ \begin{array}{ll} \displaystyle \frac{1}{\sqrt{\pi }},~~~&{} m=0, \\ \displaystyle \sqrt{\frac{2}{\pi }}T_m(x), &{} \text {elsewhere}. \end{array} \right. \end{aligned}$$
(2.4)

Here \(T_m(x)\) are the Chebyshev polynomials [67] of order m given by:

$$\begin{aligned} \left\{ \begin{array}{ll} \displaystyle T_0(x)=1, \\ \displaystyle T_1(x)=x,\\ \displaystyle T_{m+1}(x)=2xT_m(x)-T_{m-1}(x),~~m=1,2, \ldots , M-1. \end{array} \right. \end{aligned}$$
(2.5)

It is noted that the Chebyshev polynomials are orthogonal with respect to the weight function \(w(x)=\frac{1}{\sqrt{1-x^2}}\) on the interval \([-1, 1]\). Also the Chebyshev wavelets are orthogonal with respect to the weight function \(w_n(x)=w(2^rx-2n+1)\) on the interval [0, 1].

2.2 Function approximation

Any function \(f(x) \in L^{2}[0,1]\) can be approximated by Chebyshev wavelets as

$$\begin{aligned} f(x)=\sum _{n=1}^{\infty }\sum _{m=0}^{\infty }a_{nm}\;\psi _{n,m}(x), \end{aligned}$$
(2.6)

where

$$\begin{aligned} a_{nm}=\big <f(x), \psi _{n,m}(x)\big >=\int _0^1 f(x) \psi _{n,m}(x)w_r(x) {\text {d}}x. \end{aligned}$$
(2.7)

For numerical purpose, we truncate the expansion (2.6) as

$$\begin{aligned} f(x)\approx \sum _{n=1}^{2^{r-1}}\sum _{m=0}^{M-1}a_{nm}\;\psi _{n,m}(x). \end{aligned}$$
(2.8)

We assume \(N=2^{r-1}M\) such that

$$\begin{aligned} f(x)\approx f_{N}(x)=\sum _{i=1}^{N}a_{i}\;\psi _{i}(x), \end{aligned}$$
(2.9)

where \(i = M(n - 1) + m + 1\) with \(n=1,2,\ldots ,2^{r-1}\) and \(m=0,1,2,\ldots M-1\).

We define the collocation points on the interval [0, 1] as

$$\begin{aligned} x_j=\frac{2j-1}{2^{r}M},~~~~~~~ j=1,2\ldots , N. \end{aligned}$$
(2.10)

3 Solution method

This section consists of the Chebyshev wavelet collocation method (CWCM), which is utilized in the generalized Thomas-Fermi BVPs of type (1.2). First, the generalized Thomas-Fermi BVP is converted into the equivalent integral equation. Then the CWCM combined with the Newton-Raphson method is used to find the numerical solution of Eq. (1.2).

3.1 Dirichlet-Robin boundary conditions

First, the integral form of (1.2) with Dirichlet-Robin boundary conditions is derived. Consider the following homogeneous equation

$$\begin{aligned} \left\{ \begin{array}{ll} \big (g(x)\ y'(x)\big )'= 0,~~~~~~x \in (0,1),\\ y(0)=\delta _4,~~\delta _1 y(1)+\delta _2 y'(1)=\delta _3. \end{array} \right. \end{aligned}$$
(3.1)

On solving Eq. (3.1), the unique solution is obtained as

$$\begin{aligned} y(x)=\delta _4+\frac{\delta _3-\delta _1 \;\delta _4}{\delta _1\; l(1)+\delta _2 \; \eta '(1)}\eta (x), \end{aligned}$$
(3.2)

where

$$\begin{aligned} \eta (x)= \int \limits _{0}^{x} \frac{{\text {d}}s}{g(s)},~~\eta (1)=\int \limits _{0}^{1}\frac{{\text {d}}s}{g(s)}, \hbox {and}~~~\eta '(1)=\frac{1}{g(1)} \end{aligned}$$

Next consider the following homogeneous BVP as

$$\begin{aligned} \left\{ \begin{array}{ll} \big (g(x)y'(x)\big )'= h(x)\phi \big (x,y(x)\big ),~x \in (0,1),\\ y(0)=0,~~~\delta _1 y(1)+\delta _2 y'(1)=0. \end{array} \right. \end{aligned}$$
(3.3)

Integrate (3.3) from x to 1, then from 0 to x, change the order of integration, and apply the homogeneous BCs to obtain

$$\begin{aligned} y(x)&= \int \limits _{0}^{x} \Big [\eta (s) - \frac{\delta _1 \;\eta (x)\;\eta (s)}{\delta _1 \;\eta (1)+\delta _2 \;\eta '(1)}\Big ] h(s)\phi (s,y(s)){\text {d}}s \nonumber \\&\quad + \int \limits _{x}^{1} \Big [\eta (x) - \frac{\delta _1 \;\eta (s)\;\eta (x)}{\delta _1\; \eta (1)+\delta _2 \;\eta '(1)}\Big ] h(s)\phi (s,y(s)){\text {d}}s. \end{aligned}$$
(3.4)

Using (3.2) and (3.4), the integral equation of (1.2) with Dirichlet-Robin BCs is given by

$$\begin{aligned} y(x)= \delta _4+\frac{\delta _3-\delta _1 \delta _4}{\delta _1 \eta (1)+\delta _2 \eta '(1)}\eta (x)+\int \limits _{0}^{1}{G(x,s)} h(s) \phi (s,y(s)){\text {d}}s, \end{aligned}$$
(3.5)

where

$$\begin{aligned} G(x,s)=\left\{ \begin{array}{ll} \displaystyle \eta (x) - \frac{\delta _1 \eta (s)\eta (x)}{\delta _1 \eta (1)+\delta _2 \eta '(1)}, &{} {x \le s},~~ \\ \displaystyle \eta (s) - \frac{\delta _1 \eta (x)\eta (s)}{\delta _1 \eta (1)+\delta _2 \eta '(1)}, &{} {s\le x}. \end{array} \right. \end{aligned}$$
(3.6)

In order to solve (3.5), set

$$\begin{aligned} z(x)=\phi \big (x,y(x)\big ). \end{aligned}$$
(3.7)

Approximate y(x) and z(x) by the Chebyshev wavelet approximation to achieve

$$\begin{aligned} y(x)&\approx y_{N}(x)= \sum _{i=1}^{N}a_{i}\;\psi _{i}(x), \end{aligned}$$
(3.8)
$$\begin{aligned} z(x)&\approx z_{N}(x) =\sum _{i=1}^{N}b_{i}\;\psi _{i}(x). \end{aligned}$$
(3.9)

Substitute the expressions \(y_{N}(x)\) and \( z_{N}(x)\) from Eqs. (3.8) and (3.9) into the integral equation (3.5) to get

$$\begin{aligned} \sum _{i=1}^{N}a_{i}\;\psi _{i}(x)&=\delta _4+\frac{\delta _3-\delta _1 \delta _4}{\delta _1\; \eta (1)+\delta _2 \;\eta '(1)}\eta (x)\nonumber \\&\quad +\sum _{i=1}^{N}b_{i}\int \limits _{0}^{1} G(x,s)\; h(s)\; \psi _{i}(s){\text {d}}s. \end{aligned}$$
(3.10)

Rewrite Eq. (3.10) as

$$\begin{aligned} \sum _{i=1}^{N}a_{i}\;\psi _{i}(x)=\delta _4+\frac{\delta _3-\delta _1 \delta _4}{\delta _1\; \eta (1)+\delta _2 \;\eta '(1)}\eta (x)+ \sum _{i=1}^{N}b_{i}K_{i}(x), \end{aligned}$$
(3.11)

where

$$\begin{aligned} K_{i}(x)=&\int \limits _{0}^{1} G(x,s)\; h(s)\; \psi _{i}(s){\text {d}}s. \end{aligned}$$
(3.12)

Again use the approximate values of y(x) and z(x) from (3.8) and (3.9) into Eq. (3.7) and obtain

$$\begin{aligned} \sum _{i=1}^{N}b_{i}\;\psi _{i}(x)=\phi \bigg (x, \sum _{i=1}^{N}a_{i}\;\psi _{i}(x) \bigg ). \end{aligned}$$
(3.13)

Applying (3.11), Eq. (3.13) becomes

$$\begin{aligned} \sum _{i=1}^{N}b_{i}\;\psi _{i}(x)&=\phi \bigg (x, \delta _4+\frac{\delta _3-\delta _1 \;\delta _4}{\delta _1\; \eta (1)+\delta _2 \;\eta '(1)}\eta (x)\nonumber \\&\quad +\sum _{i=1}^{N}b_{i}K_{i}(x) \bigg ). \end{aligned}$$
(3.14)

Using the collocation points \(x_j\) from Eq. (2.10) into the above expression, a \((N\times N)\) nonlinear system of equations is attained as

$$\begin{aligned} \sum _{i=1}^{N}b_{i}\;\psi _{i}(x_j)&=\phi \bigg (x_j, ~\delta _4\nonumber \\&\quad +\frac{\delta _3-\delta _1 \;\delta _4}{\delta _1\; \eta (1)+\delta _2 \;\eta '(1)}\eta (x_j)+\sum _{i=1}^{N}b_{i}K_{i}(x_j) \bigg ), \end{aligned}$$
(3.15)

where \(b_{i}\) are the unknowns. The Newton-Raphson iterative method is enforced to the nonlinear system (3.15) to find the numerical value of these unknowns which will be substituted in Eq. (3.11) to get the approximate solution of (3.5).

3.2 Neumann-Robin boundary conditions

Next the integral form of (1.2) with Neumann-Robin boundary conditions is derived. Consider the following homogeneous equation

$$\begin{aligned} \left\{ \begin{array}{ll} \big (g(x)y'(x)\big )'= 0,~~~~~~x \in (0,1),\\ y'(0)=0,~~\delta _1 y(1)+\delta _2 y'(1)=\delta _3. \end{array} \right. \end{aligned}$$
(3.16)

On solving the above equation, the unique solution is obtained as

$$\begin{aligned} y(x)=\frac{\delta _3}{\delta _1}. \end{aligned}$$
(3.17)

Consider the following homogeneous BVP as

$$\begin{aligned} \left\{ \begin{array}{ll} \big (g(x)y'(x)\big )'= h(x)\phi \big (x,y(x)\big ),~x \in (0,1),\\ ~y'(0)=0,~~\delta _1 y(1)+\delta _2 y'(1)=0. \end{array} \right. \end{aligned}$$
(3.18)

By integrating (3.18) from x to 1 and then from 0 to x and changing the order of integration and applying the homogeneous BCs, following integral equation is obtained as

$$\begin{aligned} y(x)&= \int \limits _{0}^{x} \Big ( \eta (1) -\eta (x)+ \displaystyle \frac{\delta _2}{\delta _1}\eta '(1)\Big ) h(s)\phi (s,y(s)){\text {d}}s \nonumber \\&\quad + \int \limits _{x}^{1} \Big (\eta (1) -\eta (s)+ \displaystyle \frac{\delta _2}{\delta _1}\eta '(1)\Big ) h(s)\phi (s,y(s)){\text {d}}s, \end{aligned}$$
(3.19)

where

$$\begin{aligned} \eta (x)= \int \limits _{0}^{x} \frac{1}{g(s)} {\text {d}}s, \eta (1)=\int \limits _{0}^{1}\frac{1}{g(s)}{\text {d}}s~~ \hbox {and} ~~\eta '(1)=\frac{1}{g(1)}. \end{aligned}$$

Applying (3.17) and (3.19), the equivalent integral equation of (1.2) with Neumann-Robin BCs is achieved

$$\begin{aligned} y(x)=\frac{\delta _3}{\delta _1}+\int \limits _{0}^{1}G(x,s)\; h(s) \;\phi \big (s, y(s)\big )\;{\text {d}}s, \end{aligned}$$
(3.20)

where

$$\begin{aligned} G(x,s)=\left\{ \begin{array}{ll} \eta (1) -\eta (s)+ \displaystyle \frac{\delta _2}{\delta _1}\eta '(1), &{} x \le s,\\ \eta (1) -\eta (x)+ \displaystyle \frac{\delta _2}{\delta _1}\eta '(1), &{} {s\le x}. \end{array} \right. \end{aligned}$$
(3.21)

To solve (3.20), assume that

$$\begin{aligned} z(x)=\phi \big (x,y(x)\big ). \end{aligned}$$
(3.22)

Substitute the expressions \(y_{N}(x)\) and \( z_{N}(x)\) from Eqs. (3.8) and (3.9) into the equivalent integral equation (3.20) to attain

$$\begin{aligned} \sum _{i=1}^{N}a_{i}\;\psi _{i}(x)=\frac{\delta _3}{\delta _1}+\sum _{i=1}^{N}b_{i}\int \limits _{0}^{1} G(x,s)\; h(s)\; \psi _{i}(s){\text {d}}s. \end{aligned}$$
(3.23)

Rewrite (3.23) as

$$\begin{aligned} \sum _{i=1}^{N}a_{i}\;\psi _{i}(x)=\frac{\delta _3}{\delta _1}+ \sum _{i=1}^{N}b_{i}K_{i}(x), \end{aligned}$$
(3.24)

where

$$\begin{aligned} K_{i}(x)=\int \limits _{0}^{1} G(x,s)\; h(s)\; \psi _{i}(s){\text {d}}s. \end{aligned}$$
(3.25)

Again use the approximate values of y(x) and z(x) from (3.8) to (3.9) into Eq. (3.22) to get

$$\begin{aligned} \sum _{i=1}^{N}b_{i}\;\psi _{i}(x)=\phi \bigg (x, \sum _{i=1}^{N}a_{i}\;\psi _{i}(x) \bigg ). \end{aligned}$$
(3.26)

Applying (3.24), Eq. (3.26) becomes

$$\begin{aligned} \sum _{i=1}^{N}b_{i}\;\psi _{i}(x)=\phi \bigg (x, \frac{\delta _3}{\delta _1}+\sum _{i=1}^{N}b_{i}K_{i}(x) \bigg ). \end{aligned}$$
(3.27)

Insert the collocation points \(x_j\) defined in Eq. (2.10) into expression (3.27) and obtain a \((N\times N)\) nonlinear system of equations as

$$\begin{aligned} \sum _{i=1}^{N}b_{i}\;\psi _{i}(x_j)-\phi \bigg (x_j, \frac{\delta _3}{\delta _1}+\sum _{i=1}^{N}b_{i}K_{i}(x_j) \bigg )=0, \end{aligned}$$
(3.28)

with the unknowns \(b_{i}\). Working out the nonlinear system (3.28) by the Newton-Raphson iterative method, the unknowns are found which will be inserted in equation (3.26) to achieve the approximate solution of (3.20).

Note The equation coefficients are such that the jacobian determinant of the nonlinear system of Eqs. (3.15) and (3.28) are nonsingular. Hence, Newton-Raphson method is convergent in this case [73].

4 Convergence and error analysis

In this section, we will discuss the convergence and error estimation of the Chebyshev wavelets collocation method for Thomas-Fermi type equations with boundary conditions.

In the next theorem, we provide the convergence analysis of the Chebyshev wavelets [61,62,63, 65, 67].

Theorem 4.1

If the Chebyshev wavelet expansion of any function \(f(x)\in L^2[0, 1]\) converges uniformly, then it converges to f(x).

Proof

We consider

$$\begin{aligned} g(x)=\sum _{n=1}^{\infty }\sum _{m=0}^{\infty }a_{nm}\;\psi _{n,m}(x), \end{aligned}$$
(4.1)

where \(a_{nm}=\big <f(x), \psi _{n,m}(x)\big >_{w_r}\), \(\psi _{n,m}(x)\) is the Chebyshev wavelet, and \(w_r(x)\) is the required weight function. Multiplying both sides of Eq. (4.1) by \(\psi _{p,k}(x)w_r(x)\) and integrating form 0 to 1, we obtain

$$\begin{aligned} \int _0^1 g(x)\psi _{p,k}(x)w_r(x){\text {d}}x&=\int _0^1 \sum _{n=1}^{\infty }\sum _{m=0}^{\infty }a_{nm}\;\psi _{n,m}(x)\psi _{p,k}(x)w_r(x){\text {d}}x\nonumber \\&= \sum _{n=1}^{\infty }\sum _{m=0}^{\infty }a_{nm}\int _0^1\psi _{n,m}(x)\psi _{p,k}(x)w_r(x){\text {d}}x =a_{pq}. \end{aligned}$$
(4.2)

Hence \(\big <g(x), \psi _{n,m}(x)\big >=a_{nm},~n=1,2,\ldots ,~~m=0,1,\ldots \). This shows that the Fourier expansions of f and g are same with Chebyshev wavelet basis. So, \(f(x)=g(x),~\forall ~ x \in [0,1]\). \(\square \)

In the next lemma, we compute the bound of the unknown coefficients of the Chebyshev wavelets expansion.

Lemma 4.1

Let \(f(x) \in C^2[0,1]\) with \(|f''(x)|\le \lambda \) and \(f(x)= \sum _{n=1}^{\infty }\sum _{m=0}^{\infty }a_{nm}\;\psi _{n,m}(x)\), then

$$\begin{aligned} |a_{nm}| \le \frac{\sqrt{2 \pi }\lambda }{(2n)^{\frac{5}{2}}(m^2-1)}. \end{aligned}$$
(4.3)

Proof

From the definition of \(a_{nm}\) given by Eq. (2.7), we have

$$\begin{aligned} a_{nm}&=\int _0^1 f(x) \psi _{n,m}(x)w_r(x) {\text {d}}x\nonumber \\&=\displaystyle \int _{\frac{(n-1)}{2^{r-1}}}^{\frac{n}{2^{r-1}}}2^{\frac{r}{2}}f(x){\mathbf {T}}_m(2^rx-2n+1)w(2^rx-2n+1){\text {d}}x. \end{aligned}$$
(4.4)

Assuming \(m>0\) and putting \(2^rx-2n+1=\cos {\theta }\) in the integral equation (4.4), we get

$$\begin{aligned} a_{nm}=\frac{1}{\sqrt{2^{r-1} \pi }}\int _0^\pi f \Big (\frac{\cos {\theta }+2n-1}{2^r}\Big )\cos {m\theta }{\text {d}}\theta . \end{aligned}$$
(4.5)

Applying integration by parts, we obtain

$$\begin{aligned} a_{nm}&=\frac{1}{\sqrt{2^{r-1} \pi }} f \Big (\frac{\cos {\theta }+2n-1}{2^r}\Big )\Big (\frac{\sin {m\theta }}{m}\Big )\Big |_0^\pi \nonumber \\&\quad +\frac{1}{m\ \sqrt{2^{3r-1} \pi }} \int _0^\pi f' \Big (\frac{\cos {\theta }+2n-1}{2^r}\Big )\sin {m\theta }\sin {\theta }{\text {d}}\theta \nonumber \\&=\frac{1}{m\ \sqrt{2^{3r+1} \pi }} f' \Big (\frac{\cos {\theta }+2n-1}{2^r}\Big )S_m(\theta )\Big |_0^\pi \nonumber \\&\quad + \frac{1}{m\sqrt{2^{5r+1}\pi }}\int _0^\pi f''\Big (\frac{\cos {\theta }+2n-1}{2^r}\Big )\sin {\theta }\ \ S_m(\theta ){\text {d}}\theta , \end{aligned}$$
(4.6)

where

$$\begin{aligned} S_m(\theta )=\frac{\sin (m-1)\theta }{m-1}-\frac{\sin (m+1)\theta }{m+1}. \end{aligned}$$
(4.7)

Applying modulus on both sides of Eq. (4.6), we have

$$\begin{aligned} |a_{nm}|&=\bigg |\frac{1}{m\sqrt{2^{5r+1}\pi }}\int _0^\pi f''\Big (\frac{\cos {\theta }+2n-1}{2^r}\Big )\sin {\theta }\ S_m(\theta ){\text {d}}\theta \bigg |. \end{aligned}$$
(4.8)

On simplification we obtain

$$\begin{aligned} |a_{nm}| \le \frac{\lambda }{m\sqrt{2^{5r+1}\pi }}\int _0^\pi \big |\sin {\theta }\ S_m(\theta )\big |{\text {d}}\theta . \end{aligned}$$
(4.9)

Again using the value of \(S_m(\theta )\) from Eqs. (4.7) in (4.8), we get

$$\begin{aligned} |a_{nm}|&=\frac{\lambda }{m\sqrt{2^{5r+1}\pi }}\int _0^\pi \bigg |\sin {\theta }\bigg (\frac{\sin (m-1)\theta }{m-1}-\frac{\sin (m+1)\theta }{m+1}\bigg )\bigg |{\text {d}}\theta \nonumber \\&\le \frac{\lambda }{m\sqrt{2^{5r+1}\pi }}\int _0^\pi \bigg |\sin {\theta }\bigg (\frac{\sin (m-1)\theta }{m-1}\bigg )\bigg |\nonumber \\&\quad +\bigg |\sin {\theta }\bigg (\frac{\sin (m+1)\theta }{m+1}\bigg )\bigg |{\text {d}}\theta \nonumber \\&\le \frac{2m\pi \lambda }{m(m^2-1)\sqrt{2^{5r+1}\pi }}\nonumber \\&= \frac{\sqrt{2\pi } \lambda }{2^{\frac{5r}{2}}(m^2-1)}. \end{aligned}$$
(4.10)

We have \(n\le 2^{r-1}\). Therefore

$$\begin{aligned} |a_{nm}|= \frac{\sqrt{2 \pi }\lambda }{(2n)^{\frac{5}{2}}(m^2-1)}. \end{aligned}$$
(4.11)

This shows that the wavelets expansion \(\displaystyle \sum\nolimits_{n=1}^{\infty }\sum\nolimits_{m=0}^{\infty }a_{nm}\;\psi _{n,m}(x)\) converges uniformly to f(x). \(\square \)

In the next theorem, we discuss the error analysis of the Chebyshev wavelets approximation.

Theorem 4.2

Assume that \(f(x) \in C^{(P)}[0,1]\) and \(A^T \psi (x)=\displaystyle \sum\nolimits_{n=1}^{2^{r-1}}\sum\nolimits_{m=0}^{M-1}a_{nm}\psi _{nm}\) be the Chebyshev wavelet approximation, then error bound is estimated as

$$\begin{aligned} \Big |f(x)-\sum\nolimits_{n=1}^{2^{r-1}}\sum\nolimits_{m=0}^{M-1}a_{nm}\psi _{nm}\Big | \le \frac{1}{ (P!) 2^{P(r-1)} }\max _{x \in [0, 1]}\big |f^{(P)}(x)\big |. \end{aligned}$$
(4.12)

Proof

We first divide the interval [0, 1] into subinterval \([\frac{n-1}{2^{r-1}},~~ \frac{n}{2^{r-1}}]\) on which the function f(x) is approximated. Assume that \(\displaystyle E_x=\Big |f(x)-\sum\nolimits_{n=1}^{2^{r-1}}\sum\nolimits_{m=0}^{M-1}a_{nm}\psi _{nm}\Big |\), then

$$\begin{aligned} \big \Vert E_x\Vert ^2&=\bigg \Vert f(x)-\sum _{n=1}^{2^{r-1}}\sum _{m=0}^{M-1}a_{nm}\psi _{nm}\bigg \Vert ^2=\big \Vert f(x)\nonumber \\&\quad -A^T \psi (x)\big \Vert ^2=\int _0^1 W(x)\big (f(x)-A^T \psi (x))^2{\text {d}}x\nonumber \\&=\sum _{n=1}^{2^{r-1}}\int _{\frac{(n-1)}{2^{r-1}}}^{\frac{n}{2^{r-1}}}W(x)\big (f(x)-A^T \psi (x))^2{\text {d}}x \nonumber \\&\le \sum _{n=1}^{2^{r-1}}\int _{\frac{(n-1)}{2^{r-1}}}^{\frac{n}{2^{r-1}}}W(x)\big (f(x)-G_P(x) \psi (x))^2{\text {d}}x, \end{aligned}$$
(4.13)

where \(G_P(x)\) is a polynomial of degree P that interpolates f(x) having the following error bound [62, 74],

$$\begin{aligned} \big |f(x)-G_P(x)| \le \frac{1}{ (P!) 2^{P(r-1)} }\max _{x_1 \in I}\big |f^{(P)}(x_1)\big |, \end{aligned}$$
(4.14)

where \(I=[\frac{n-1}{2^{r-1}},~ \frac{n}{2^{r-1}}]\). So, we have

$$\begin{aligned} \big \Vert E_x\Vert ^2&\le \sum _{n=1}^{2^{r-1}} \int _{\frac{n-1}{2^{r-1}}}^{\frac{n}{2^{r-1}}}W_n(x)\bigg (\frac{1}{ (P!) 2^{P(r-1)} }\max _{x_1 \in I}\big |f^{(P)}(x_1)\big |\bigg )^2{\text {d}}x\nonumber \\&\le \sum _{n=1}^{2^{r-1}} \int _{\frac{n-1}{2^{r-1}}}^{\frac{n}{2^{r-1}}}W_n(x)\bigg (\frac{1}{ (P!) 2^{P(r-1)} }\max _{x \in [0, 1]}\big |f^{(P)}(x)\big |\bigg )^2{\text {d}}x\nonumber \\&= \int _0^1 W_n(x)\bigg (\frac{1}{ (P!) 2^{P(r-1)} }\max _{x \in [0, 1]}\big |f^{(P)}(x)\big |\bigg )^2{\text {d}}x\nonumber \\&=\bigg \Vert \frac{1}{ (P!) 2^{P(r-1)} }\max _{x \in [0, 1]}\big |f^{(P)}(x)\big |\bigg \Vert ^2. \end{aligned}$$
(4.15)

Hence,

$$\begin{aligned} \Big |f(x)-\sum _{n=1}^{2^{r-1}}\sum _{m=0}^{M-1}a_{nm}\psi _{nm}\Big | \le \frac{1}{ (P!) 2^{P(r-1)} }\max _{x \in [0, 1]}\big |f^{(P)}(x)\big |. \end{aligned}$$
(4.16)

\(\square \)

In the following theorem, we establish the error bound of the Chebyshev wavelet collocation method for the Thomas-Fermi type Eq. (1.2) with boundary conditions.

Theorem 4.3

Let y and \(y_N\) be the exact and the approximate solution of of (3.5) or (3.20). Suppose that \(\phi (x,z)\) satisfies the Lipschitz condition \(|\phi (x,z)-\phi (x,z^{*})| \le L|z-z^{*}|,\) then the error bound for the LWCM is estimated as

$$\begin{aligned} \Vert y-y_N\Vert \le \frac{KL\vartheta }{ (P!) 2^{P(r-1)}}, \end{aligned}$$
(4.17)

where L is the Lipschitz constant and

$$\begin{aligned} \vartheta =\displaystyle \max _{x \in [0, 1]}|y^{(P)}(x)|. \end{aligned}$$
(4.18)

Proof

Consider

$$\begin{aligned} \Vert y-y_N\Vert ^2_{2}&= \int _{0}^{1}[y(x)-y_N(x)]^2{\text {d}}x\\&=\int _{0}^{1}\bigg [\int \limits _{0}^{1}G(x,s) \;h(s) \;\phi (s,y(s)){\text {d}}s-\int \limits _{0}^{1}G(x,s) \;h(s) \; \phi (s,y_N(s)){\text {d}}s\bigg ]^2{\text {d}}x\\&=\displaystyle \int _{0}^{1}\bigg [\int _{0}^{1}G(x,s)\;h(s)\;\big (\phi (s, y(s))\\&\quad -\phi (s, y_N(s))\big ) {\text {d}}s\bigg ]^2{\text {d}}x. \end{aligned}$$

Using the Schwarz’s inequality on inner integral, we have

$$\begin{aligned}&\Vert y-y_N\Vert ^2\le \displaystyle \int _{0}^{1} \bigg [\int _{0}^{1}\big [G(x,s)\;h(s)\big ]^2{\text {d}}s\bigg ]\\&\quad \bigg [\int _{0}^{1}\big [\big (\phi (s, y(s))-\phi (s, y_N(s))\big )\big ]^2 {\text {d}}s \bigg ]{\text {d}}x. \end{aligned}$$

Applying the Lipschitz condition, the above inequality becomes

$$\begin{aligned} \Vert y-y_N\Vert ^2&\le \displaystyle \int _{0}^{1} \bigg [\int _{0}^{1}L^2\big |y(s)-y_N(s)\big |^2 {\text {d}}s \bigg ]G_1(x){\text {d}}x\nonumber \\&=\displaystyle L^2 \int _{0}^{1} \bigg [\int _{0}^{1}\big |y(s)-y_N(s)\big |^2 {\text {d}}s \bigg ]G_1(x){\text {d}}x, \end{aligned}$$
(4.19)

where, \(G_1(x)=\int _{0}^{1}\big [G(x,s)\;h(s)\big ]^2{\text {d}}s\).

Using the result from Eq. (4.12), the error estimates (4.19) simplified as

$$\begin{aligned} \Vert y-y_N\Vert ^2 \le \displaystyle \bigg [\frac{(L\vartheta )^2}{(P!) 2^{P(r-1)}}\bigg ]\int _{0}^{1} G_1(x){\text {d}}x, \end{aligned}$$
(4.20)

where, \(\vartheta \) is given by (4.18).

Hence,

$$\begin{aligned} \Vert y-y_N\Vert \le \displaystyle \frac{L\vartheta }{ (P!) 2^{P(r-1)}}, \end{aligned}$$
(4.21)

where, \(K=\int _{0}^{1} G_1(x){\text {d}}x\). \(\square \)

5 Numerical simulation

This section will consider several numerical examples of the generalized Thomas-Fermi type equations with boundary conditions to examine the reliability and applicability of the present method. The numerical results of approximated solutions and absolute errors of all examples are computed and plotted using MATLAB programming. For comparison, we define the maximum absolute and the \(L_ {2} \)-norm errors as

$$\begin{aligned} L_{\infty }&=\max _{x \in [0,1]} |y(x)-y_{N}(x)|,\\ L_{2}&=\bigg (\sum _{i=1}^{R}|y(x_i)-y_{N}(x_i)|^2\bigg )^{1/2}, \end{aligned}$$

where y(x) is the exact solution and \(y_{N}(x)\) is the CWCM solution.

Problem 5.1

We first consider the generalized Thomas-Fermi type equation with Dirichlet BCs [48] as

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

The exact solution is \(y(x)=\ln \big (\frac{1}{x^l+4}\big )\). For \(k=0.5\) and \(l=1\), we see that at \(x=0\), \(g(0)=0\) and h(x) is not continuous. The numerical solution obtained by the present method is \(y_{N}(x)\), (\(N=1,2,\ldots , 2^{r-1}M\)\(r=1,2,3,\ldots \)) and that by the optimal homotopy analysis method (OHAM) [48] is \(\phi _{m}(x)\), (\(m=1,2,\ldots )\). The analytical solution y(x), the CWCM numerical solution \(y_{10}(x)\) and the OHAM solution \(\phi _{10}(x)\) (as given in [48]) of Problem 5.1, are shown in Table 1. In Table 2, we demonstrate the numerical results of the maximum absolute error, \(L_{\infty }\) and the \(L_2\)-norm error acquired by the current method. We illustrate the plot of the exact solution and the numerical solution evaluated by current method in Fig. 1a. Further, we provide the absolute errors: \(E_{N}(x)=|y(x)-y_{N}(x)|,\) for \(N=10,\) and \(e_{n}(x)=|y(x)-\phi _{m}(x)|,\) for \(m=10,\) obtained by the present method and OHAM respectively, in Fig. 1b. It is seen that the current technique is very fast and precise. An excellent approximation is obtained even for a small value of N. It can be seen that the numerical approximations computed using the CWCM overlap with the exact solution. One can notice that the CWCM exhibits less error than the OHAM.

Fig. 1
figure 1

Numerical results and absolute errors obtained by CWCM and OHAM [48] for Example 5.1

Table 1 Analytic and approximate solutions of Problem 5.1 for \(k=0.5\) and \(l=1\)
Table 2 Numerical result of \(L_{\infty }\) and \(L_2\)-norm errors of Problem 5.1 for \(k=0.5\) and \(l=1\)

Problem 5.2

We consider the generalized Thomas-Fermi type equation with Dirichlet BCs [48] as

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

The exact solution is \(y(x)=\ln \big (\frac{1}{x+2}\big )\). For \( k=0.25\), we see that at \(x=0\), \(g(0)=0\) and h(x) is not continuous. In Table 3, we provide the y(x), the CWCM numerical solution \(y_{10}(x)\) and the OHAM solution \(\phi _{10}(x)\) (as in [48]) of Problem 5.2. In Table 4, the numerical values of \(L_{\infty }\) and \(L_2\)-norm errors evaluated by the CWCM is shown. The plot of exact and numerical results is demonstrated in Figure 2(a). Moreover, the absolute errors calculated by the CWCM and the OHAM are illustrated in Figure 2(b). We conclude that the numerical results obtained by the present method are closer to the exact solution as compared to the OHAM. Also the absolute error computed by the CWCM is less than the OHAM. Also the numerical values of \(L_{\infty }\) and \(L_2\)-norm errors decrease rapidly with an increase in number of collocation point.

Fig. 2
figure 2

Numerical results and absolute errors obtained by CWCM and OHAM [48] for Example 5.2

Table 3 Analytic and approximate solutions of Problem 5.2 for \(k=0.25\)
Table 4 Numerical results of \(L_{\infty }\) and \(L_2\)-norm errors of Problem 5.2 for \(k=0.25\)

Problem 5.3

Consider the generalized Thomas-Fermi equation with Neumann-Dirichlet BCs [48] as

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

The exact solution is \(y(x)=\ln \big (\frac{1}{x^l+4}\big )\). For \(k=0.25\) and \(l=1.25\), we notice that at \(x=0\), \(g(0)=0\) and h(x) is not continuous. The CWCM solution \(y_{10}(x)\), the OHAM solution \(\phi _{10}(x)\) (as in [48]) and the exact solution y(x) of Problem 5.3 are shown in Table 5. We also exhibit the \(L_{\infty }\) and the \(L_2\)-norm errors derived from the CWCM in Table 6. The exact and numerical solutions obtained by the CWCM are compared in Fig. 3a. The absolute errors computed by the CWCM and the OHAM are given in Fig. 3b. We observe that the numerical results obtained by the present method overlap with the exact solution. The absolute error computed by the CWCM is less than the OHAM. We also demonstrate that as the number of collocation point increases, the numerical results of \(L_{\infty }\) and \(L_2\)-norm errors evaluated by present method decrease rapidly.

Fig. 3
figure 3

Numerical results and absolute errors obtained by CWCM and OHAM [48] for Example 5.3

Table 5 Analytic and approximate solutions of Problem 5.3 for \(k=0.25\) and \(l=1.25\)
Table 6 Numerical result of \(L_{\infty }\) and \(L_2\)-norm errors of Problem 5.3 for \(k=0.25\) and \(l=1.25\)

Problem 5.4

Consider the Thomas-Fermi equation [1, 2] with Dirichlet BCs as

$$\begin{aligned} \left\{ \begin{array}{ll} y''=x^{- \frac{1}{2}}y^{\frac{3}{2}},~x \in (0,1),\\ y(0)=1,~~y(1)=0. \end{array} \right. \end{aligned}$$
(5.4)

In Table 7, we compare the CWCM solution \(y_{N}(x)\), the Haar wavelet quasilinearization method (HWQM) solution \({\tilde{y}}_{N}(x)\) (\(N=2^{J+1},~J=1,2,\ldots \)) (as in [55]) and the ADM solution \(\psi _{m}(x)\) (as in [75]) of Problem 5.4. Further, we provide the residual errors: \(R_N=y_{N}''-x^{- \frac{1}{2}}y_{N}^{\frac{3}{2}}\), \(N=10\),   \({\tilde{r}}_N={\tilde{y}}_{N}''-x^{- \frac{1}{2}}{\tilde{y}}_{N}^{\frac{3}{2}}\), \(N=16\), and \(r_m=\psi _{m}''-x^{- \frac{1}{2}}\psi _{m}^{\frac{3}{2}}\), \(m=10\), obtained by the present method, the HWQM, and the ADM respectively, in Fig. 4a. We conclude that there is a correlation between the numerical solutions acquired by the CWCM and those in [55, 75]. Also the CWCM shows less residual error than the HWQM, and the ADM.

Fig. 4
figure 4

Comparison of residual errors obtained by LWCM, HWQM [55], ADM [75], and AADM [57] for Examples 5.4, Examples 5.5 and 5.6

Table 7 Analytic and approximate solutions of Problem 5.4

Problem 5.5

Consider the particular type of generalized Thomas-Fermi equation, arising in the distribution of the heat sources in the the human head [76] as

$$\begin{aligned} \left\{ \begin{array}{ll} \big (x^2 y'\big )'=-x^2e^{-y},~x \in (0,1),\\ y'(0)=0,~~2y(1)+y'(1)=0. \end{array} \right. \end{aligned}$$
(5.5)

The comparison of the CWCM solution \(y_{10}(x)\), the HWQM solution \({\tilde{y}}_{16}(x)\) (as in [55]) and the advanced Adomian decomposition method (AADM) solution \(\psi _{14}(x)\) (as in [57]) of Problem 5.5 is provided in Table 8. It can be observed that the obtained numerical results are correlated with those evaluated in [55, 57]. We demonstrate the residual errors obtained by the present method, the HWQM, and the AADM in Fig. 4b. We observe that the CWCM shows less residual error than the HWQM, and the AADM.

Table 8 Analytic and approximate solutions of Problem 5.5

Problem 5.6

Consider the particular type of generalized Thomas-Fermi equation, arising in oxygen diffusion in a spherical cell with oxygen uptake kinetics [22, 77] as

$$\begin{aligned} \left\{ \begin{array}{ll} \big (x^2 y' \big )'=x^2\frac{ 0.76129 \ y}{y+0.03119},~x \in (0,1),\\ y'(0)=0,~~5y(1)+y'(1)=5. \end{array} \right. \end{aligned}$$
(5.6)

Table 9 exhibits the comparison of the CWCM solution \(y_{10}(x)\), the HWQM solution \({\tilde{y}}_{16}(x)\) (as in [55]) and the AADM solution \(\psi _{12}(x)\) (as in [57]) of Problem 5.6. It can be seen that the approximate solutions obtained by the present method, the HWQM [55] and the AADM [57] are nearly close. Figure 4c illustrates the residual errors evaluated by the present method, the HWQM, and the AADM. It is concluded that the residual error obtained by the present method is minimum than those obtained by the HWQM, and the AADM.

Table 9 Analytic and approximate solutions of Problem 5.6

6 Conclusion

In this paper, the Chebyshev wavelets approach has been efficiently implemented for the numerical approximation of the generalized Thomas-Fermi BVPs, which arise in mathematical physics and astrophysics, such as oxygen concentration spherical cell [22] and heat conduction in the human head [23]. Firstly, we have converted the concerned problem into the equivalent integral equations. The collocation technique based on Chebyshev wavelets has been carried out to obtain a system of nonlinear equations that are then solved by the Newton-Raphson method. We have also discussed the convergence analysis and error bound for the Chebyshev wavelet collocation method under quite general conditions. The precision and efficiency of the current technique have been checked by computing the \(L_{\infty }\) and the \(L_{2}\)-norm errors of several numerical problems. The comparability of the numerical results with the results obtained by the other existing techniques has been demonstrated in Tables 1, 2, 3, 4, 5, 6, 7, 8 and 9. From tables, it has been seen that the exactness of the Chebyshev wavelet collocation technique is very high, even on account of few collocation points.