In this section, we derive the SJ-GL-C method to solve numerically the following model problem:

${D}^{\nu}({D}^{\mu}+\lambda )u(x)=f(x,u),\phantom{\rule{1em}{0ex}}0<\mu \le 1,1<\nu \le 2,x\in I=(0,L),$

(11)

subject to the three-point boundary conditions

$u(0)={s}_{0},\phantom{\rule{2em}{0ex}}u({x}_{1})={s}_{1},\phantom{\rule{2em}{0ex}}u(L)={s}_{2},\phantom{\rule{2em}{0ex}}{x}_{1}\in \phantom{\rule{0.2em}{0ex}}]0,L[,$

(12)

where ${D}^{\nu}u(x)\equiv {u}^{(\nu )}(x)$ denotes the Caputo fractional derivative of order *ν* for $u(x)$*λ* is a real number, ${s}_{0}$${s}_{1}$${s}_{2}$ are given constants and $f(x,u)$ is a given nonlinear source function. For the existence and uniqueness of solution of (11)-(12), see [12].

The choice of collocation points is important for the convergence and efficiency of the collocation method. For boundary value problems, the Gauss-Lobatto points are commonly used. It should be noted that for a differential equation with the singularity at $x=0$ in the interval $[0,L]$ one is unable to apply the collocation method with Jacobi-Gauss-Lobatto points because the two assigned abscissas 0 and *L* are necessary to use as a two points from the collocation nodes. Also, a Jacobi-Gauss-Radau nodes with the fixed node $x=0$ cannot be used in this case. In fact, we use the collocation method with Jacobi-Gauss-Lobatto nodes to treat the nonlinear Langevin differential equation; i.e., we collocate this equation only at the $(N-2)$ Jacobi-Gauss-Lobatto points $(0,L)$. These equations together with three-point boundary conditions generate $(N+1)$ nonlinear algebraic equations which can be solved.

Let us first introduce some basic notation that will be used in the sequel. We set

${S}_{N}(0,L)=span\{{P}_{L,0}^{(\alpha ,\beta )}(x),{P}_{L,1}^{(\alpha ,\beta )}(x),\dots ,{P}_{L,N}^{(\alpha ,\beta )}(x)\}.$

(13)

We next recall the Jacobi-Gauss-Lobatto interpolation. For any positive integer

*N*,

${S}_{N}(0,L)$ stands for the set of all algebraic polynomials of degree at most

*N*. If we denote by

${x}_{N,j}^{(\alpha ,\beta )}({x}_{L,N,j}^{(\alpha ,\beta )})$,

$0\u2a7dj\u2a7dN$, and

${\varpi}_{N,j}^{(\alpha ,\beta )}({\varpi}_{L,N,j}^{(\alpha ,\beta )})$, (

$0\le i\le N$), to the nodes and Christoffel numbers of the standard (shifted) Jacobi-Gauss-Lobatto quadratures on the intervals

$(-1,1)$,

$(0,L)$ respectively. Then one can easily show that

For any

$\varphi \in {S}_{2N+1}(0,L)$,

$\begin{array}{rl}{\int}_{0}^{L}{w}_{L}^{(\alpha ,\beta )}(x)\varphi (x)\phantom{\rule{0.2em}{0ex}}dx& ={\left(\frac{L}{2}\right)}^{\alpha +\beta +1}{\int}_{-1}^{1}{(1-x)}^{\alpha}{(1+x)}^{\beta}\varphi (\frac{L}{2}(x+1))\phantom{\rule{0.2em}{0ex}}dx\\ ={\left(\frac{L}{2}\right)}^{\alpha +\beta +1}\sum _{j=0}^{N}{\varpi}_{N,j}^{(\alpha ,\beta )}\varphi \left(\frac{L}{2}({x}_{N,j}^{(\alpha ,\beta )}+1)\right)\\ =\sum _{j=0}^{N}{\varpi}_{L,N,j}^{(\alpha ,\beta )}\varphi \left({x}_{L,N,j}^{(\alpha ,\beta )}\right).\end{array}$

(14)

We introduce the following discrete inner product and norm:

${(u,v)}_{{w}_{L}^{(\alpha ,\beta )},N}=\sum _{j=0}^{N}u\left({x}_{L,N,j}^{(\alpha ,\beta )}\right)v\left({x}_{L,N,j}^{(\alpha ,\beta )}\right){\varpi}_{L,N,j}^{(\alpha ,\beta )},\phantom{\rule{2em}{0ex}}{\parallel u\parallel}_{{w}_{L}^{(\alpha ,\beta )},N}=\sqrt{{(u,u)}_{{w}_{L}^{(\alpha ,\beta )},N}},$

(15)

where ${x}_{L,N,j}^{(\alpha ,\beta )}$ and ${\varpi}_{L,N,j}^{(\alpha ,\beta )}$ are the nodes and the corresponding weights of the shifted Jacobi-Gauss-quadrature formula on the interval $(0,L)$ respectively.

Due to (14), we have

${(u,v)}_{{w}_{L}^{(\alpha ,\beta )},N}={(u,v)}_{{w}_{L}^{(\alpha ,\beta )}},\phantom{\rule{1em}{0ex}}\mathrm{\forall}uv\in {S}_{2N-1}.$

(16)

Thus, for any $u\in {S}_{N}(0,L)$, the norms ${\parallel u\parallel}_{{w}_{L}^{(\alpha ,\beta )},N}$ and ${\parallel u\parallel}_{{w}_{L}^{(\alpha ,\beta )}}$ coincide.

Associating with this quadrature rule, we denote by

${I}_{N}^{{P}_{L}^{(\alpha ,\beta )}}$ the shifted Jacobi-Gauss interpolation,

${I}_{N}^{{P}_{L}^{(\alpha ,\beta )}}u\left({x}_{L,N,j}^{(\alpha ,\beta )}\right)=u\left({x}_{L,N,j}^{(\alpha ,\beta )}\right),\phantom{\rule{1em}{0ex}}0\le k\le N.$

The shifted Jacobi-Gauss collocation method for solving (11)-(12) is to seek

${u}_{N}(x)\in {S}_{N}(0,T)$, such that

$\begin{array}{r}{D}^{\mu +\nu}{u}_{N}\left({x}_{L,N-3,k}^{(\alpha ,\beta )}\right)+\lambda {D}^{\nu}{u}_{N}\left({x}_{L,N-3,k}^{(\alpha ,\beta )}\right)\\ \phantom{\rule{1em}{0ex}}=f({x}_{L,N-3,k}^{(\alpha ,\beta )},{u}_{N}\left({x}_{L,N-3,k}^{(\alpha ,\beta )}\right)),\phantom{\rule{1em}{0ex}}k=0,1,\dots ,N-3.\end{array}$

(17)

${u}_{N}(0)={s}_{0},\phantom{\rule{2em}{0ex}}{u}_{N}({x}_{1})={s}_{1},\phantom{\rule{2em}{0ex}}{u}_{N}(L)={s}_{2},\phantom{\rule{2em}{0ex}}{x}_{1}\in \phantom{\rule{0.2em}{0ex}}]0,L[.$

(18)

We now derive an efficient algorithm for solving (17)-(18). Let

${u}_{N}(x)=\sum _{j=0}^{N}{a}_{j}{P}_{L,j}^{(\alpha ,\beta )}(x),\phantom{\rule{1em}{0ex}}\mathbf{a}={({a}_{0},{a}_{1},\dots ,{a}_{N})}^{T}.$

(19)

We first approximate

$u(x)$,

${D}^{\mu +\nu}u(x)\text{and}{D}^{\mu}u(x)$, as Eq. (

19). By substituting these approximations in Eq. (

11), we get

$\sum _{j=0}^{N}{a}_{j}({D}^{\mu +\nu}{P}_{L,j}^{(\alpha ,\beta )}(x)+\lambda {D}^{\mu}{P}_{L,j}^{(\alpha ,\beta )}(x))=f(x,\sum _{j=0}^{N}{a}_{j}{P}_{L,j}^{(\alpha ,\beta )}(x)).$

(20)

Here, the fractional derivative of order *μ* in the Caputo sense for the shifted Jacobi polynomials expanded in terms of shifted Jacobi polynomials themselves can be represented formally in the following theorem.

**Theorem 3.1** *Let*${P}_{L,j}^{(\alpha ,\beta )}(x)$*be a shifted Jacobi polynomial of degree* *j*, *then the fractional derivative of order* *ν* *in the Caputo sense for*${P}_{L,j}^{(\alpha ,\beta )}(x)$*is given by*

${D}^{\nu}{P}_{L,j}^{(\alpha ,\beta )}(x)=\sum _{i=0}^{\mathrm{\infty}}{Q}_{\nu}(j,i,\alpha ,\beta ){P}_{L,i}^{(\alpha ,\beta )}(x),\phantom{\rule{1em}{0ex}}j=\lceil \nu \rceil ,\lceil \nu \rceil +1,\dots ,$

(21)

*where*
$\begin{array}{rl}{Q}_{\nu}(j,i,\alpha ,\beta )=& \sum _{k=\lceil \nu \rceil}^{j}\frac{{(-1)}^{j-k}{L}^{\alpha +\beta -\nu +1}\mathrm{\Gamma}(i+\beta +1)\mathrm{\Gamma}(j+\beta +1)\mathrm{\Gamma}(j+k+\alpha +\beta +1)}{{h}_{i}\mathrm{\Gamma}(i+\alpha +\beta +1)\mathrm{\Gamma}(k+\beta +1)\mathrm{\Gamma}(j+\alpha +\beta +1)\mathrm{\Gamma}(k-\nu +1)(j-k)!}\\ \times \sum _{l=0}^{i}\frac{{(-1)}^{i-l}\mathrm{\Gamma}(i+l+\alpha +\beta +1)\mathrm{\Gamma}(\alpha +1)\mathrm{\Gamma}(l+k+\beta -\nu +1)}{\mathrm{\Gamma}(l+\beta +1)\mathrm{\Gamma}(l+k+\alpha +\beta -\nu +2)(i-l)!l!}.\end{array}$

*Proof* This theorem can be easily proved (see Doha et al. [36]).

In practice, only the first

$(N+1)$-terms shifted Jacobi polynomials are considered, with the aid of Theorem 3.1 (Eq. (

21)), we obtain from (20) that

$\begin{array}{r}\sum _{j=0}^{N}{a}_{j}(\sum _{i=0}^{N}{Q}_{\mu +\nu}(j,i,\alpha ,\beta ){P}_{L,i}^{(\alpha ,\beta )}(x)+\lambda \sum _{i=0}^{N}{Q}_{\mu}(j,i,\alpha ,\beta ){P}_{L,i}^{(\alpha ,\beta )}(x))\\ \phantom{\rule{1em}{0ex}}=f(x,\sum _{j=0}^{N}{a}_{j}{P}_{L,j}^{(\alpha ,\beta )}(x)).\end{array}$

(22)

Also, by substituting Eq. (

19) in Eq. (

12) we obtain

$\begin{array}{rl}\sum _{j=0}^{N}{a}_{j}{P}_{L,j}^{(\alpha ,\beta )}(0)& ={s}_{0},\\ \sum _{j=0}^{N}{a}_{j}{P}_{L,j}^{(\alpha ,\beta )}({x}_{1})& ={s}_{1},\\ \sum _{j=0}^{N}{a}_{j}{P}_{L,j}^{(\alpha ,\beta )}(L)& ={s}_{2}.\end{array}\}$

