1 Introduction

Boundary value problems (BVPs) are extremely important in describing many realistic problems with various applications. The most famous of these are the problems associated with Dirichlet, Neumann, and Robin boundary conditions. The latter type is considered one of the most difficult conditions facing researchers when dealing with this type of problem. Because of the difficulty of Robin’s boundary conditions, research studies that discuss this type of BVP have not attracted much interest. The condition is named after the scientist Victor Gustav Robin, who was behind its origin [1]. It is also referred to as the “third kind” of boundary conditions, and these conditions are a linear mixture of the solution and its derivative at the boundary points. The present paper focuses on the numerical approach to solving second-order BVP associated with Robin boundary conditions. This type of BVP is given as follows:

$$\begin{aligned} y^{(2)}(x)=f(x,y,y^{\prime }),\quad a\le x\le b, \end{aligned}$$
(1.1)

subject to the Boundary Conditions

$$\begin{aligned} \alpha _{1}y(a)+\beta _{1}y^{(1)}(a)= & {} \gamma _1, \end{aligned}$$
(1.2)
$$\begin{aligned} \alpha _{2}y(b)+\beta _{2}y^{(1)}(b)= & {} \gamma _2, \end{aligned}$$
(1.3)

where \(\alpha _{1},\,\alpha _{2},\,\beta _{1},\,\beta _{2},\,\gamma _1\) and \(\gamma _2\) are all constants. In the case of Robin type, all of these constants on the left side of conditions (1.2) and (1.3) are non-zero. While in the case of Dirichlet type, we have \(\beta _{1}=\beta _{2}=0\), otherwise this BVP will be subject to Neumann condition when \(\alpha _{1}=\alpha _{2}=0\). Robin boundary conditions appear in many branches of applications, such as electromagnetic problems, where they are named impedance boundary conditions, and heat transfer problems, where they are named convective boundary conditions, as explained in [2]. Such conditions play an essential role in the study of diffusion equation occurring in biology and chemistry field [3].

Several numerical approaches have been developed and implemented to solve BVP (1.1)-(1.3). In this regard, these approaches include the Adomian decomposition method [4, 5], the Laplace transform-homotopy perturbation [6], the homotopy analysis method [7], the finite difference method [8, 9], Diagonal block method [10, 11], B-spline collocation method [12, 13], Cubic Hermite collocation method [14], Gegenbaur integration matrices [15] and the spectral method [16, 17].

The three popular versions of spectral methods are the collocation, tau, and Galerkin methods. They have important roles in obtaining numerical solutions for various mathematical models. These methods provide very accurate approximate solutions to various kinds of differential equations with a relatively small number of unknowns. The choice of the most convenient version of these methods is based on the type of the investigated differential equation and also on the kind of boundary conditions governed by it. In these methods, the use of operational matrices to build efficient algorithms to obtain accurate numerical solutions to various types of differential equations reduces the computational efforts.

The idea of an operational matrix of derivatives depends on the choice of convenient basis functions and expressing the first derivative of these in terms of their original ones (see for instance, [18,19,20,21,22,23,24]). In the Galerkin method, if the considered differential equation is subject to homogeneous initial and boundary conditions, the choice of basis functions must satisfy these conditions to ensure that the proposed approximate solution also satisfies these conditions. While in the case of nonhomogeneous conditions, the transformation process to the corresponding homogeneous form must be carried out first. In the collocation method, it is not necessary to choose the basis functions that satisfy the given conditions, but the best choice, as in the Galerkin method. In the tau method, the basis functions don’t satisfy the given conditions.

Up to now, and to the best of our knowledge, a Galerkin operational matrix using any basis function that satisfies the homogeneous Robin boundary conditions is not known and is traceless in the literature. This partially motivates our interest in such an operational matrix. Another motivation is the utilizing of this type of operational matrix for the numerical treatment of BVP (1.1)-(1.3).The principal aims of this paper can be summarized as follows:

  1. (i)

    Constructing a new class of basis polynomials, named Robin-Modified Chebyshev polynomials, using generalized shifted Chebyshev polynomials of the first kind that satisfy the homogeneous Robin boundary conditions.

  2. (ii)

    Establishing operational matrices for derivatives of the constructed polynomials.

  3. (iii)

    Constructing numerical algorithm for solving BVP (1.1)-(1.3) based on employing collocation method together with the introduced operational matrices of derivatives.

  4. (iv)

    Estimating the error obtained for the approximate solution.

The paper is organized as follows. In Sect. 2, the first-kind Chebyshev polynomials and their shifted ones are discussed. Section 3 is limited to constructing Robin-Modified Chebyshev polynomials of first-kind which satisfy the homogeneous Robin boundary conditions. Section 4 is limited to developing a new operational matrix of modified first-kind Chebyshev polynomials’ derivatives to handle BVP (1.1)-(1.3). The use of collocation method to solve numerical approach for BVP (1.1)-(1.3) is examined in Sect. 5. The theoretical convergence and error estimates are discussed in Sect. 6. Section 7 contains seven examples, as well as comparisons with several other methods from the literature. Finally, Sect. 8 displays some conclusions.

2 An Overview on First-Kind Chebyshev Polynomials and Their Shifted Ones

The orthogonal Chebyshev polynomials of the first kind \(T_{n}(x)\) have the following trigonometric definition (see, [25])

$$\begin{aligned} T_{n}(t)=\cos (n\,\cos ^{-1}t),\quad t\in [-1,1], \end{aligned}$$
(2.1)

and they are satisfying the orthogonality relation

$$\begin{aligned} \int _{-1}^{1}\dfrac{1}{\sqrt{1-t^{2}}}\ T_{m}(t)\, T_{n}(t)\, dt ={\left\{ \begin{array}{ll}0,\quad m\not =n,\\ \dfrac{\pi }{2},\quad m=n\not =0,\\ \pi ,\quad m=n=0.\end{array}\right. } \end{aligned}$$

These polynomials can be built by using the following recurrence relation

$$\begin{aligned} T_{n}(t)=2t\,T_{n-1}(t)-T_{n-2}(t),\,\,n\ge 2, \end{aligned}$$

with \(T_{0}(t)=1,\,\,T_{1}(t)=t.\) The polynomials \(T_{n}(t)\) are special ones of the Jacobi polynomials, \(P^{(\alpha ,\beta )}_{n}(t),\, (\alpha ,\beta >-1)\). More definitely, we have

$$\begin{aligned} T_{n}(t)=\dfrac{n!}{(1/2)_{n}}\, P^{\left(-\frac{1}{2},-\frac{1}{2}\right)}_{n}(t), \end{aligned}$$
(2.2)

where \((a)_{n}=\Gamma (a+n)/\Gamma (a)\) is the Pochhammer’s Symbol.

We defined the so-called shifted Chebyshev polynomials by introducing the change of variable \(t=\frac{2x-a-b}{b-a}\). Let the shifted Chebyshev polynomials \(T_{n}(\frac{2x-a-b}{b-a})\) be denoted by \(T^*_{n}(x;a,b)\), then

$$\begin{aligned} T^*_{n}(x;a,b)=\cos \left( n\,\cos ^{-1}\left( \displaystyle \frac{2\, x-a-b}{b-a}\right) \right) ,\quad x\in [a,b]. \end{aligned}$$
(2.3)

In this respect, the orthogonality relation for the modified Chebyshev polynomials is

$$\begin{aligned} \int _{a}^{b}w(x)\ T^*_{m}(x;a,b)\, T^*_{n}(x;a,b)\, dx ={\left\{ \begin{array}{ll}0,\quad m\not =n,\\ \frac{\pi }{2},\quad m=n\not =0,\\ \pi ,\quad m=n=0,\end{array}\right. } \end{aligned}$$

where \(w(x)=\dfrac{1}{\sqrt{(b-x)(x-a)}}\).

Lemma 2.1

The power form representation of the modified Chebyshev polynomials can be represented as

$$\begin{aligned} T^{*}_{n}(x;a,b)=\displaystyle \sum _{k=0}^{n} \dfrac{T^{*(k)}_{n}(0;a,b)}{k!}x^k, \end{aligned}$$
(2.4)

where

$$\begin{aligned} T^{*(q)}_{n}(0;a,b)=\frac{n (-1)^{n-q}q! (n+q-1)! \left( \frac{4}{b-a}\right) ^q }{(2 q)! (n-q)!}\,_{2}F_{1}\left( \begin{array}{c} q-n,\,n+q \\ q+\frac{1}{2} \end{array} \Big |\frac{a}{a-b}\right) . \end{aligned}$$
(2.5)

Proof

The analytical form of known shifted Chebyshev polynomials of first kind \(T^{*}_n(x;0,1)\) is given by

$$\begin{aligned} T_{n}(x;0,1)=n\,\sum \limits _{k=0}^{n}\frac{ (-1)^{n-k} (n+k-1)!4^{k}}{(2k)!(n-k)!}\,x^{k},\qquad x\in [0,1]. \end{aligned}$$
(2.6)

The analytical expression of \(T^{*}_{n}(x;a,b)\) can be written in the form

$$\begin{aligned}{} & {} T^{*}_{n}(x;a,b)=T^{*}_{n}(\frac{x-a}{b-a};0,1)=n\,\sum \limits _{k=0}^{n}\frac{ (-1)^{n-k} (n+k-1)!2^{2k}}{(2k)!(n-k)!}\,\left( \frac{x-a}{b-a}\right) ^{k},\nonumber \\{} & {} \qquad x\in [a,b]. \end{aligned}$$
(2.7)

Substituting the relation

$$\begin{aligned} (x-a)^{k}=\sum \limits _{i=0}^{k}\left( {\begin{array}{c}k\\ i\end{array}}\right) (-a)^{k-i}\,x^{k}, \end{aligned}$$

to Eq.(2.7), expanding and collecting similar terms - and after some rather manipulation - we can deduce that \(T^{*(q)}_{n}(0;a,b), q\le n,\) has the form (2.5) and this completes the proof of Lemma 2.1. \(\square \)

As a direct consequence of Lemma 2.1, we get the known analytic form of the shifted Chebyshev polynomials:

$$\begin{aligned} T^{*}_{n}(x;0,L)=n\,\sum \limits _{k=0}^{n}\frac{ (-1)^{n-k} (n+k-1)!4^{k}}{(2k)!(n-k)!L^{k}}\,x^{k},\qquad x\in [0,L]. \end{aligned}$$
(2.8)

Note 2.1

Here, it is important to remember that the generalized hypergeometric function is defined as [26]

$$\begin{aligned} _{p}F_{q}\left( \begin{array}{c}a_1,a_2,...,a_p \\ b_1,b_2,...,b_q\end{array}\Big |z\right) =\sum \limits _{k=0}^{\infty }\frac{(a_1)_k...(a_p)_k\,z^k}{(b_1)_k...(b_q)_k\,k!}, \end{aligned}$$

where \(b_j\ne 0\), for all \(1\le j\le q\).

3 Robin-Modified Chebyshev Polynomials of First-Kind

In this section, a novel kind of polynomials, it will symbol with \(\phi _{k}(x)\), will be developed, which we call “Robin-Modified Chebyshev polynomials of first-kind” in order to satisfy given form of Homogeneous Robin Boundary Conditions:

$$\begin{aligned} \alpha _{1}\phi _{k}(a)+\beta _{1}\phi _{k}^{(1)}(a)= & {} 0, \end{aligned}$$
(3.1)
$$\begin{aligned} \alpha _{2}\phi _{k}(b)+\beta _{2}\phi _{k}^{(1)}(b)= & {} 0. \end{aligned}$$
(3.2)

In this respect, we propose Robin-Modified Chebyshev polynomials of first-kind in the form

$$\begin{aligned} \phi _{k}(x)= q_{k}(x)T^{*}_{k}(x;a,b),\,\,\, k=0,1,2,\dots , \end{aligned}$$
(3.3)

where \(q_{k}(x)\) has the form

$$\begin{aligned} q_{k}(x)=x^{2}+A_{k}x+B_{k}, \end{aligned}$$

where \(A_{k}\) and \(B_{k}\) are unique constants such that \(\phi _{k}(x)\) satisfy the two conditions (3.1) and (3.2). Substitution of \(\phi _{k}(x)\) into (3.1) and (3.2) leads to the two linear equations in the two unknowns \(A_{k}\) and \(B_{k}\):

$$\begin{aligned}{} & {} \alpha _{1}(a^{2}+A_{k}a+B_{k})T^{*}_{k}(a;a,b)+\beta _{1}((2a+A_{k})T^{*}_{k}(a;a,b)\nonumber \\{} & {} \quad +(a^{2}+A_{k}a+B_{k})T^{*(1)}_{k}(a;a,b))=0, \end{aligned}$$
(3.4)
$$\begin{aligned}{} & {} \quad \alpha _{2}(b^{2}+A_{k}b+B_{k})T^{*}_{k}(b;a,b)+\beta _{2}((2b+A_{k})T^{*}_{k}(b;a,b)\nonumber \\{} & {} \quad +(b^{2}+A_{k}b+B_{k})T^{*(1)}_{k}(b;a,b))=0, \end{aligned}$$
(3.5)

which immediately gives

$$\begin{aligned} \left. \begin{array}{l} \begin{aligned} &{}A_{k}=\frac{-1}{\nu }\left( 2 \beta _1 \left( \alpha _2 L \left( a+k^2 r\right) +2 \beta _2 \left( k^2+1\right) k^2 r\right) -\alpha _1 L \left( 2 \beta _2 \left( b+k^2 r\right) +\alpha _2 L r\right) \right) ,\\ &{}B_{k}=\frac{1}{\nu }\left( \beta _2 \left( a \alpha _1 L \left( a-2 b \left( k^2+1\right) \right) +2 \beta _1 \left( k^2+1\right) \left( L^2-2 a b k^2\right) \right) -\alpha _2 b L \left( \beta _1 \left( b-2 a \left( k^2+1\right) \right) +a \alpha _1 L\right) \right) , \end{aligned} \end{array}\right\} \end{aligned}$$
(3.6)

where \(L=b-a,\,r=b+a\) and \(\nu =\alpha _1\, \alpha _2 L^2-4 \beta _1\, \beta _2 \left( k^2+1\right) \, k^2-\left( 2 k^2+1\right) L (\alpha _ 2\,\beta _1-\alpha _1\, \beta _2)\ne 0\).In particular, and for the special case, homogeneous Dirichlet conditions can be obtained by taking \(\alpha _1=\alpha _2 =1\) and \(\beta _{1}=\beta _{2}=0\). In such case, we have

$$\begin{aligned} \phi _{k}(x)=(x^{2}-(a+b)x+ab)T^{*}_{k}(x;a,b),\, k=0,1,2,\dots . \end{aligned}$$
(3.7)

Also, homogeneous Neumann conditions can be considered as a special case of a Robin-type conditions (3.1) and (3.2), by taking \(\alpha _{1}=\alpha _{2}=0,\,\beta _{1}=\beta _{2}=1\), which immediately gives

$$\begin{aligned} \begin{aligned}&\phi _{k}(x)=(x^{2}-(a+b)x-\frac{1}{2 k^2}(a^2-2 a b \left( k^2+1\right) +b^2))T^{*}_{k}(x;a,b),\\&\quad k=1,2,\dots , \end{aligned} \end{aligned}$$
(3.8)

The proposed Robin-Modified Chebyshev polynomials of first-kind have the special values

$$\begin{aligned}{} & {} \phi ^{(q)}_{k}(0)=B_{k}\,T^{*(q)}_{k}(0;a,b)+\,q\,A_{k}\,T^{*(q-1)}_{k}(0;a,b)\nonumber \\{} & {} +\,q(q-1)\,T^{*(q-2)}_{k}(0;a,b),\qquad 1\le q \le k+2. \end{aligned}$$
(3.9)

4 Operational Matrix of Derivatives of Robin-Modified Chebyshev Polynomials of First-Kind

In this section, we will construct the operational matrix of derivatives of Robin-Modified Chebyshev polynomials of first-kind \(\phi _{n}(x),\,n=0,1,2,\dots \). To do that, we need to extract the first derivative of \(\phi _{n}(x)\) in terms of these polynomials themselves. First, we can see that

\(D\phi _{0}(x)=2x+A_{0}\),

\(D\phi _{1}(x)=\dfrac{1}{L}(6\phi _{0}(x)-\left( (a+b)A_{1}+6 B_{0}-2 B_{1}\right) -2\left( a+b+3 A_{0}-2 A_{1}\right) x)\). This leads us to state and prove the main theorem, by which a novel Galerkin operational matrix of derivatives will be introduced.

Theorem 4.1

The first derivative of \(\phi _{n}(x)\) for all \(n\ge 0\), can be written in the form

$$\begin{aligned} D\phi _{n}(x)=\sum _{j=0}^{n-1}a_{j}(n)\phi _{j}(x)+ \epsilon _{n}(x),\,\,\epsilon _{n}(x)=e_{1}(n)x+e_{0}(n), \end{aligned}$$
(4.1)

where the expansion coefficients \(a_{0}(n),\,a_{1}(n)\,\dots ,a_{n-1}(n)\), are the solution of the system

$$\begin{aligned} \textbf{G}_{n}{} \textbf{a}_{n}=\textbf{B}_{n}, \end{aligned}$$
(4.2)

where \(\textbf{a}_{n}=[a_{0}(n),\,a_{1}(n),\,\dots ,a_{n-1}(n)]^{T}\), \(\textbf{G}_{n}=(g_{i,j}(n))_{0\le i,j\le n-1}\), and \(\textbf{B}_{n}=[b_{0}(n),\,b_{1}(n),\,\dots ,b_{n-1}(n)]^{T}\). The elements of \(\textbf{G}_{n}\) and \(\textbf{B}_{n}\) are defined as follows:

$$\begin{aligned} g_{i,j}(n)={\left\{ \begin{array}{ll} \phi ^{(n-i+1)}_{n-j-1}(0)&{}\quad i\ge j,\\ 0,&{} \text {otherwise,} \end{array}\right. },\qquad b_{i}(n)=\phi ^{(n-i+2)}_{n}(0). \end{aligned}$$

And the two coefficients \(e_{0}(n)\) and \(e_{1}(n)\) have the form:

$$\begin{aligned} \left. \begin{array}{ll} &{}e_{0}(n)=\phi ^{(1)}_{n}(0)-\sum _{j=0}^{n-1}a_{j}(n)\phi _{j}(0),\\ &{}e_{1}(n)=\phi ^{(2)}_{n}(0)-\sum _{j=0}^{n-1}a_{j}(n)\phi ^{(1)}_{j}(0). \end{array}\right\} \end{aligned}$$
(4.3)

Proof

It is not difficult to show that the two coefficients \(e_{0}(n)\) and \(e_{1}(n)\) has the form (4.3). So the expansion (4.1) can be written in the form

$$\begin{aligned} D\phi _{n}(x)-\phi ^{(1)}_{n}(0)-\phi ^{(2)}_{n}(0)x=\sum _{j=0}^{n-1}a^{}_{j}(n)\left( \phi _{j}(x)-\phi _{j}(0)-\phi ^{(1)}_{j}(0)x\right) ,\,n=1,2,\dots . \end{aligned}$$
(4.4)

Using the two formulae of Maclaurin series for \(\phi _{j}(x)\) and \(D\phi _{n}(x)\), with taking into consideration that they are two polynomials of degree \((j+2)\) and \((n+1)\), respectively, Eq.(4.4) can be written as,

$$\begin{aligned}{} & {} \sum _{r=2}^{n+1}\frac{\phi ^{(r+1)}_{n}(0)}{r!}x^r=\sum _{j=0}^{n-1}a_{j}(n)\left( \sum _{r=2}^{j+2}\frac{\phi ^{(r)}_{j}(0)}{r!}x^r\right) \nonumber \\{} & {} =\sum _{r=2}^{n+1}\left( \sum _{j=r}^{n+1}\frac{\phi ^{(r)}_{j-2}(0)}{r!}a_{j-2}(n)\right) x^r,\,n=1,2,\dots . \end{aligned}$$
(4.5)

This gives the following triangle system of n equations in the unknown expansion coefficients \(a_{0}(n),\,a_{1}(n)\,\dots ,a_{n-1}(n)\),

$$\begin{aligned} \sum _{j=r}^{n+1}\phi ^{(r)}_{j-2}(0)\,a_{j-2}(n)= \phi ^{(r+1)}_{n}(0),\,r=n+1,n,\dots ,2, \end{aligned}$$
(4.6)

which can be written in the matrix form (4.2) and this completes the proof of Theorem 4.1. \(\square \)

Now, we have reached the main desired result in this section, that is the operational matrix of derivatives of

$$\begin{aligned} {{\varvec{\Phi }}}(x)=[\phi _{0}(x),\phi _{1}(x),\dots , \phi _{N}(x)]^{T}, \end{aligned}$$
(4.7)

which is given in the following corollary as a direct consequence of Theorem 4.1.

Corollary 4.1

The mth derivative of the vector \({\varvec{\Phi }}(x)\) has the form:

$$\begin{aligned} \frac{d^{m}{\varvec{\Phi }}(x)}{dx^{m}}= H^{m}{\varvec{\Phi }}(x)+{\varvec{\eta }}^{(m)}(x), \end{aligned}$$
(4.8)

with \({\varvec{\eta }}^{(m)}(x)=\sum \limits _{k=0}^{m-1}H^{k}\,{\varvec{\epsilon }}^{(m-k-1)}(x)\), where \({{\varvec{\epsilon }}}(x)=\left[ \epsilon _{0}(x),\epsilon _{1}(x),\dots ,\epsilon _{N}(x)\right] ^T and \ H=\big (h_{i,j}\big )_{0\le i,j\le N}\),

$$\begin{aligned} h_{i,j}={\left\{ \begin{array}{ll} a_{j}(i),&{}\quad i> j,\\ 0,&{} \text {otherwise.} \end{array}\right. } \end{aligned}$$

For instance, if \(N=6, a = 0,b = 1,\,\alpha _{1}=\alpha _{2}=\beta _{1}=\beta _{2}=1,\,\gamma _{1}=\gamma _{2}=0\), we get

$$\begin{aligned} H=\left( \begin{array}{ccccccc} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 \\ 6 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 \\ -\frac{4720}{553} &{} 16 &{} 0 &{} 0 &{} 0 &{} 0 &{} 0 \\ \frac{6721838}{198527} &{} -\frac{47328}{28361} &{} 20 &{} 0 &{} 0 &{} 0 &{} 0 \\ -\frac{6788639584}{215798849} &{} \frac{1646996888}{30828407} &{} -\frac{151264}{390233} &{} 24 &{} 0 &{} 0 &{} 0 \\ \frac{50439810746450}{560861208551} &{} -\frac{456048063168}{80123029793} &{} \frac{52347076116}{1014215567} &{} -\frac{373472}{2825113} &{} 28 &{} 0 &{} 0 \\ -\frac{207341477961232208}{2987707657951177} &{} \frac{49418658528697792}{426815379707311} &{} -\frac{7275402570432}{5402726325409} &{} \frac{796262849104}{15049376951} &{} -\frac{111648}{1977839} &{} 32 &{} 0 \\ \end{array} \right) _{7\times 7}. \end{aligned}$$
(4.9)

5 A Collocation Algorithm for Handling Second-Order Differential Equation Subject to Robin Boundary Conditions

In this section, we utilize the operational matrix derived in Corollary 4.1 to get numerical solutions for the second-order BVP (1.1)-(1.3).

5.1 Homogeneous Boundary Conditions

Suppose that the boundary conditions (1.2) and (1.3) are homogeneous, that is, \(\gamma _1=\gamma _2=0\). We can consider an approximate solution to y(x) in the form

$$\begin{aligned} y(x)\simeq y_{N}(x)=\displaystyle \sum _{i=0}^{N}c_{i}\, \phi _{i}(x)={{\varvec{A}}}^T\,{{\varvec{\Phi }}}(x), \end{aligned}$$
(5.1)

where \({{\varvec{A}}}=\left[ c_0, c_1,\dots ,c_N\right] ^T.\)

Corollary 4.1 enables us to approximate the derivatives \(y^{(m)}(x),\,m=1,2\) in matrix form:

$$\begin{aligned} y^{(m)}_{N}(x)={{\varvec{A}}}^T\,H^m\,{{\varvec{\Phi }}}(x)+{\varvec{\eta }}^{(m)}(x). \end{aligned}$$
(5.2)

In this method, using the approximations (5.1) and (5.2) allow one to write the residual of equation (1.1) as

$$\begin{aligned} R_{N}(x)={{\varvec{A}}}^T\,H^2\,{{\varvec{\Phi }}}(x)+{\varvec{\eta }}^{(2)}(x)-f(x,\,{{\varvec{A}}}^T\,{{\varvec{\Phi }}}(x),\,{{\varvec{A}}}^T\,H\,{{\varvec{\Phi }}}(x)+{{\varvec{\epsilon }}}(x)). \end{aligned}$$
(5.3)

To obtain the numerical solution of the equation (1.1) subject to the two conditions (1.2) and (1.3) (with \(\gamma _1=\gamma _2=0\)), a spectral approach is suggested in the current section: the Robin shifted Chebyshev first-kind collocation operational matrix method RSC1COMM. The collocation points are the \((N+1)\) zeros of \(T^{*}_{N+1}(x)\),

$$\begin{aligned} x_{i}=\frac{1}{2} \left( (b-a) \cos \left( \frac{\pi \left( i+\frac{1}{2}\right) }{N+1}\right) +a+b\right) ,\, i=0,1,\dots ,N,\end{aligned}$$

so we have

$$\begin{aligned} R_{N}(x_{i})=0,\quad i=0,1,...,N, \end{aligned}$$
(5.4)

then the unknown coefficients \(c_i\,(i=0,1,...,N)\) can be obtained by solving \((N+1)\) linear or nonlinear algebraic equations (5.4) using any suitable solver.

5.2 Nonhomogeneous Boundary Conditions

An important step in constructing the suggested algorithm is converting the equation (1.1) with respect to non-homogeneous Robin conditions (1.2) and (1.3) into the corresponding homogeneous conditions. To do that, we use the following transformation:

$$\begin{aligned} {\bar{y}}(x)=y(x)-\lambda \,x-\mu , \end{aligned}$$
(5.5)

where \(\lambda = \frac{1}{\triangle }(\alpha _2 \gamma _1-\alpha _1 \gamma _2)\)\(\mu =\frac{1}{\triangle }(\gamma _2 \left( a \alpha _1+\beta _1\right) -\gamma _1 \left( \alpha _2 b+\beta _2\right) )\), \(\triangle =\alpha _2 \left( \alpha _1 (a-b)+\beta _1\right) -\alpha _1 \beta _2\ne 0\).

Hence it suffices to solve the following modified equation

$$\begin{aligned} {\bar{y}}(x)={\bar{f}}(x,{\bar{y}},{\bar{y}}^{\prime }),\quad a\le x\le b, \end{aligned}$$
(5.6)

subject to the homogeneous Robin conditions

$$\begin{aligned} \alpha _{1}{\bar{y}}(a)+\beta _{1}{\bar{y}}^{(1)}(a)= 0, \end{aligned}$$
(5.7)
$$\begin{aligned} \alpha _{2}{\bar{y}}(b)+\beta _{2}{\bar{y}}^{(1)}(b)= 0. \end{aligned}$$
(5.8)

Then

$$\begin{aligned} y_{N}(x)={\bar{y}}_{N}(x)+\lambda x+\mu . \end{aligned}$$
(5.9)

6 Convergence and Error Estimates For RSC1COMM

In this section, the convergence and error estimates of the suggested approach are examined. For a positive integer N, consider the space \(S_N\) defined by

$$\begin{aligned} S_N=Span\{\phi _{0}(x), \phi _{1}(x),...,\phi _{N}(x)\}. \end{aligned}$$

Additionally, the error between y(x) and its approximation \(y_N(x)\) is defined by

$$\begin{aligned} E_{N}(x)=\left| y(x)-y_{N}(x)\right| . \end{aligned}$$
(6.1)

In the paper, the error of the numerical scheme is analyzed by using:

The \(L_{2}\) norm error estimate,

$$\begin{aligned} \Vert E_{N}\Vert _{2}=\Vert y-y_{N}\Vert _{2}=\left( \int _{a}^{b} |y(x)-y_{N}(x)|^{2}\,dx\right) ^{1/2}, \end{aligned}$$
(6.2)

and the \(L_{\infty }\) norm error estimate,

$$\begin{aligned} \Vert E_{N}\Vert _{\infty }=\Vert y-y_{N}\Vert _{\infty }=\underset{a\le x \le b}{max}|y(x)-y_{N}(x)|. \end{aligned}$$
(6.3)

The proof of the following theorem is similar to the proofs of theorems presented in the research papers [27, Theorem 2], [28, Theorem 2], [29, Theorem 1], [30, Theorem 4.3], [31, Theorem 2] and [32, Theorem 3.3] to confirm that the error converges to zero by increasing N.

Theorem 6.1

Assume that \(y^{(i)}(x)\in C[a,b],\,i=0,1,...,N+1,\) with \(|y^{(N+1)}(x)|\le M, \forall x\in [a,b]\). Suppose that \(y_{N}(x)\) has the form (5.1) and represents the best possible approximation for y(x) out of \(S_{N}\). Then, the following estimates for the error \(E_{N}(x)\) are valid:

$$\begin{aligned} \Vert E_{N}\Vert _{\infty }\le \frac{M\,L^{N+1}}{(N+1)!}, \end{aligned}$$
(6.4)

and

$$\begin{aligned} \Vert E_{N}\Vert _{2}\le \frac{M}{(N+1)!}\frac{L^{(N+1)+1/2}}{(2N+3)^{1/2}}. \end{aligned}$$
(6.5)

Proof

The function y(x) can be stated in the power series form:

$$\begin{aligned} y(x)=Y_{N}(x)+R_{N}(x), \forall x \in [a,b], \end{aligned}$$
(6.6)

where

$$\begin{aligned}{} Y_{N}(x)& {}=\sum _{j=0}^{N}\frac{y^{(j)}(a)}{j!}\,(x-a)^{j}\qquad \\{} and \qquad R_{N}(x)& {} =\frac{y^{(N+1)}(\zeta (x))}{(N+1)!}\,(x-a)^{N+1},\,\,\zeta (x)\in [a,b]. \end{aligned}$$

Additionally, we have

$$\begin{aligned} |y(x)-Y_{N}(x)|=|R_{N}(x)|\le \frac{M\,(x-a)^{N+1}}{(N+1)!},\,\, \forall x \in [a,b], \end{aligned}$$
(6.7)

then we can deduce the following two inequalities:

$$\begin{aligned} \Vert y-Y_{N}\Vert _{\infty }=\Vert R_{N}\Vert _{\infty }\le \frac{M\,L^{N+1}}{(N+1)!}, \end{aligned}$$
(6.8)

and

$$\begin{aligned} \Vert y-Y_{N}\Vert ^{2}_{2}=\int _{a}^{b} |y(x)-Y_{N}(x)|^{2}\,dx\le \left( \frac{M}{(N+1)!}\right) ^{2}\frac{L^{2(N+1)+1}}{(2(N+1)+1)}. \end{aligned}$$
(6.9)

Since the approximate solution \(y_{N}(x)\in S_{N}\) represents the best possible approximation to y(x), we have, as a result,

$$\begin{aligned} \Vert y-y_{N}\Vert _{\infty }\le \Vert y-f\Vert _{\infty }, \forall f\in S_{N}, \end{aligned}$$
(6.10)

and

$$\begin{aligned} \Vert y-y_{N}\Vert _2\le \Vert y-f\Vert _2, \forall f\in S_{N}. \end{aligned}$$
(6.11)

Employing in particular \(f(x)= Y_{N}(x)\) in the previous two inequalities (6.10) and (6.11) leads to the two estimates:

$$\begin{aligned} \Vert E_{N}\Vert _{\infty }\le \Vert y-Y_{N}\Vert _{\infty }\le \frac{M\,L^{N+1}}{(N+1)!}, \end{aligned}$$
(6.12)

and

$$\begin{aligned} \Vert E_{N}\Vert ^{2}_{2}\le \Vert y-Y_{N}\Vert ^{2}_{2}\le \left( \frac{M}{(N+1)!}\right) ^{2}\frac{L^{2(N+1)+1}}{(2(N+1)+1)}, \end{aligned}$$
(6.13)

respectively, and the proof is complete. \(\square \)

The following corollary shows that the obtained error has a very rapid rate of convergence.

Corollary 6.1

For all \(N\ge 1\), the following two estimates hold:

$$\begin{aligned} \Vert E_{N-1}\Vert _{\infty }={\mathcal {O}}((Le)^{N}/N^{N+1/2}), \end{aligned}$$
(6.14)

and

$$\begin{aligned} \Vert E_{N-1}\Vert _{2}={\mathcal {O}}((Le)^{N}/N^{N+1}). \end{aligned}$$
(6.15)

Proof

Making use of the asymptotic result in [33, p.233],

$$\begin{aligned} \Gamma (c\,x+d)\sim \sqrt{2\pi }\,e^{-c\,x}(c\,x)^{c\,x+d-1/2}, x\gg 0,\,c>0, \end{aligned}$$
(6.16)

and some algebraic computations, the two inequalities (6.4) and (6.5) lead to the two estimates(6.14) and (6.15), and this completes the corollary’s proof. \(\square \)

7 Numerical Simulations

In this section, we present various examples to show the applicability and high accuracy of the suggested algorithm that is derived in Sect. 5. To examine the accuracy of the proposed method, the two error estimates \(\Vert E_{N}\Vert _{2}\) and \(\Vert E_{N}\Vert _{\infty }\) are provided. Seven numerical problems are presented, in which we show that the proposed method RSC1COMM provides the exact solution if the given differential equation has a polynomial solution of degree N. This solution can be found by combining \(\phi _{0}(x),\,\dots ,\phi _{N-2}(x)\). Furthermore, the approximate solutions obtained using the proposed method RSC1COMM are computed for various N, and the obtained errors reach \(10^{-16}\) using, \(N = 10,...,18,\) as shown in Tables 13579 and 11. In these tables, excellent computational results are obtained. The comparisons between our method and other methods in [9,10,11,12, 34, 35] are shown on Tables 246810 and 12 and they confirm that RSC1COMM gives more accurate results than other methods. Furthermore, the exact and approximate solutions to the given problems are in excellent agreement, as shown in Figs. 1a, 3a, 5a, 7a, 9a and 11a. The computed approximate solutions corresponding to high accuracy are provided. Additionally, Figs. 1b, 3b, 5b, 7b, 9b and 11b show absolute error function \(E_{N}(x)\) for various N values to demonstrate the dependence of error on N and the convergence of the solutions to the presented Problems 7.2-7.7 when RSC1COMM is employed. Furthermore, the stability of solutions are shown through Figs. 24681012.

Problem 7.1

Consider the differential equation

$$\begin{aligned} 2(x^{2}-x)y^{\prime \prime }(x) +(2x-1)\,y^{\prime }(x) -2n^{2}y(x)=0,\quad 0\le x\le 1, n=2,3,4,\dots , \end{aligned}$$
(7.1)

subject to the boundary conditions

$$\begin{aligned} y(0)+\,y^{\prime }(0)=(-1)^{n-1} \left( 2 n^2-1\right) ,\quad \text {and} \quad y(1)+\,y^{\prime }(1)=2 n^2+1. \end{aligned}$$
(7.2)

The exact solution is \(y(x)=T^{*}_{n}(x;0,1)\).

The application of proposed method RSC1COMM gives the exact solution for \(N\ge n-2\) in the form

$$\begin{aligned} T^{*}_{n}(x;0,1)=y_{N}(x)=\displaystyle \sum _{i=0}^{N}a_i\,\phi _{i}(x)+\lambda _{N}\,x+\mu _{N},\quad N=n-2,n-1,n,\dots , \end{aligned}$$

where the polynomial \(\phi _{i}(x)\) is determined by using the corresponding homogeneous conditions of (7.2), which has the form:

$$\begin{aligned} \phi _{i}(x)=\left( \frac{2 i^2+3}{1-4 \left( i^4+i^2\right) }+\left( \frac{2}{4 \left( i^4+i^2\right) -1}-1\right) x+x^2\right) T^{*}_{i}(x;0,1),\quad i=0,1,2,\dots . \end{aligned}$$

For \(N=0,1,2,3,4,5\), we get:

$$\begin{aligned} T^{*}_{2}(x;0,1)&=8\,\phi _{0}(x)+16x-23,\\ T^{*}_{3}(x;0,1)&=-\frac{64}{7}\,\phi _{0}(x)+16\,\phi _{1}(x)+2\,x+15,\\ T^{*}_{4}(x;0,1)&=\frac{18320}{553}\,\phi _{0}(x)-\frac{128}{79}\,\phi _{1}(x)+16\,\phi _{2}(x)+64 x-95,\\ T^{*}_{5}(x;0,1)&=-\frac{5430080}{198527}\,\phi _{0}(x)+\frac{1313056}{28361}\,\phi _{1}(x)\\&-\frac{128}{359}\,\phi _{2}(x)+16\,\phi _{3}(x)+2x+47,\\ T^{*}_{6}(x;0,1)&=\frac{16207530520}{215798849}\,\phi _{0}(x)-\frac{139032192}{30828407}\,\phi _{1}(x)\\&+\frac{15613216}{390233}\,\phi _{2}(x)-\frac{128}{1087}\,\phi _{3}(x)+16\,\phi _{4}(x)+144 x-215,\\ T^{*}_{7}(x;0,1)&=-\frac{30651035554688}{560861208551}\,\phi _{0}(x)+\frac{7326113367600}{80123029793}\,\phi _{1}(x)\\&-\frac{1013845632}{1014215567}\,\phi _{2}(x)+\frac{104874784}{2825113}\,\phi _{3}(x)-\frac{128}{2599}\,\phi _{4}(x) \\ {}&\quad +16\,\phi _{5}(x)+2 x+95. \end{aligned}$$

Problem 7.2

Consider the linear boundary value problem, [9, 10, 34]

$$\begin{aligned} y^{\prime \prime }(x)=y(x)-2\,cos x,\quad \frac{\pi }{2}\le x\le \pi , \end{aligned}$$
(7.3)

subject to the non-homogeneous Robin conditions

$$\begin{aligned} 3\,y\left(\frac{\pi }{2}\right)+\,y^{\prime }\left(\frac{\pi }{2}\right)=-1,\quad \text {and} \quad 4\,y(\pi )+\,y^{\prime }(\pi )=-4. \end{aligned}$$
(7.4)

The exact solution is \(y(x)=cos\,x\) and the computed approximate solution \(y_{11}(x)\) has the form:

$$\begin{aligned}&y_{11}(x)= 0.47992 +0.448195\,x-0.500012\,x^2+0.0000210937\,x^3+0.0416414\,x^4\\&+0.0000217069\,x^5-0.00140266\,x^6\\&+6.5204*10^{-6}\,x^7+0.0000225085\,x^8+5.85383*10^{-7}\,x^9-3.77818*10^{-7}\\&\,x^{10}+1.02794*10^{-8}\,x^{11}\\&+1.98148*10^{-9}\,x^{12}-1.12212*10^{-10}\,x^{13}+\frac{8}{1-6 \pi }\,x+\frac{3+2 \pi }{6 \pi -1}. \end{aligned}$$

This solution agrees perfectly with the exact solution of accuracy \(10^{-15}\) as shown in Table 1. \(\Vert E_{N}\Vert _{\infty }\)

Table 1 Maximum absolute error of Example 7.2
Table 2 Comparison between different methods of Example 7.2
Fig. 1
figure 1

Approximate solution \(y_{11}(x),\) and Errors \(E_{N}(x)\) using various N for Example 7.2

Fig. 2
figure 2

Log Errors for Example 7.2

Problem 7.3

Consider the nonlinear boundary value problem, [9, 10]

$$\begin{aligned} y^{\prime \prime }(x)=\frac{e^{-x}}{2}\left( (y(x))^{2}+(y^{\prime }(x))^{2}\right) ,\quad \qquad 0\le x\le 1, \end{aligned}$$
(7.5)

subject to the non-homogeneous Robin conditions

$$\begin{aligned} y(0)-\,y^{\prime }(0)=0,\quad \text {and} \quad y(1)+\,y^{\prime }(1)=2\,e. \end{aligned}$$
(7.6)

The exact solution is \(y(x)=e^{x},\) and the computed approximate solution \(y_{10}(x)\) has the form:

$$\begin{aligned}&y_{10}(x)= -0.812188-0.812188\,x+0.5\, x^2+0.166667\,x^3\\&+0.0416667\, x^4+0.00833333\, x^5\\&+0.00138889\, x^6+0.00019841\,x^7\\&+0.000024807\, x^8+2.74801*10^{-6} x^9+2.82816*10^{-7}\, x^{10}\\&+2.08084*10^{-8}\, x^{11}+3.4591*10^{-9}\,x^{12}+\frac{2 e}{3}(1+x). \end{aligned}$$

This solution agrees perfectly with the exact solution of accuracy \(10^{-16}\) as shown in Table 3.

Table 3 Maximum absolute error of Example 7.3
Table 4 Comparison between different methods of Example 7.3
Fig. 3
figure 3

Approximate solution \(y_{10}(x),\) and Errors \(E_{N}(x)\) using various N for Example 7.3

Fig. 4
figure 4

Log Errors for Example 7.3

Problem 7.4

Consider the nonlinear boundary value problem, [9, 10]

$$\begin{aligned} y^{\prime \prime }(x)=-\frac{1}{8}\left( e^{-2y(x)}+4\,(y^{\prime }(x))^{2}\right) ,\quad 0\le x\le 1, \end{aligned}$$
(7.7)

subject to the non-homogeneous Robin conditions

$$\begin{aligned} y(0)-2\,y^{\prime }(0)=-1,\quad \text {and} \quad y(1)+\,y^{\prime }(1)=\frac{1}{3}+ln(\frac{3}{2}). \end{aligned}$$
(7.8)

The exact solution is \(y(x)=ln((x+2)/2)\) and the computed approximate solution \(y_{13}(x)\) has the form:

$$\begin{aligned}&y_{13}(x)= 0.130601 +0.0653004\,x-0.125\,x^2+0.0416667\,x^3-0.015625\,x^4\\&+0.00625\,x^5-0.00260415\,x^6+0.00111594\,x^7\\&-4.87768*10^{-4}\,x^8+2.15534*10^{-4}\,x^9-9.454*10^{-5}\,x^{10}\\&+3.95161*10^{-5}\,x^{11}-1.46273*10^{-5}\,x^{12}\\&+4.30234*10^{-6}\, x^{13}-8.5753*10^{-7}\,x^{14}+8.42121*10^{-8}\,x^{15}\\&+1/4 (-2+x+(2+x) (1/3+ln(3/2))). \end{aligned}$$

This solution agrees perfectly with the exact solution of accuracy \(10^{-16}\) as shown in Table 5.

Table 5 Maximum absolute error of Example 7.4
Table 6 Comparison between different methods of Example 7.4
Fig. 5
figure 5

Approximate solution \(y_{13}(x),\) and Errors \(E_{N}(x)\) using various N for Example 7.4

Fig. 6
figure 6

Log Errors for Example 7.4

Problem 7.5

Consider the nonlinear boundary value problem, [9, 10, 35]

$$\begin{aligned} y^{\prime \prime }(x)=-e^{-2y(x)},\quad 0\le x\le 1, \end{aligned}$$
(7.9)

subject to the non-homogeneous Robin conditions

$$\begin{aligned} -y(0)+y^{\prime }(0)=1,\quad \text {and} \quad y(1)+\,y^{\prime }(1)=\frac{1}{2}+ln(2). \end{aligned}$$
(7.10)

The exact solution is \(y(x)=ln(x+1)\) and the computed approximate solution \(y_{17}(x)\) has the form:

$$\begin{aligned}&y_{17}(x)=\,0.268951 +0.268951\, x-0.5 x^2+0.333333\, x^3-0.25\, x^4\\&+0.2\, x^5-0.166666\, x^6+0.142846\, x^7-0.124924\, x^8\\&+0.110715\,x^9-0.0984397\, x^{10}+0.0861476\, x^{11}-0.0718498\, x^{12}+0.0546513\,x^{13}\\&-0.0360437\, x^{14}+0.0195358\,x^{15}\\&-0.00820029\,x^{16}+0.00246922\,x^{17}-0.000470727\,x^{18}\\&+0.0000424513\,x^{19}+\,1/3 (-2+x+(1+x) (1/2+ln(2))). \end{aligned}$$

This solution agrees perfectly with the exact solution of accuracy \(10^{-16}\) as shown in Table 7.

Table 7 Maximum absolute error of Example 7.5
Table 8 Comparison between different methods of Example 7.5
Fig. 7
figure 7

Approximate solution \(y_{17}(x),\) and Errors \(E_{N}(x)\) using various N for Example 7.5

Fig. 8
figure 8

Log Errors for Example 7.5

Problem 7.6

Consider the nonlinear boundary value problem, [9, 10, 12]

$$\begin{aligned} y^{\prime \prime }(x)=\pi ^2 e^{y(x)},\quad 0\le x\le 1, \end{aligned}$$
(7.11)

subject to the non-homogeneous Robin conditions

$$\begin{aligned} y(0)+2y^{\prime }(0)=-2\,\pi ,\quad \text {and} \quad 2\,y(1)-\,y^{\prime }(1)=-\pi . \end{aligned}$$
(7.12)

The exact solution is \(y(x)=-2ln\left( cos(\frac{\pi }{2}x-\frac{\pi }{4})\right) -ln(2)\) and the computed approximate solution \(y_{19}(x)\) has the form:

$$\begin{aligned}&y_{19}(x)= -4.24633*10^{-13}+(2.1236*10^{-13}-\pi )\,x+4.9348\, x^2-5.16771\, x^3\\&+8.11742\, x^4-12.7505\, x^5+21.3589\, x^6\\&-36.4881\, x^7+63.4097\, x^8-109.778\, x^9+184.343\, x^{10}-289.224\, x^{11}\\&+407.314\, x^{12}-495.785\, x^{13}\\&+504.326\, x^{14}-415.381\, x^{15}+267.778\, x^{16}-129.435\, x^{17}+43.9971\, x^{18}-9.37168\, x^{19}\\&+0.944748\, x^{20}-0.00140933\, x^{21}.\\ \end{aligned}$$

This solution agrees perfectly with the exact solution of accuracy \(10^{-13}\) as shown in Table 9.

Table 9 Maximum absolute error of Example 7.6
Table 10 Comparison between different methods of Example 7.6
Fig. 9
figure 9

Approximate solution \(y_{19}(x),\) and Errors \(E_{N}(x)\) using various N for Example 7.6

Fig. 10
figure 10

Log Errors for Example 7.6

Problem 7.7

Consider the nonlinear boundary value problem [9, 11, 35],

$$\begin{aligned} y^{\prime \prime }(x)=0.5\left( 1+x+y(x)\right) ^{3},\quad 0\le x\le 1, \end{aligned}$$
(7.13)

subject to the non-homogeneous Robin conditions

$$\begin{aligned} -y(0)+y^{\prime }(0)=-0.5,\quad \text {and} \quad y(1)+y^{\prime }(1)=1. \end{aligned}$$
(7.14)

The exact solution is \(y(x)=\dfrac{2}{2-x}-x-1\) and the computed approximate solution \(y_{19}(x)\) has the form:

$$\begin{aligned}&y_{19}(x)= -0.666667-0.666667\, x+0.25\, x^2+0.125\, x^3+0.0625\,x^4\\&+0.0312501\,x^5+0.0156239\, x^6+0.0078261\, x^7\\&+0.00379217\, x^8+0.0026494\, x^9-0.00220615\, x^{10}+0.0116036\, x^{11}-0.0298031\, x^{12}\\&+0.0634531\, x^{13}-0.104225\, x^{14}\\&+0.133728\, x^{15}-0.132109\, x^{16}+0.0987934\, x^{17}-0.0541116\, x^{18}+0.020537\, x^{19}\\&-0.00484001\, x^{20}+0.000538381\, x^{21}\\&+\frac{1}{6}(x+4). \end{aligned}$$

This solution agrees perfectly with the exact solution of accuracy \(10^{-16}\) as shown in Table 11.

Table 11 Maximum absolute error of Example 7.7
Table 12 Comparison between different methods of Example 7.7
Fig. 11
figure 11

Approximate solution \(y_{19}(x),\) and Errors \(E_{N}(x)\) using various N for Example 7.7

Fig. 12
figure 12

Log Errors for Example 7.7

8 Conclusion

Herein, a system of modified shifted Chebyshev polynomials of the first kind that satisfies homogeneous two boundary Robin conditions has been established. The employment of these polynomials with the collocation spectral method provides an approximation of the given second-order differential equation. The proposed method RSC1COMM was tested using seven examples, which demonstrate the algorithm’s high accuracy and efficiency. We believe that the theoretical results in this paper can be utilized to treat other types of ordinary and fractional differential equations. Also, the theoretical convergence and error analysis were discussed, and it was demonstrated that the dependence of error on N when RSC1COMM is employed. The presented numerical problems demonstrated the method’s applicability, effectiveness, and accuracy.