(23)

To find the solution

${u}_{N}(x)$, we first collocate Eq. (

22) at the

$(N-2)$ shifted Jacobi-Gauss-Lobatto notes, yields

$\begin{array}{r}\sum _{j=0}^{N}{a}_{j}(\sum _{i=0}^{N}{Q}_{\mu +\nu}(j,i,\alpha ,\beta ){P}_{L,i}^{(\alpha ,\beta )}\left({x}_{L,N-3,k}^{(\alpha ,\beta )}\right)+\lambda \sum _{i=0}^{N}{Q}_{\mu}(j,i,\alpha ,\beta ){P}_{L,i}^{(\alpha ,\beta )}\left({x}_{L,N-3,k}^{(\alpha ,\beta )}\right))\\ \phantom{\rule{1em}{0ex}}=f(\left({x}_{L,N-3,k}^{(\alpha ,\beta )}\right),\sum _{j=0}^{N}{a}_{j}{P}_{L,j}^{(\alpha ,\beta )}\left({x}_{L,N-3,k}^{(\alpha ,\beta )}\right)),\phantom{\rule{1em}{0ex}}0\le k\le N-3.\end{array}$

(24)

Next, Eq. (

23), after using (9) and (6), can be written as

$\begin{array}{rl}\sum _{j=0}^{N}{(-1)}^{j}\frac{\mathrm{\Gamma}(j+\beta +1)}{\mathrm{\Gamma}(\beta +1)j!}{a}_{j}& ={s}_{0},\\ \sum _{j=0}^{N}\left(\sum _{i=0}^{j}{(-1)}^{j-i}\frac{\mathrm{\Gamma}(j+\beta +1)\mathrm{\Gamma}(j+i+\alpha +\beta +1)}{\mathrm{\Gamma}(i+\beta +1)\mathrm{\Gamma}(j+\alpha +\beta +1)(j-i)!i!{L}^{i}}{x}_{1}^{i}\right){a}_{j}& ={s}_{1},\\ \sum _{j=0}^{N}\left(\sum _{i=0}^{j}{(-1)}^{j-i}\frac{\mathrm{\Gamma}(j+\beta +1)\mathrm{\Gamma}(j+i+\alpha +\beta +1)}{\mathrm{\Gamma}(i+\beta +1)\mathrm{\Gamma}(j+\alpha +\beta +1)(j-i)!i!}\right){a}_{j}& ={s}_{2}.\end{array}\}$

(25)

The scheme (24)-(25) can be rewritten as a compact matrix form. To do this, we introduce the

$(N+1)\times (N+1)$ matrix

*A* with the entries

${a}_{kj}$ as follows:

${a}_{kj}=\{\begin{array}{c}\sum _{i=0}^{N}{Q}_{\mu +\nu}(j,i,\alpha ,\beta ){P}_{L,i}^{(\alpha ,\beta )}\left({x}_{L,N-3,k}^{(\alpha ,\beta )}\right),\hfill \\ \phantom{\rule{1em}{0ex}}0\le k\le N-3,\lceil \mu +\nu \rceil \le j\le N,\hfill \\ {(-1)}^{j}\frac{\mathrm{\Gamma}(j+\beta +1)}{\mathrm{\Gamma}(\beta +1)j!},\hfill & k=N-2,0\le j\le N,\hfill \\ \sum _{i=0}^{j}{(-1)}^{j-i}\frac{\mathrm{\Gamma}(j+\beta +1)\mathrm{\Gamma}(j+i+\alpha +\beta +1)}{\mathrm{\Gamma}(i+\beta +1)\mathrm{\Gamma}(j+\alpha +\beta +1)(j-i)!i!{L}^{i}}{x}_{1}^{i},\hfill & k=N-1,0\le j\le N,\hfill \\ \sum _{i=0}^{j}{(-1)}^{j-i}\frac{\mathrm{\Gamma}(j+\beta +1)\mathrm{\Gamma}(j+i+\alpha +\beta +1)}{\mathrm{\Gamma}(i+\beta +1)\mathrm{\Gamma}(j+\alpha +\beta +1)(j-i)!i!},\hfill & k=N,0\le j\le N,\hfill \\ 0,\hfill & \text{otherwise}.\hfill \end{array}$

Also, we define the

$(N+1)\times (N+1)$ matrix

*B* with the entries:

${b}_{kj}=\{\begin{array}{cc}\sum _{i=0}^{N}{Q}_{\mu}(j,i,\alpha ,\beta ){P}_{L,i}^{(\alpha ,\beta )}\left({x}_{L,N-3,k}^{(\alpha ,\beta )}\right),\hfill & 0\le k\le N-3,\lceil \mu \rceil \le j\le N,\hfill \\ 0,\hfill & \text{otherwise},\hfill \end{array}$

and the

$(N-2)\times (N+1)$ matrix

*C* with the entries:

${c}_{kj}={P}_{T,j}^{(\alpha ,\beta )}\left({x}_{T,N-3,k}^{(\alpha ,\beta )}\right),\phantom{\rule{1em}{0ex}}0\le k\le N-3,0\le j\le N.$

Further, let

$\mathbf{a}={({a}_{0},{a}_{1},\dots ,{a}_{N})}^{T}$, and

$\mathbf{F}(\mathbf{a})={(f({x}_{T,N-3,0}^{(\alpha ,\beta )},{u}_{N}\left({x}_{T,N-3,0}^{(\alpha ,\beta )}\right)),\dots ,f({x}_{T,N-3,N-3}^{(\alpha ,\beta )},{u}_{N}\left({x}_{T,N-3,N-3}^{(\alpha ,\beta )}\right)),{s}_{0},{s}_{1},{s}_{2})}^{T},$

where

${u}_{N}({x}_{T,N-3,k}^{(\alpha ,\beta )})$ is the

*k* th component of

*C* **a**. Then we obtain from (24)-(25) that

$(A+\lambda B)\mathbf{a}=\mathbf{F}(\mathbf{a}),$

or equivalently

$\mathbf{a}={(A+\lambda B)}^{-1}\mathbf{F}(\mathbf{a}).$

(26)

Finally, from (26), we obtain $(N+1)$ nonlinear algebraic equations which can be solved for the unknown coefficients ${a}_{j}$ by using any standard iteration technique, like Newton’s iteration method. Consequently, ${u}_{N}(x)$ given in Eq. (19) can be evaluated. □

**Remark 3.2** In actual computation for fixed *μ*, *ν* and *λ*, it is required to compute ${(A+\lambda B)}^{-1}$ only once. This allows us to save a significant amount of computational time.