1 Introduction

Recently the studies of fractional differential equations (FDEs) gained the attention of many scientists around the globe. This topic remains a central point in several special issues and books. Fractional-order operators are nonlocal in nature and due to this property, they are most nicely applicable to various systems of natural and physical phenomena. This property has motivated many scientists to develop fractional-order models by considering the ideas of fractional calculus. Examples of such systems can be found in many disciplines of science and engineering such as physics, biomathematics, chemistry, dynamics of earthquakes, dynamical processes in porous media, material viscoelastic theory, and control theory of dynamical systems. Furthermore, the outcome of certain observations indicates that fractional-order operators possess some properties related to systems having long memory. For details of applications and examples, we refer the reader to the work in [17].

The qualitative study of FDEs which discusses analytical investigation of certain properties like existence and uniqueness of solutions has been considered by several authors. In 1992 Guptta [8] studied the solvability of three point boundary value problems (BVPs). Since then many researchers have been working in this area and provided many useful results which guarantee the solvability and existence of a unique solution of such problems. For the reader interested in the existence theory of such problem we refer to work presented by Ruyun Ma [9] in which the author presents a detailed survey on the topic. In [10] the author derived an analytic relation which guarantees the existence of positive solution of a general third order multi-point BVPs. Also some analytic properties of solutions of FDEs are discussed by El-Sayed in [11]. Often it is impossible to arrive at the exact solution when FDEs has to be solved under some constraints in the form of boundary conditions. Therefore the development of approximation techniques remains a central and active area of research.

The spectral methods, which belong to the approximation techniques, are often used to find approximate solution of FDEs. The idea of the spectral method is to convert FDEs to a system of algebraic equations. However, different techniques are used for this conversion. Some of well-known techniques are the collocation method, the tau method, and the Galerkin method. The tau and Galerkin methods are analogous in the sense that the FDEs are enforced to satisfy some algebraic equations, then some supplementary set of equations are derived using the relations of boundary conditions (see, e.g., [12] and the references therein). The collocation method [13, 14], which is an analog of the spectral method, consists of two steps. First, a discrete representation of the solution is chosen and then FDEs are discretized to obtain a system of algebraic equations.

These techniques are extensively used to solve many scientific problems. Doha et al. [15] used collocation methods and employed Chebyshev polynomials to find an approximate solution of initial value problems of FDEs. Similarly, Bhrawy et al. [16] derived an explicit relation which relates the fractional-order derivatives of Legendre polynomials to its series representation, and they used it to solve some scientific problems. Saadatmandi and Dehghan [17] and Doha et al. [18] extended the operational matrices method and derived operational matrices of fractional derivatives for orthogonal polynomials and used it for solving different types of FDEs. Some recent and good results can be found in the articles like [15, 19, 20].

Some other methods have also been developed for the solution of FDEs. Among others, some of them are iterative techniques, reproducing kernel methods, finite difference methods etc. Esmaeili and Shamsi [21] developed a new procedure for obtaining an approximation to the solution of initial value problems of FDEs by employing a pseudo-spectral method, and Pedas and Tamme [22] studied the application of spline functions for solving FDEs. In [23], the author used a quadrature tau method for obtaining the numerical solution of multi-point boundary value problems. Also the authors in [2431] extended the spectral method to find a smooth approximation to various classes of FDEs and FPDEs. Some recent results in which orthogonal polynomials are applied to solve various scientific problems can be found in [3236].

Multi-point nonlocal boundary value problems appears widely in many important scientific phenomena like in elastic stability and in wave propagation. For the solution of such a problem Rehman and Khan [37, 38] introduced an efficient numerical scheme, based on the Haar wavelet operational matrices of integration for solving linear multi-point boundary value problems for FDEs. FDEs subject to multi-point nonlocal boundary conditions are a little bit difficult. In this area of research a few articles are available. Some good results on solution of nonlocal boundary value problems can be found in [3944].

Bernstein polynomials are frequently used in many numerical methods. Bernstein polynomials enjoy many useful properties, but they lack the important property of orthogonality. As the orthogonality property is one of more important properties in approximation theory and numerical simulations, these polynomials cannot be directly implemented in the current technique of numerical approximations. To overcome this difficulty, these non-orthogonal Bernstein polynomials are transformed into an orthogonal basis [4548]. But as the degree of the polynomials increases the transformation matrix becomes ill conditioned [49, 50], which results some inaccuracies in numerical computations. Recently Bellucci introduced an explicit relation for normalized Bernstein polynomials [51]. One applied Gram-Schmidt orthonormalization process to some sets of Bernstein polynomials of different scale levels, identifying the pattern of polynomials, and generalizing the result. The main results presented in this article are based on these generalized bases.

In this article we present an approximation procedure to find an approximate solution of the FDEs subject to local and nonlocal m-point BVPs. The method is designed to solve linear FDEs with constant coefficients, linear FDEs with variable coefficients, and nonlinear FDEs, under local and nonlocal m-point boundary conditions. In particular, we consider the following generalized class of FDEs:

$$\begin{aligned}& D^{\sigma}U(t)=\sum_{i=1}^{p} \lambda_{i}D^{\rho_{i}}U(t)+f(t), \end{aligned}$$
(1)
$$\begin{aligned}& D^{\sigma}U(t)=\sum_{i=1}^{p} \lambda_{i}(t)D^{\rho_{i}}U(t)+f(t), \end{aligned}$$
(2)
$$\begin{aligned}& D^{\sigma}U(t)+\sum_{i=1}^{p} \lambda_{i}D^{\rho _{i}}U(t)=F\bigl(U(t)^{\rho_{0}},U(t)^{\rho_{1}}, \ldots, U(t)^{\rho _{p}}\bigr)+f(t). \end{aligned}$$
(3)

In equation (1) \(\lambda_{i}\in\mathbf{R}\), \(t\in{}[ 0,\omega]\), \(f(t)\in C([0,\omega])\). The orders of the derivatives are defined as

$$\begin{aligned}& 0< \rho_{1}\leq1< \rho_{2}\leq2\cdots p-1< \rho_{p}\leq p< \sigma\leq p+1. \end{aligned}$$

In equation (2) \(\lambda_{i}(t)\in C([0,\omega])\). In (3) \(F(U(t)^{\rho_{0}},U(t)^{\rho_{1}},\ldots, U(t)^{\rho_{p}})\) is a nonlinear function of \(U(t)\) and its fractional derivatives.

The main aim in this paper is to find a smooth approximation to \(U(t)\), which satisfies a given set of m-point boundary conditions. We consider the following two types of boundary constraints.

Type 1: Multi-point local boundary conditions defined as

$$ U(0)=u_{0},\qquad U(\tau_{i})=u_{i}, \quad i=1,2,p-1,\qquad U(\omega)=u_{p}. $$
(4)

Type 2: Non local m-point boundary conditions, defined as

$$ U^{j}(0)=u_{j},\quad j=0,1,\ldots, p-1, \qquad\sum _{i=1}^{\hat {m}-1}\varphi _{i}U( \tau_{i})=U(\omega). $$
(5)

We use the normalized Bernstein polynomials for our investigation, which is based on the explicit relations presented in [51]. We use these polynomials to develop new operational matrices. We develop four operational matrices, two of them being operational matrices of integration and differentiation, the formulation technique for these two operational matrices is the same as that used for traditional orthogonal polynomials. We introduce two more operational matrices to deal with the local and nonlocal boundary conditions. To the best of our knowledge such types of operational matrices are not designed for normalized Bernstein polynomials.

We organized the rest of article as follows. In Section 2, we recall some basic concepts definition from fractional calculus, approximation theory, and matrix theory. Also we present some properties of normalized Bernstein polynomials which are helpful in our further investigation. In Section 3, we present a detailed procedure for the construction of the required operational matrices. In Section 4, the developed matrices are employed to solve FDEs by introducing a new algorithm. In Section 5, the proposed algorithm is applied to some test problems to show the efficiency of the proposed algorithm. The last section is devoted to a short conclusion.

2 Some basic definitions

In this section, we present some basic notation and definitions from fractional calculus and well-known results which are important for our further investigation. More details can be found in [5, 7].

Definition 1

The Riemann-Liouville fractional-order integral of order \(\sigma\in\mathbf{R}_{+}\) of a function \(\phi(t) \in(L^{1}[a,b],\mathbf{R})\) is defined by

$$ _{a}I_{t}^{\sigma}\phi(t)= \frac{1}{\Gamma{(\sigma)}} \int _{a}^{t}(t-s)^{\sigma-1}\phi(s)\,ds. $$
(6)

The integral on right hand side exists and is assumed to be convergent.

Definition 2

For a given function \(\phi(t)\in C^{n}[a,b]\), the fractional-order derivative in the Caputo sense, of order σ is defined as

$$ D^{\sigma}\phi(t)=\frac{1}{\Gamma(n-\sigma)} \int_{a}^{t}\frac {\phi ^{(n)}(s)}{(t-s)^{\sigma+1-n}}\,ds,\quad n-1\leq \sigma< n , n\in N. $$

The right side is assumed to be point wise defined on \((a,\infty)\), where \(n=[\sigma]+1\) in the case that σ is not an integer.

This leads to \(I^{\sigma}t^{k}=\frac{\Gamma(1+k)}{\Gamma(1+k+\sigma )}t^{k+\sigma}\) for \(\sigma>0\), \(k\geq0\), \(D^{\sigma}C=0\), for a constant C and

$$ D^{\sigma}t^{k}=\frac{\Gamma(1+k)}{\Gamma(1+k-\sigma)}t^{k-\sigma }, \quad\text{for }k\geq{}[\sigma]. $$
(7)

Throughout the paper, we will use the Brenstein polynomials of degree n. The analytic relation of the Brenstein polynomials of degree n defined on \([0,1]\) is given as

$$ B_{(i,n)}(t)=\sum_{k=0}^{n-i}(-1)^{k} \left ( \textstyle\begin{array}{@{}c@{}} n \\ i \end{array}\displaystyle \right ) \left ( \textstyle\begin{array}{@{}c@{}} n-i \\ k \end{array}\displaystyle \right ) t^{i+k},\quad i=0,1, \ldots, n. $$
(8)

The set of polynomials defined by (8) have a lot of interesting properties. They are positive on \([0,1]\) and also approximate a smooth function on the domain \([0,1]\). The polynomials defined in (8) are not orthogonal, after the application of the Gram-Schmidt process the explicit form of normalized Bernstein polynomials is obtained (as discussed in detail in [51]) by

$$ \boldsymbol {\phi}_{j,n}(t)=\sqrt{2(n-j)+1}(1-t)^{n-j} \sum_{k=0}^{j}\Delta _{(j,k)}t^{j-k}, $$
(9)

where

$$ \Delta_{(j,k)}=(-1)^{k}\frac{\Gamma(2n-k+2)\Gamma(j-1)}{\Gamma (j-k+1)\Gamma(2n-j+2)\Gamma(k+1)\Gamma(j-k+1)}. $$

The polynomials defined in (9) are not directly applicable in construction of operational matrices (it will be clear in the next section). Therefore, we further generalize the relation

$$ \boldsymbol {\phi}_{j,n}(t)=\sqrt{2(n-j)+1}\sum _{k=0}^{j}\sum_{l=0}^{n-j}\overbrace{\Delta_{(j,k,l)}}t^{l+j-k}, $$
(10)

where

$$ \overbrace{\Delta_{(j,k,l)}}=\frac{((-1)^{(n-j+k+l)}\Gamma (n-j+1)\Gamma (2n-k+2)\Gamma(j+1))}{\Gamma(l+1)\Gamma(n-j-l+1)\Gamma(j-k+1)\Gamma (2n-j+2)\Gamma(k+1)\Gamma(j-k+1)}. $$
(11)

Note that in equation (10), \(\boldsymbol {\phi}_{j,n}(t)\) is of degree n for all choices of j. By analyzing we observe that the minimum power of t is at maximum value of k and minimum value of l, which is 0. Conversely the maximum power of t is n. These polynomials are orthogonal on the interval \([0,1]\). To make them applicable on the interval \([0,\omega]\), we simply make substitution of \(t=\frac {t}{\omega}\) without loss of generality. So we can write the orthogonal Bernstein polynomials on the interval \([0,\omega]\) as follows:

$$ \boldsymbol {\phi}_{j,n}(t)=\mathbf{w}_{(j,n)}\sum _{k=0}^{j}\sum _{l=0}^{n-j}\overbrace{ \Delta_{(j,k,l)}}\frac{t^{l+j-k}}{\omega^{l+j-k}}, $$
(12)

where \(\mathbf{w}_{(j,n)}=\sqrt{2(n-j)+1}/\sqrt{\omega}\). The orthogonality relation for these polynomials is defined as follows:

$$ \int_{0}^{\omega}\boldsymbol {\phi}_{i,n}(t)\boldsymbol { \phi }_{j,n}(t)=\delta _{(i,j)}. $$
(13)

As usual we can approximate any function \(f\in C[0,\omega]\) in the normalized Bernstein polynomial as

$$ f(t)=\sum_{j=0}^{n}c_{j} \boldsymbol {\phi}_{j,n}(t),\quad\text{where }c_{j}= \int_{0}^{\omega}f(t)\boldsymbol {\phi}_{j,n}(t) \,dt, $$
(14)

which can always be written as

$$ f(t)=\mathbf{H_{N}^{T}} \boldsymbol { \mho}_{\mathbf{N}}^{\boldsymbol {\omega }}(\mathbf{t}), $$
(15)

where HNT and \(\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t})\) are \(\mathbf{N}=n+1\) terms column vector containing coefficients and Bernstein polynomials, respectively, and one defined

$$\begin{aligned}& \mathbf{H_{N}^{T}}= [ c_{0},c_{1}, \ldots, c_{n} ], \end{aligned}$$
(16)
$$\begin{aligned}& \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t})= \bigl[ \boldsymbol {\phi}_{0,n}(t),\boldsymbol {\phi}_{1,n}(t),\ldots, \boldsymbol { \phi}_{j,n}(t) \bigr] ^{T}. \end{aligned}$$
(17)

As N represents the size of the resulting algebraic equations it is considered as a scale level of the scheme.

The integral of the triple product of fractional-order Legendre polynomials over the domain of interest was recently used in [52]. There the author used this value to solve fractional differential equations with variable coefficients directly. We use a triple product for Bernstein polynomials to construct a new operational matrix which is of basic importance in solving FDEs with variable coefficients. The following theorem is of basic importance.

Theorem 1

The definite integral of the product of three Bernstein polynomials over the domain \([0,\omega]\) is constant and is defined as

$$ \int_{0}^{\omega} \boldsymbol {\phi}_{a,n}(t) \boldsymbol {\phi}_{b,n}(t) \boldsymbol {\phi}_{c,n}(t)\,dt= \Theta_{(a,b,c)}, $$
(18)

where

$$ \Theta_{(a,b,c)}=\mathbf{w}_{((a,b,c),n)}\sum _{k=0}^{a}\sum_{l=0}^{n-a}\sum_{r=0}^{b}\sum _{s=0}^{n-b}\sum_{p=0}^{c} \sum_{q=0}^{n-c}\frac {\overbrace{\Delta_{(a,k,l)}}\overbrace{\Delta_{(b,r,s)}}\overbrace{\Delta _{(c,p,q)}}\omega}{(l+a+b+c+q-p-s-r-k+1)} $$

and \(\mathbf{w}_{((a,b,c),n)}=\mathbf{w}_{(a,n)} \mathbf{w}_{(b,n)}\mathbf{w}_{(c,n)}\).

Proof

Consider the following expression:

$$\begin{aligned} \int_{0}^{\omega} \boldsymbol {\phi}_{a,n}(t) \boldsymbol {\phi}_{b,n}(t) \boldsymbol {\phi}_{c,n}(t)\,dt =& \mathbf{w}_{((a,b,c),n)}\sum_{k=0}^{a} \sum_{l=0}^{n-a} \sum _{r=0}^{b}\sum_{s=0}^{n-b} \sum_{p=0}^{c}\sum _{q=0}^{n-c}\frac {\overbrace{\Delta_{(a,k,l)}}\overbrace{\Delta_{(b,r,s)}}\overbrace{\Delta _{(c,p,q)}}}{\omega^{l+a+b+c+q-p-s-r-k}} \\ &{}\times \int_{0}^{\omega}t^{l+a+b+c+q-p-s-r-k}\,dt. \end{aligned}$$

Evaluating the integral and using the notation \(\Theta_{(a,b,c)}\) we can write

$$ \Theta_{(a,b,c)}=\mathbf{w}_{((a,b,c),n)}\sum _{k=0}^{a}\sum_{l=0}^{n-a}\sum_{r=0}^{b}\sum _{s=0}^{n-b}\sum_{p=0}^{c} \sum_{q=0}^{n-c}\frac {\overbrace{\Delta_{(a,k,l)}}\overbrace{\Delta_{(b,r,s)}}\overbrace{\Delta _{(c,p,q)}}\omega}{(l+a+b+c+q-p+s-r-k+1)}. $$

 □

Now, we present the inverse of the well-known Vandermonde matrix. The inverse of this matrix will be used when we use operational matrices to solve under local boundary conditions.

Theorem 2

[53, 54]

Consider a matrix V defined as

$$ V=\left [ \textstyle\begin{array}{@{}c@{\quad}c@{\quad}c@{\quad}c@{}} \tau_{1} & \tau_{1}^{2} & \cdots& \tau_{1}^{p} \\ \tau_{2} & \tau_{2}^{2} & \cdots& \tau_{2}^{p} \\ \vdots& \vdots& \ddots& \vdots\\ \tau_{p} & \tau_{p}^{p} & \cdots& \tau_{p}^{p} \end{array}\displaystyle \right ], $$
(19)

where \(\tau_{1}<\tau_{2}<\cdots<\tau_{p}\). The inverse of this matrix exists and in defined as

$$ V^{-1}=[b_{(j,i)}], \quad \textit{where} \ i,j=1,2,\ldots,p, $$

where the entries \(b_{(j,i)}\) are defined by

$$ b_{(j,i)}=\frac{ 1}{\tau_{j}}(-1)^{k} \left({ \frac{\sum_{\substack {0 \mathop{\le}m_{1} \mathop{< } \cdots\mathop{< } m_{p-k} \mathop{\le}p \\ m_{1}, \ldots, m_{n-k} \mathop{\ne}j} } \tau_{m_{1}} \cdots\tau_{m_{n-k}} }{\prod_{\substack{0 \mathop{\le}m \mathop{\le}n \\ m \mathop{\ne}j} } ({\tau_{m} - \tau _{j}} )}} \right). $$
(20)

3 Operational matrices of derivative and integral

Now we are in a position to construct new operational matrices. The operational matrices of derivatives and integrals are frequently used in the literature to solve fractional-order differential equations. In this section, we present the proofs of constructions of four new operational matrices. These matrices act as building blocks in the proposed method.

Theorem 3

The fractional integration of order σ of the function vector \(\boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf{N}}(\mathbf{t})\) (as defined in (17)) is defined as

$$ I^{\sigma}\boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf{N}}(\mathbf {t})= \mathbf{P}_{(N\times N)}^{(\sigma,\omega)}\boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf{N}}( \mathbf{t}), $$

where \(\mathbf{P}_{(N\times N)}^{(\sigma,\omega)}\) is an operational matrix for fractional-order integration and is given as

$$ \mathbf{P}_{(N\times N)}^{(\sigma,\omega)}=\left [ \textstyle\begin{array}{@{}c@{\quad}c@{\quad}c@{\quad}c@{}} \Omega_{(0,0)} & \Omega_{(0,1)} & \cdots& \Omega_{(0,n)} \\ \Omega_{(1,0)} & \Omega_{(1,1)} & \cdots& \Omega_{(1,n)} \\ \vdots& \vdots& \ddots& \vdots\\ \Omega_{(n,0)} & \Omega_{(n,1)} & \cdots& \Omega_{(n,n)} \end{array}\displaystyle \right ], $$
(21)

where

$$ \Omega_{(r,s)}=\mathbf{w}_{(r,n)}\mathbf{w}_{(s,n)}\sum _{k^{\prime }=0}^{s}\sum _{l^{\prime}=0}^{n-s}\sum_{k=0}^{r} \sum_{l=0}^{n-r}\frac{\overbrace{\Delta_{(s,k^{\prime},l^{\prime})}}\Delta _{(r,k,l,\sigma ,\omega)}^{\prime}\omega^{l+r-k+\sigma+1}}{(l+l^{\prime }+s+r-k-k^{\prime}+\sigma+1)}, $$

where \(\overbrace{\Delta_{(s,k^{\prime},l^{\prime})}}\) is as defined in (11), and

$$ \Delta_{(r,k,l,\sigma,\omega)}^{\prime}=\frac{\overbrace{\Delta _{(r,k,l)}}\Gamma(l+r-k+1)}{\Gamma(l+r-k+1+\sigma)\omega^{l+r-k}}. $$

Proof

Consider the general element of (17) and apply fractional integral of order σ, consequently we will get

$$ I^{\sigma} \boldsymbol {\phi}_{r,n}(t)= \mathbf{w}_{(r,n)}\sum_{k=0}^{r}\sum_{l=0}^{n-r}\overbrace{ \Delta_{(r,k,l)}}\frac{I^{\sigma }t^{l+r-k}}{\omega^{l+r-k}}. $$
(22)

Using the definition of fractional-order integration we may write

$$ I^{\sigma} \boldsymbol {\phi}_{r,n}(t)= \mathbf{w}_{(r,n)}\sum_{k=0}^{r}\sum_{l=0}^{n-r}\Delta_{(r,k,l,\sigma,\omega)}^{\prime }t^{l+r-k+\sigma}, $$
(23)

where \(\Delta_{(r,k,l,\sigma,\omega)}^{\prime}=\frac{\overbrace {\Delta _{(r,k,l)}}\Gamma(l+r-k+1)}{\Gamma(l+r-k+1+\sigma)\omega^{l+r-k}}\). We can approximate \(t^{l+r-k+\sigma}\) with normalized Bernstein polynomials as follows:

$$ t^{l+r-k+\sigma}=\sum_{s=0}^{n}c_{(r,s)} \boldsymbol {\phi}_{s,n}(t),\quad \text{where } c_{(r,s)}= \int_{0}^{\omega}t^{l+r-k+\sigma} \boldsymbol { \phi}_{s,n}(t)\,dt. $$
(24)

Using equation (12), we can write

$$ c_{(r,s)}=\mathbf{w}_{(s,n)}\sum_{k^{\prime}=0}^{s} \sum_{l^{\prime }=0}^{n-s}\frac{\overbrace{\Delta_{(s,k^{\prime},l^{\prime })}}}{\omega ^{l^{\prime}+s-k^{\prime}}} \int_{0}^{\omega}t^{l+l^{\prime }+s+r-k-k^{\prime}+\sigma}\,dt. $$
(25)

On further simplifications, we can get

$$ c_{(r,s)}=\mathbf{w}_{(s,n)}\sum _{k^{\prime}=0}^{s}\sum_{l^{\prime }=0}^{n-s} \frac{\overbrace{\Delta_{(s,k^{\prime},l^{\prime })}}\omega ^{l+r-k+\sigma+1}}{(l+l^{\prime}+s+r-k-k^{\prime}+\sigma+1)}. $$
(26)

Using (26) and (24) in (23) we get

$$ I^{\sigma}\boldsymbol {\phi}_{r,n}(t)=\sum _{s=0}^{n}\mathbf {w}_{(r,n)} \mathbf{w}_{(s,n)}\sum_{k^{\prime}=0}^{s} \sum_{l^{\prime }=0}^{n-s}\sum _{k=0}^{r}\sum_{l=0}^{n-r} \frac{\overbrace{\Delta _{(s,k^{\prime},l^{\prime})}}\Delta_{(r,k,l,\sigma,\omega )}^{\prime }\omega^{l+r-k+\sigma+1}}{(l+l^{\prime}+s+r-k-k^{\prime}+\sigma+1)} \boldsymbol {\phi}_{s,n}(t). $$
(27)

Using the notation

$$ \Omega_{(r,s)}=\mathbf{w}_{(r,n)}\mathbf{w}_{(s,n)}\sum _{k^{\prime }=0}^{s}\sum _{l^{\prime}=0}^{n-s}\sum_{k=0}^{r} \sum_{l=0}^{n-r}\frac{\overbrace{\Delta_{(s,k^{\prime},l^{\prime})}}\Delta _{(r,k,l,\sigma ,\omega)}^{\prime}\omega^{l+r-k+\sigma+1}}{(l+l^{\prime }+s+r-k-k^{\prime}+\sigma+1)}, $$

and evaluating for \(r=0,1,\ldots,n\) and \(s=0,1,\ldots,n\) completes proof of the theorem. □

Theorem 4

The fractional derivative of order σ of the function vector \(\boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf{N}}(\mathbf{t})\) (as defined in (17)) is defined as

$$ D^{\sigma}\boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf{N}}(\mathbf {t})= \mathbf{D}_{(N\times N)}^{(\sigma,\omega)}\boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf{N}}( \mathbf{t}), $$

where \(\mathbf{D}_{(N\times N)}^{(\sigma,\omega)}\) is defined as

$$ \mathbf{D}_{(N\times N)}^{(\sigma,\omega)}=\left [ \textstyle\begin{array}{@{}c@{\quad}c@{\quad}c@{\quad}c@{}} \Omega_{(0,0)} & \Omega_{(0,1)} & \cdots& \Omega_{(0,n)} \\ \Omega_{(1,0)} & \Omega_{(1,1)} & \cdots& \Omega_{(1,n)} \\ \vdots& \vdots& \ddots& \vdots\\ \Omega_{(n,0)} & \Omega_{(n,1)} & \cdots& \Omega_{(n,n)} \end{array}\displaystyle \right ], $$
(28)

where

$$ \Omega_{(r,s)}=\mathbf{w}_{(r,n)}\mathbf{w}_{(s,n)}\sum _{k^{\prime }=0}^{s}\sum _{l^{\prime}=0}^{n-s}\sum_{k=0}^{r} \sum_{l=0}^{n-r}\frac{\overbrace{\Delta_{(s,k^{\prime},l^{\prime})}}\Delta _{(r,k,l,\sigma ,\omega)}^{\prime\prime}\omega^{l+r-k-\sigma+1}}{(l+l^{\prime }+s+r-k-k^{\prime}-\sigma+1)} $$

and

$$ \Delta_{(r,k,l,\sigma,\omega)}^{\prime\prime}= \textstyle\begin{cases} \frac{\overbrace{\Delta_{(r,k,l)}}\Gamma(l+r-k+1)}{\Gamma (l+r-k+1-\sigma )\omega^{l+r-k}} & \textit{if} \ l+r-k \geq\sigma, \\ 0 & \textit{if} \ l+r-k < \sigma. \end{cases} $$
(29)

Proof

On application of the derivative of order σ to a general element of (17), we may write

$$ D^{\sigma}\boldsymbol {\phi}_{r,n}(t)= \mathbf{w}_{(r,n)}\sum_{k=0}^{r}\sum _{l=0}^{n-r}\overbrace{ \Delta_{(r,k,l)}}\frac{D^{\sigma}t^{l+r-k}}{\omega^{l+r-k}}. $$
(30)

Using the definition of the fractional-order derivative we can easily write

$$ D^{\sigma}\boldsymbol {\phi}_{r,n}(t)= \mathbf{w}_{(r,n)}\sum_{k=0}^{r}\sum_{l=0}^{n-r} \Delta^{\prime\prime }_{(r,k,l,\sigma,\omega)}t^{l+r-k-\sigma}, $$
(31)

where

$$ \Delta_{(r,k,l,\sigma,\omega)}^{\prime\prime}= \textstyle\begin{cases} \frac{\overbrace{\Delta_{(r,k,l)}}\Gamma(l+r-k+1)}{\Gamma (l+r-k+1-\sigma )\omega^{l+r-k}} & \mbox{if $l+r-k \geq\sigma$}, \\ 0 & \mbox{if $l+r-k < \sigma$}. \end{cases} $$
(32)

We can approximate \(t^{l+r-k-\sigma}\) with the Bernstein polynomials as follows:

$$ \begin{aligned} & t^{l+r-k-\sigma}=\sum _{s=0}^{n}c_{(r,s)} \boldsymbol { \phi}_{s,n}(t), \\ & c_{(r,s)}= \int_{0}^{\omega}t^{l+r-k-\sigma} \boldsymbol { \phi}_{s,n}(t)\,dt. \end{aligned} $$
(33)

Using equation (12), we can write

$$ c_{(r,s)}=\mathbf{w}_{(s,n)}\sum _{k^{\prime}=0}^{s}\sum_{l^{\prime }=0}^{n-s} \frac{\overbrace{\Delta_{(s,k^{\prime},l^{\prime })}}}{\omega ^{l^{\prime}+s-k^{\prime}}} \int_{0}^{\omega}t^{l+l^{\prime }+s+r-k-k^{\prime}-\sigma}\,dt. $$
(34)

On further simplification we can get

$$ c_{(r,s)}=\mathbf{w}_{(s,n)}\sum _{k^{\prime}=0}^{s}\sum_{l^{\prime }=0}^{n-s} \frac{\overbrace{\Delta_{(s,k^{\prime},l^{\prime })}}\omega ^{l+r-k-\sigma+1}}{(l+l^{\prime}+s+r-k-k^{\prime}-\sigma+1)}. $$
(35)

Using (35) and (33) in (31) we get

$$ D^{\sigma} \boldsymbol {\phi}_{r,n}(t)=\sum _{s=0}^{n}\mathbf {w}_{(r,n)} \mathbf{w}_{(s,n)}\sum_{k^{\prime}=0}^{s} \sum_{l^{\prime }=0}^{n-s}\sum _{k=0}^{r}\sum_{l=0}^{n-r} \frac{\overbrace{\Delta _{(s,k^{\prime},l^{\prime})}}\Delta_{(r,k,l,\sigma,\omega )}^{\prime \prime}\omega^{l+r-k-\sigma+1}}{(l+l^{\prime}+s+r-k-k^{\prime }+\sigma +1)}\boldsymbol {\phi}_{s,n}(t). $$
(36)

Using the notation

$$ \Omega_{(r,s)}=\mathbf{w}_{(r,n)}\mathbf{w}_{(s,n)}\sum _{k^{\prime }=0}^{s}\sum _{l^{\prime}=0}^{n-s}\sum_{k=0}^{r} \sum_{l=0}^{n-r}\frac{\overbrace{\Delta_{(s,k^{\prime},l^{\prime})}}\Delta _{(r,k,l,\sigma ,\omega)}^{\prime\prime}\omega^{l+r-k-\sigma+1}}{(l+l^{\prime }+s+r-k-k^{\prime}-\sigma+1)}, $$

and evaluating for \(r=0,1,\ldots,n\), and \(s=0,1,\ldots,n\), we complete the proof of the theorem. □

The operational matrices developed in the previous theorems can easily solve FDEs with initial conditions. Here we are interested in the approximate solution of FDEs under complicated types of boundary conditions. Therefore we need some more operational matrices such that we can easily handle the boundary conditions effectively.

The following matrix plays an important role in the numerical simulation of fractional differential equations with variable coefficients.

Theorem 5

For a given function \(f\in C[0,\omega]\), and \(u=\mathbf{H}_{\mathbf {N}}^{\mathbf{T}}\boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf {N}}(\mathbf{t})\), the product of \(f(t)\) and σ order fractional derivative of the function \(u(t) \) can be written in matrix form as

$$ f(t)D^{\sigma}u(t)=\mathbf{H}_{\mathbf{N}}^{\mathbf{T}}\mathbf {Q}_{(N\times N)}^{(f,\sigma,\omega)}\boldsymbol {\mho}^{\boldsymbol {\omega }}_{\mathbf{N}}( \mathbf{t}), $$

where \(\mathbf{Q}_{(N\times N)}^{(f,\sigma,\omega)}=\mathbf {D}_{(N\times N)}^{(\sigma,\omega)}\mathbf{R}_{(N\times N)}^{(f,\omega)}\), and \(\mathbf{D}_{(N\times N)}^{(\sigma,\omega)}\) is an operational matrix for fractional-order derivative and

$$ \mathbf{R}_{(N\times N)}^{(f,\omega)}=\left [ \textstyle\begin{array}{@{}c@{\quad}c@{\quad}c@{\quad}c@{}} \Omega_{(0,0)} & \Omega_{(0,1)} & \cdots& \Omega_{(0,n)} \\ \Omega_{(1,0)} & \Omega_{(1,1)} & \cdots& \Omega_{(1,n)} \\ \vdots& \vdots& \ddots& \vdots\\ \Omega_{(n,0)} & \Omega_{(n,1)} & \cdots& \Omega_{(n,n)} \end{array}\displaystyle \right ], $$
(37)

where

$$ \Omega_{(r,s)}=\sum_{q=0}^{n}d_{q} \Theta_{(q,r,s)}r, \quad s=0,1,\ldots,n, $$

and the entries \(\Theta_{(q,r,s)}\) are defined as in Theorem  1, and \(d_{q}\) are the spectral coefficients of the function \(f(t)\).

Proof

Applying Theorem 4 we can write

$$ D^{\sigma}u(t)=\mathbf{H}_{\mathbf{N}}^{\mathbf{T}} \mathbf {D}_{(N\times N)}^{(\sigma,\omega)}\boldsymbol {\mho}^{\boldsymbol {\omega }}_{\mathbf{N}}( \mathbf{t}) $$
(38)

and

$$ f(t)D^{\sigma}u(t)=\mathbf{H}_{\mathbf{N}}^{\mathbf{T}} \mathbf {D}_{(N\times N)}^{(\sigma,\omega)}\overbrace{\boldsymbol { \mho}^{\boldsymbol {\omega}}_{\mathbf{N}}(\mathbf{t})}, $$
(39)

where

$$ \overbrace{\boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf{N}}(\mathbf {t})}=\bigl[f(t) \boldsymbol {\phi}_{0,n}(t),f(t)\boldsymbol {\phi}_{1,n}(t),\ldots, f(t) \boldsymbol {\phi}_{n,n}(t)\bigr]^{T}. $$

Consider the general element of \(\overbrace{\boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf{N}}(\mathbf{t})}\), and approximate it with normalized Bernstein polynomials as

$$ f(t)\boldsymbol {\phi}_{r,n}(t)=\sum _{s=0}^{n}c_{s}^{r}\boldsymbol { \phi}_{s,n}(t), $$
(40)

where \(c_{i}^{r}\) can easily be calculated as

$$ c_{s}^{r}= \int_{0}^{\omega}f(t)\boldsymbol {\phi}_{r,n}(t) \boldsymbol {\phi} _{s,n}(t)\,dt. $$
(41)

Now as \(f(t)\in C[0,\omega]\), we can approximate it with normalized Bernstein polynomials as

$$ \begin{aligned} & f(t)=\sum_{q=0}^{n}d_{q} \boldsymbol {\phi}_{q,n}(t), \\ & d_{q}= \int_{0}^{\omega}f(t)\boldsymbol {\phi}_{q,n}(t) \,dt. \end{aligned} $$
(42)

Using equation (42) in (41) we get the following estimates:

$$ c_{s}^{r}=\sum_{q=0}^{n}d_{q} \int_{0}^{\omega} \boldsymbol {\phi}_{q,n}(t)\boldsymbol {\phi}_{r,n}(t)\boldsymbol {\phi}_{s,n}(t)\,dt. $$
(43)

In view of Theorem 1 we obtain the following estimate:

$$ c_{s}^{r}=\sum_{q=0}^{n}d_{q} \Theta_{(q,r,s)}. $$
(44)

Using (44) in (40)

$$ f(t)\boldsymbol {\phi}_{r,n}(t)=\sum _{s=0}^{n}\sum_{q=0}^{n}d_{q} \Theta _{(q,r,s)}\boldsymbol {\phi}_{s,n}(t). $$
(45)

Evaluating (45) for \(s=0,1,\ldots, n\) and \(r=0,1,\ldots, n\) we can write

$$ \left [ \textstyle\begin{array}{@{}c@{}} f(t)\boldsymbol {\phi}_{0,n}(t) \\ f(t)\boldsymbol {\phi}_{1,n}(t) \\ \vdots\\ f(t)\boldsymbol {\phi}_{n,n}(t) \end{array}\displaystyle \right ] =\left [ \textstyle\begin{array}{@{}c@{\quad}c@{\quad}c@{\quad}c@{}} \Omega_{(0,0)} & \Omega_{(0,1)} & \cdots& \Omega_{(0,n)} \\ \Omega_{(1,0)} & \Omega_{(1,1)} & \cdots& \Omega_{(1,n)} \\ \vdots& \vdots& \ddots& \vdots\\ \Omega_{(n,0)} & \Omega_{(n,1)} & \cdots& \Omega_{(n,n)} \end{array}\displaystyle \right ] \left [ \textstyle\begin{array}{@{}c@{}} \boldsymbol {\phi}_{0,n}(t) \\ \boldsymbol {\phi}_{1,n}(t) \\ \vdots\\ \boldsymbol {\phi}_{n,n}(t) \end{array}\displaystyle \right ] , $$
(46)

where \(\Omega_{(r,s)}=\sum_{q=0}^{n}d_{q}\Theta_{(q,r,s)}\). In simplified notation, we can write

$$ \overbrace{\boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf{N}}(\mathbf {t})}=\mathbf{R}_{(N\times N)}^{(f,\omega)}\boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf{N}}( \mathbf{t}). $$
(47)

Using (47) in (39) we get the desired result. The proof is complete. □

Since one of our aims in this paper is to solve FDEs under different types of local and non-local boundary conditions, we have to face some complicated situations, so to handle these situations we will use the operational matrix developed in the next theorem.

Theorem 6

Let f be a function of the form \(f(t)=at^{n^{\prime}}\) where \(a\in \mathbb{R}\) and \(n^{\prime}\in\mathbb{N}\), then for any function \(u(t)\in C[0,\omega]\), \(u(t)=\mathbf{H}_{\mathbf{N}}^{\mathbf{T}}\boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf{N}}(\mathbf{t})\), \(\tau\leq \omega\). Then we can generalize the product of \({}_{0}I_{\tau}^{\sigma}u(t)\,dt\) and \(f(t)\) in matrix form as

$$ f(t) _{0}I_{\tau}^{\sigma}u(t)\,dt= \mathbf{H}_{\mathbf{N}}^{\mathbf {T}}\mathbf{W}_{(N\times N)}^{(\sigma,\tau ,a,n',\omega)} \boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf{N}}(\mathbf{t}), $$

where

$$ \mathbf{W}_{(N\times N)}^{(\sigma,\tau,a,n',\omega)}=\left [ \textstyle\begin{array}{@{}c@{\quad}c@{\quad}c@{\quad}c@{}} \Omega_{(0,0)} & \Omega_{(0,1)} & \cdots& \Omega_{(0,n)} \\ \Omega_{(1,0)} & \Omega_{(1,1)} & \cdots& \Omega_{(1,n)} \\ \vdots& \vdots& \ddots& \vdots\\ \Omega_{(n,0)} & \Omega_{(n,1)} & \cdots& \Omega_{(n,n)} \end{array}\displaystyle \right ]. $$
(48)

The entries of the matrix are defined by

$$ \Omega_{(i,j)}=a\Lambda_{(i,\sigma,\tau,\omega)}\mathbf{w}_{(j,n)} \sum_{p=0}^{j}\sum _{q=0}^{n-j}\overbrace{\Delta _{(j,p,q)}} \frac{\omega^{n^{\prime}+1}}{(q+j-p+n+1)}, $$

where

$$ \Lambda_{(i,\sigma,\tau,\omega)}=\mathbf{w}_{(i,n)}\sum _{k=0}^{i}\sum _{l=0}^{n-i}\overbrace{\Delta_{(i,k,l)}} \frac{\Gamma (l+i-k+1)\tau ^{l+i-k+\sigma}}{\Gamma(l+i-k+\sigma+1)\omega^{l+i-k}}. $$

Proof

Consider the general term \(\boldsymbol {\mho}^{\boldsymbol {\omega}}_{\mathbf {N}}(\mathbf{t})\), if we calculate the σ order definite integral from 0 to τ we get

$$ {}_{0}I_{\tau}^{\sigma}u(t)\,dt={}_{0}I_{\tau}^{\sigma} \mathbf {H}_{\mathbf{N}}^{\mathbf{T}}\boldsymbol {\mho}^{\boldsymbol {\omega }}_{\mathbf{N}}( \mathbf{t}) =\sum_{i=0}^{n} c_{i} {}_{0} I_{\tau}^{\sigma}\boldsymbol { \phi}_{i,n}(x). $$
(49)

Using (12) we may write

$$ \begin{aligned} _{0}I_{\tau}^{\sigma}u(t) \,dt& =\sum_{i=0}^{n}c_{i} \mathbf{w}_{(i,n)}\sum_{k=0}^{i} \sum_{l=0}^{n-i}\overbrace{ \Delta_{(i,k,l)}} {}_{0}I_{\tau}^{\sigma} \frac{x^{l+i-k}}{\omega^{l+i-k}} \\ & =\sum_{i=0}^{n}c_{i} \mathbf{w}_{(i,n)}\sum_{k=0}^{i} \sum_{l=0}^{n-i}\overbrace{ \Delta_{(i,k,l)}}\frac{\Gamma(l+i-k+1)\tau ^{l+i-k+\sigma}}{\Gamma(l+i-k+\sigma+1)\omega^{l+i-k}}. \end{aligned} $$
(50)

Using the notation

$$ \Lambda_{(i,\sigma,\tau,\omega)}=\mathbf{w}_{(i,n)}\sum _{k=0}^{i}\sum _{l=0}^{n-i}\overbrace{\Delta_{(i,k,l)}} \frac{\Gamma (l+i-k+1)\tau ^{l+i-k+\sigma}}{\Gamma(l+i-k+\sigma+1)\omega^{l+i-k}}, $$

we can write

$$ at^{n^{\prime}} _{0}I_{\tau}^{\sigma}u(t)\,dt=\sum _{i=0}^{n}c_{i}a\Lambda _{(i,\sigma,\tau,\omega)}t^{n^{\prime}}. $$
(51)

Now \(a\Lambda_{(i,\sigma,\tau,\omega)}t^{n^{\prime}}\) can be approximated with Bernstein polynomials as follows:

$$ a\Lambda_{(i,\sigma,\tau,\omega)}t^{n^{\prime}}=\sum _{j=0}^{n}d_{(i,j)}\boldsymbol { \phi}_{j,n}(t), $$
(52)

where \(d_{(i,j)}\) can be calculated as

$$\begin{aligned} d_{(i,j)} =& a\Lambda_{(i,\sigma,\tau,\omega)} \mathbf{w}_{(j,n)}\sum_{p=0}^{j} \sum_{q=0}^{n-j}\overbrace{ \Delta_{(j,p,q)}}\int_{0}^{\omega}\frac{x^{q+j+n^{\prime}-p}}{\omega^{q+j-p}} \\ =& a\Lambda_{(i,\sigma,\tau,\omega)}\mathbf{w}_{(j,n)}\sum _{p=0}^{j}\sum _{q=0}^{n-j}\overbrace{\Delta_{(j,p,q)}} \frac{\omega ^{n^{\prime}+1}}{(q+j-p+n+1)}. \end{aligned}$$
(53)

Using the notation \(\Omega_{(i,j)}=d_{(i,j)}\) and equation (52) in (51) we get the desired result. The proof is complete. □

4 Application of operational matrices

The operational matrices derived in the previous section play a central role in the numerical simulation of FDEs under different types of boundary conditions. We start our discussion with the following class of FDEs:

$$ D^{\sigma}U(t)=\sum_{i=1}^{p} \lambda_{i}D^{\rho_{i}}U(t)+f(t), $$
(54)

where \(\lambda_{i}\in\mathbf{R}\), \(t\in{}[0,\omega]\), \(f(t)\in C([0,\omega])\). The orders of the derivatives are defined as

$$ 0< \rho_{1}\leq1< \rho_{2}\leq2\cdots p-1< \rho_{p}\leq p< \sigma \leq p+1. $$

The solution to this equation can be assumed in terms of series representation of normalized Bernstein polynomials such that the following relation holds:

$$ D^{\sigma}U(t)=\mathbf{H_{N}^{T}} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t}). $$
(55)

Now by the application of fractional integral of order σ, and use of Theorem 3, we can explicitly write \(U(t)\) as follows:

$$ U(t)-\sum_{i=0}^{p}c_{i}t^{i}= \mathbf{H_{N}^{T}}\mathbf{P}_{(N\times N)}^{(\sigma,\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega }}(\mathbf{t}). $$
(56)

Our main aim is to obtain HNT, which is an unknown vector. We will use this vector to get the solution to the problem.

Type 1: Suppose we have to solve (54) under the following condition:

$$ U(0)=u_{0},\qquad U(\tau_{i})=u_{i},\quad i=1,2,p-1, \qquad U(\omega )=u_{p}, $$
(57)

\(c_{0}\) can easily be obtained using the initial condition \(U(0)=0\). The solution in (56) must satisfy all the conditions, therefore using the conditions at the intermediate and boundary points we have

$$ \begin{aligned} & \sum_{i=1}^{p}c_{i} \tau_{1}^{i}=(u_{1}-u_{0})-\mathbf {H_{N}^{T}}\mathbf{P}_{(N\times N)}^{(\sigma,\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\boldsymbol {\tau}_{\mathbf{1}}), \\ & \sum_{i=1}^{p}c_{i} \tau_{2}^{i}=(u_{2}-u_{0})-\mathbf {H_{N}^{T}}\mathbf{P}_{(N\times N)}^{(\sigma,\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\boldsymbol {\tau}_{\mathbf {2}}), \\ & \vdots\qquad\qquad\qquad\vdots \\ & \sum_{i=1}^{p}c_{i} \tau_{p-1}^{i}=(u_{p-1}-u_{0})-\mathbf {H_{N}^{T}}\mathbf{P}_{(N\times N)}^{(\sigma,\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\boldsymbol {\tau}_{\mathbf {p-1}}), \\ & \sum_{i=1}^{p}c_{i} \tau_{p}^{i}=(u_{p}-u_{0})-\mathbf {H_{N}^{T}}\mathbf{P}_{(N\times N)}^{(\sigma,\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\boldsymbol {\tau}_{\boldsymbol {\omega}}). \\ & \end{aligned} $$
(58)

In order to make the notation simple we use \(\tau_{p}=\omega\) in last equation. Equation (58) can then also be written in matrix form as

$$ \left [ \textstyle\begin{array}{@{}c@{\quad}c@{\quad}c@{\quad}c@{}} \tau_{1} & \tau_{1}^{2} & \cdots& \tau_{1}^{p} \\ \tau_{2} & \tau_{2}^{2} & \cdots& \tau_{2}^{p} \\ \vdots& \vdots& \ddots& \vdots\\ \tau_{p} & \tau_{p}^{p} & \cdots& \tau_{p}^{p} \end{array}\displaystyle \right ] \left [ \textstyle\begin{array}{@{}c@{}} c_{1} \\ c_{2} \\ \vdots\\ c_{p} \end{array}\displaystyle \right ] =\left [ \textstyle\begin{array}{@{}c@{}} (u_{1}-u_{0})-\mathbf{H_{N}^{T}}\mathbf{P}_{(N\times N)}^{(\sigma ,\omega)}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\boldsymbol {\tau}_{\mathbf {1}}) \\ (u_{2}-u_{0})-\mathbf{H_{N}^{T}}\mathbf{P}_{(N\times N)}^{(\sigma ,\omega)}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\boldsymbol {\tau}_{\mathbf {2}}) \\ \vdots\\ (u_{p}-u_{0})-\mathbf{H_{N}^{T}}\mathbf{P}_{(N\times N)}^{(\sigma ,\omega)}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\boldsymbol {\tau}_{\mathbf {p}}) \end{array}\displaystyle \right ]. $$
(59)

The matrix in the left is a Vandermonde matrix, in view of Theorem 2 its inverse exists. Using the inverse of V we get the values of \(c_{i}\):

$$ c_{i}=\sum_{j=1}^{p}b(i,j)\bigl\{ (u_{j}-u_{0})-\mathbf{H_{N}^{T}} \mathbf {P}_{(N\times N)}^{(\sigma,\omega)}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \boldsymbol {\tau}_{\mathbf{j}}) \bigr\} . $$
(60)

Using the values of \(c_{i}\) in equation (56) we may write

$$ U(t)-u_{0}-\sum_{i=1}^{p} \sum_{j=1}^{p}b(i,j)\bigl\{ (u_{j}-u_{0})-\mathbf{ H_{N}^{T}} \mathbf{P}_{(N\times N)}^{(\sigma,\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \boldsymbol {\tau}_{\mathbf{j}}) \bigr\} t^{i}=\mathbf{H_{N}^{T}} \mathbf {P}_{(N\times N)}^{(\sigma,\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t}). $$
(61)

In simplified notation we can write

$$ U(t)-g(t)+\sum_{i=1}^{p}\sum _{j=1}^{p}b(i,j)\bigl\{ t^{i} \mathbf {H_{N}^{T}}\mathbf{P}_{(N\times N)}^{(\sigma,\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\boldsymbol {\tau}_{\mathbf{j}}) \bigr\} =\mathbf{H_{N}^{T}}\mathbf{P}_{(N\times N)}^{(\sigma,\omega )} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t}), $$
(62)

where \(g(t)=u_{0}+\sum_{i=1}^{p}\sum_{j=1}^{p}b_{(i,j)}(u_{j}-u_{0})t^{i}\). Approximating \(g(t)=\mathbf{G_{N}^{T}}\boldsymbol {\mho}_{\mathbf {N}}^{\boldsymbol {\omega}}(\mathbf{t})\) and making use of Theorem 6, we can easily get

$$ U(t)+\mathbf{H_{N}^{T}}\sum _{i=1}^{p}\sum_{j=1}^{p} \bigl\{ \mathbf {W}_{(N\times N)}^{(\sigma,\tau_{j},b_{(i,j)},i,\omega)}\bigr\} \boldsymbol { \mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t}) =\mathbf{H_{N}^{T}} \mathbf{P}_{(N\times N)}^{(\sigma,\omega )}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t})+\mathbf {G_{N}^{T}} \boldsymbol { \mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t}). $$
(63)

In simplified notation we can write

$$ U(t)=\mathbf{H_{N}^{T}}\mathbf{E}_{N\times N}^{1} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t}) +\mathbf{G_{N}^{T}} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega }}(\mathbf{t}), $$
(64)

where

$$ \mathbf{E}_{N\times N}^{1}=\mathbf{P}_{(N\times N)}^{(\sigma,\omega )}- \sum_{i=1}^{p}\sum _{j=1}^{p}\bigl\{ \mathbf{W}_{(N\times N)}^{(\sigma ,\tau _{j},b_{(i,j)},i,\omega)} \bigr\} $$

is \(N\times N\) matrix related to type 1 boundary conditions. For instance we stop the current procedure here and discuss the procedure of obtaining analogous relation for \(U(t)\) under type 2 boundary conditions.

Type 2: Suppose if we need to solve the problem under m-point non-local boundary conditions

$$ U^{j}(0)=u_{j}, \quad j=0,1,\ldots, p-1, \qquad\sum_{i=1}^{m-2}\varphi _{i}U(\tau_{i})=U(\omega). $$
(65)

Then using the initial conditions we can find the first p constants of integrations in equation (56),

$$ U(t)=\mathbf{H_{N}^{T}} \mathbf{P}_{(N\times N)}^{(\sigma,\omega )}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t})+\sum_{l=0}^{(p-1)}u_{l}t^{l}+c_{p}t^{p}. $$
(66)

However, the last constant \(c_{p}\) is unknown. In order to get a relation for \(c_{p}\) we use nonlocal boundary conditions. Using the m-point boundary condition we get

$$\begin{aligned}& U(\omega)=\mathbf{H_{N}^{T}} \mathbf{P}_{(N\times N)}^{(\sigma ,\omega)}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \boldsymbol {\omega})+\sum_{l=0}^{(p-1)}u_{l} \omega ^{l}+c_{n}\omega^{n}, \end{aligned}$$
(67)
$$\begin{aligned}& \sum_{i=0}^{m-2} \varphi_{i}U(\tau_{i})=\mathbf{H_{N}^{T}} \sum_{i=0}^{m-2}\varphi_{i} \mathbf{P}_{(N\times N)}^{(\sigma,\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \boldsymbol {\tau}_{\mathbf{i}}) +\sum_{i=0}^{m-2} \sum_{l=0}^{(p-1)}\varphi_{i}u_{l}\tau_{i}^{l}+c_{p} \sum_{i=0}^{m-2}\varphi_{i}\tau ^{p}. \end{aligned}$$
(68)

From (65), we see that left sides of (67) and (68) are equal, therefore for the sake of obtaining the value of \(c_{p}\), we can write

$$\begin{aligned}& \begin{aligned}[b] & \Biggl\{ \mathbf{H_{N}^{T}} \mathbf{P}_{(N\times N)}^{(\sigma,\omega )} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \boldsymbol {\omega})-\sum_{i=0}^{m-2} \varphi_{i}\mathbf{P}_{(N\times N)}^{(\sigma,\omega)} \boldsymbol { \mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\boldsymbol {\tau}_{\mathbf{i}}) \Biggr\} +\Biggl\{ \sum_{l=0}^{(p-1)}u_{l} \omega^{l}-\sum_{i=0}^{m-2}\sum _{l=0}^{(p-1)}\varphi_{i}u_{l} \tau_{i}^{l}\Biggr\} \\ & \quad=c_{p}\Biggl\{ \sum _{i=0}^{m-2}\varphi_{i} \tau_{i}^{p}-\omega^{p}\Biggr\} . \end{aligned} \end{aligned}$$
(69)

On further simplification we get

$$ c_{p}=\Biggl\{ \mathbf{H_{N}^{T}} \frac{1}{\zeta_{1}}\mathbf{P}_{(N\times N)}^{(\sigma,\omega)}\boldsymbol { \mho}_{\mathbf{N}}^{\boldsymbol {\omega }}(\boldsymbol {\omega})-\sum _{i=0}^{m-2}\frac{\varphi_{i}}{\zeta_{1}}\mathbf{P}_{(N\times N)}^{(\sigma ,\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\boldsymbol {\tau}_{\mathbf {i}}) \Biggr\} + \zeta_{2}, \quad\zeta _{1}\neq0, $$
(70)

where \(\zeta_{1}=\{\sum_{i=0}^{m-2}\varphi_{i}\tau_{i}^{p}-\omega ^{p}\}\) and \(\zeta_{2}=\frac{1}{\zeta_{1}}\{\sum_{l=0}^{(n-1)}u_{l}\tau ^{l}-\sum_{i=0}^{m-2}\sum_{l=0}^{(p-1)}\varphi_{i}u_{l}\tau _{i}^{l}\}\). Now, using (70) in (66) we get

$$\begin{aligned} U(t) =& \mathbf{H_{N}^{T}} \mathbf{P}_{(N\times N)}^{(\sigma,\omega )}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t})+\sum_{l=0}^{(p-1)}u_{l}t^{l} \\ &{}+ \mathbf {H_{N}^{T}}\frac{t^{p}}{\zeta_{1}}\Biggl\{ \mathbf{P}_{(N\times N)}^{(\sigma,\omega )} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \boldsymbol {\omega})-\sum_{i=0}^{m-2} \frac{\varphi_{i}t^{p}}{\zeta_{1}}\mathbf{P}_{(N\times N)}^{(\sigma,\omega)} \boldsymbol { \mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\boldsymbol {\tau}_{\mathbf{i}}) \Biggr\} + \zeta_{2}t^{p}. \end{aligned}$$
(71)

Now, in view of Theorem 6, we can write (71) as

$$\begin{aligned} U(t) = & \mathbf{H_{N}^{T}}\mathbf{P}_{(N\times N)}^{(\sigma,\omega )} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t})+\mathbf {H_{N}^{T}}\mathbf{W}_{(N\times N)}^{(\sigma ,\omega,\frac{1}{\zeta_{1}},p,\omega)} \boldsymbol {\mho}_{\mathbf {N}}^{\boldsymbol {\omega}}(\mathbf{t}) \\ & {}-\sum _{i=0}^{m-2}\mathbf{H_{N}^{T}} \mathbf{W}_{(N\times N)}^{(\sigma ,\tau _{i},\frac{\varphi_{i}}{\zeta_{1}},p,\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t})+\mathbf {G_{N}^{T}}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf {t}). \end{aligned}$$
(72)

Here \(\sum_{l=0}^{(p-1)}u_{l}t^{l}+\zeta_{2}t^{p}=\mathbf{G_{N}^{T}}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t})\). On further simplification we can write

$$ U(t)=\mathbf{H_{N}^{T}} \mathbf{E}_{N\times N}^{2} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t})+\mathbf{G_{N}^{T}} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t}), $$
(73)

where

$$ E_{N\times N}^{2}=\mathbf{P}_{(N\times N)}^{(\sigma,\omega)}+ \mathbf {W}_{(N\times N)}^{(\sigma,\omega,\frac{1}{\zeta_{1}},p,\omega )}-\sum _{i=0}^{m-2}\mathbf{W}_{(N\times N)}^{(\sigma,\tau_{i},\frac {\varphi_{i}}{\zeta_{1}},p,\omega)}. $$

We see that for both local and non-local boundary conditions we get \(U(t)\) in matrix form as

$$ U(t)=\mathbf{H_{N}^{T}}\mathbf{E}_{N\times N} \boldsymbol { \mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t})+\mathbf{G_{N}^{T}} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega }}(\mathbf{t}). $$
(74)

Here HNT is an unknown vector to be determined. Note that we use \(E=E^{1}\) if type 1 boundary conditions are given, otherwise use \(E=E^{2}\). Now using (74) and using Theorem 4, we can write

$$ \sum_{i=1}^{p} \lambda_{i}D^{\rho_{i}}U(t)=\mathbf {H_{N}^{T}} \mathbf{E}_{N\times N}\sum_{i=1}^{p} \lambda_{i}\mathbf{D}_{(N\times N)}^{(\rho _{i},\omega)} \boldsymbol { \mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t})+\mathbf {G_{N}^{T}}\sum_{i=1}^{p}\lambda_{i} \mathbf{D}_{(N\times N)}^{(\rho _{i},\omega)}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t}). $$
(75)

Approximating \(f(t)=\mathbf{F_{N}^{T}} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t})\), and using (75), (55) in (54) we may write

$$ \mathbf{H_{N}^{T}}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega }}( \mathbf{t})=\mathbf {H_{N}^{T}}\mathbf{E}_{N\times N} \sum_{i=1}^{p}\lambda_{i} \mathbf{D}_{(N\times N)}^{(\rho _{i},\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t})+\mathbf {G_{N}^{T}}\sum _{i=1}^{p}\lambda_{i}\mathbf{D}_{(N\times N)}^{(\rho _{i},\omega)}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t})+\mathbf{F_{N}^{T}} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t}). $$
(76)

After a long calculation and simplification we get

$$ \mathbf{H_{N}^{T}}-\mathbf{H_{N}^{T}} \mathbf{E}_{N\times N}\sum_{i=1}^{p} \lambda_{i}\mathbf{D}_{(N\times N)}^{(\rho _{i},\omega )}+ \mathbf{G_{N}^{T}}\sum_{i=1}^{p} \lambda_{i}\mathbf{D}_{(N\times N)}^{(\rho_{i},\omega)}- \mathbf{F_{N}^{T}}=0. $$
(77)

We see that (77) is an easily solvable matrix equation and it can easily be solved for HNT, by using HNT in (74) this will lead us to an approximate solution to the problem.

Next, we consider the linear FDEs with variable coefficients,

$$ D^{\sigma}U(t)=\sum_{i=1}^{p} \lambda_{i}(t)D^{\rho_{i}}U(t)+f(t), $$
(78)

where \(\lambda_{i}(t)\in C([0,\omega])\), \(t\in{}[0,\omega]\), \(f(t)\in C([0,\omega])\). We start our analysis with the initial assumption

$$ D^{\sigma}U(t)=\mathbf{H_{N}^{T}}\boldsymbol { \mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t}). $$
(79)

Using the integral of order σ we can write

$$ U(t)=\mathbf{H_{N}^{T}} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t}) +\sum_{i=0}^{p}c_{i}t^{i}. $$
(80)

We can of course get \(U(t)\) as

$$ U(t)=\mathbf{H_{N}^{T}} \mathbf{E}_{N\times N} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t})+ \mathbf{G_{N}^{T}}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega }}( \mathbf{t}), $$
(81)

where \(E_{N\times N}\), \(\mathbf{G_{N}^{T}} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t})\) can be analogously derived as in the previous section depending on the type of boundary conditions to be used. Using (81) and Theorem 5, we can easily write

$$ \sum_{i=1}^{p} \lambda_{i}(t)D^{\rho_{i}}U(t)=\mathbf {H_{N}^{T}} \mathbf{E}_{N\times N}\sum_{i=1}^{p} \mathbf{Q}_{(N\times N)}^{(\lambda _{i}(t),\rho_{i},\omega)}\boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t})+ \mathbf{ G_{N}^{T}}\sum _{i=1}^{p}\mathbf{Q}_{(N\times N)}^{(\lambda _{i}(t),\rho _{i},\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t}). $$
(82)

Approximating \(f(t)=\mathbf{F_{N}^{T}}\boldsymbol {\mho}_{\mathbf {N}}^{\boldsymbol {\omega}}(\mathbf{t})\), and using (82), (79) in (78) we may write

$$\begin{aligned} \mathbf{H_{N}^{T}} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t}) =& \mathbf {H_{N}^{T}}\mathbf{E}_{N\times N} \sum_{i=1}^{p}\mathbf{Q}_{(N\times N)}^{(\lambda _{i}(t),\rho_{i},\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t}) \\ &{}+\mathbf{ G_{N}^{T}}\sum_{i=1}^{p} \mathbf{Q}_{(N\times N)}^{(\lambda _{i}(t),\rho _{i},\omega)} \boldsymbol {\mho}_{\mathbf{N}}^{\boldsymbol {\omega}}( \mathbf{t})+\mathbf {F_{N}^{T}} \boldsymbol { \mho}_{\mathbf{N}}^{\boldsymbol {\omega}}(\mathbf{t}). \end{aligned}$$
(83)

On rearranging we get

$$ \mathbf{H_{N}^{T}}-\mathbf{H_{N}^{T}} \mathbf{E}_{N\times N}\sum_{i=1}^{p}\mathbf{Q}_{(N\times N)}^{(\lambda_{i}(t),\rho_{i},\omega )}+\mathbf{G_{N}^{T}} \sum_{i=1}^{p}\mathbf{Q}_{(N\times N)}^{(\lambda _{i}(t),\rho _{i},\omega)}- \mathbf{F_{N}^{T}}=0. $$
(84)

Now, we consider the nonlinear FDEs. The nonlinear FDEs are often very difficult to solve with operational matrix techniques. One way is to use the collocation method, by doing so the FDEs result in nonlinear algebraic equations. These nonlinear algebraic equations are then solved iteratively using the Newton method or some other iterative method. The second approach is to linearize the nonlinear part of the fractional differential equation using a quasilinearization technique. Doing so the nonlinear fractional differential equations is converted to a recursively solvable linear differential equations. This technique was introduced recently and has been used to find an approximate solution of many scientific problem. The quasilinearization method was introduced by Bellman and Kalaba [55] to solve nonlinear ordinary or partial differential equations as a generalization of the Newton-Raphson method. The origin of this method lies in the theory of dynamic programming. In this method, the nonlinear equations are expressed as a sequence of linear equations and these equations are solved recursively. The main advantage of this method is that it converges monotonically and quadratically to the exact solution of the original equations [56]. Also some other interesting work in which quasilinearization method is applied to scientific problems is in [5760]. Consider a nonlinear fractional-order differential equation of the form

$$ D^{\sigma}U(t)+\sum_{i=1}^{p} \lambda_{i}D^{\rho _{i}}U(t)=F\bigl(U(t)^{\rho_{0}},U(t)^{\rho_{1}}, \ldots, U(t)^{\rho _{p}}\bigr)+f(t). $$
(85)

The general procedure of this method is as given now. First solve the linear part with a given set of local or nonlocal conditions

$$ D^{\sigma}U(t)+\sum_{j=1}^{p} \lambda_{i}D^{\rho_{i}}U(t)=f(t). $$
(86)

This equation can easily be solved using the method developed in the previous discussion. Label the solution at this step as \(U_{0}(t)\).

The next step is to linearize the nonlinear part with a multivariate Taylor series expansion about \(U_{0}(t)\). So after linearizing and simplification we get

$$ \begin{aligned} & D^{\sigma}U_{(1)}(t)+\sum _{j=0}^{p}\lambda_{j}D^{\rho _{j}}U_{(1)}(t)\\ & \quad= F(\bigl(U_{(0)}(t),U_{(0)}^{\gamma _{1}}(t),U_{(0)}^{\rho _{2}}(t), \ldots, U_{(0)}^{\rho_{n}}(t)\bigr) \\ &\qquad {}+\sum_{j=0}^{n}\bigl(U_{(1)}^{\rho_{j}}-U_{(0)}^{\rho _{i}} \bigr)\frac{ \partial f}{\partial U^{\rho_{j}}}\bigl(U_{(0)}(t),U_{(0)}^{\rho _{1}}(t),U_{(0)}^{\rho_{2}}(t), \ldots, U_{(0)}^{\rho_{n}}(t)\bigr)+f(t). \end{aligned} $$
(87)

The above equation is an FDE with variable coefficients. It can easily be solved with the method developed in Section 4.2. The solution at this stage will be labeled \(U_{1}(t)\) and is the solution of the problem at first iteration. Again we have to linearize the problem about \(U_{1}(t)\) to obtain the solution at second iteration. The whole process can be seen as a recurrence relation like

$$ D^{\sigma}U_{(r+1)}(t)+\sum _{j=0}^{n}b_{j}(t)D^{\rho _{j}}U_{(r+1)}(t)=\overbrace{F(t)}. $$

And the boundary conditions become

$$ U_{r+1}^{j}(0)=u_{j},\qquad U_{r+1}(\tau)= \sum_{i=0}^{m-2}\zeta _{i}U_{r+1}( \eta_{i}), $$

where \(b_{j}(t)=\lambda_{j}-\frac{\partial f}{\partial U^{\rho _{j}}}(U_{(r)}(t),U_{(r)}^{\rho_{1}}(t),U_{(r)}^{\rho_{2}}(t),\ldots, U_{(r)}^{\rho_{n}}(t))\) and

$$ \overbrace{F(t)}=f\bigl(U_{(r)}(t),U_{(r)}^{\rho _{1}}(t),U_{(r)}^{\rho _{2}}(t), \ldots, U_{(r)}^{\rho_{n}}(t)\bigr)-\sum _{j=0}^{n}U_{(r)}^{\rho _{j}} \frac{\partial f}{\partial U^{\rho_{j}}}+g(t). $$

It can be easily noted that the above equation is fractional differential equation with variable coefficients. Using the initial solution \(X_{0}(t)\) we may start the iterations. The coefficients \(b_{i}(t)\) and the source term \(\overbrace{F(t)}\) can be updated at every iteration r to get the next solution at \(r+1\). At every step we may solve the problem at given nonlocal boundary conditions. We assume that the method converges to the exact solution of the problem if there is convergence at all.

5 Examples

To show the applicability and efficiency of the proposed method, we solve some fractional differential equations. The numerical simulation is carried out using MatLab. However, we believe that the algorithm can be simulated using any simulation tool kit.

Example 1

As a first problem we solve the following linear integer order boundary value problem

$$ D^{4}U(t)=\frac{1}{10}D^{2}U(t)+ \frac{1}{100}DU(t)+\frac{1}{10}U(t)+g(t), $$
(88)

where

$$ g(t)= \biggl( \frac{1}{100} \biggr) \cdot \bigl( 1000 {\pi}^{2} \sin ( \pi t ) -\pi\cos ( \pi t ) -10 \sin ( \pi t ) +100 {\pi}^{4} \sin ( \pi t ) \bigr) . $$

We can easily see that the exact solution is \(U(t)=\sin(\pi t)\). We test our algorithm by solving this problem under the following sets of boundary conditions:

$$\begin{aligned}& \mathbf{S_{1}}=\biggl\{ U(0)=0,U\biggl(\frac{3}{4} \biggr)=0.70710,U\biggl(\frac{3}{2}\biggr)=-1, U(3)=0\biggr\} , \\& \mathbf{S_{2}}=\bigl\{ U(0)=0, U(.5)=1,U(2.5)=1,U(3)=0\bigr\} , \\& \mathbf{S_{3}}= \bigl\{ U(0)=0,U^{\prime}(0)= \pi,U^{\prime\prime}(0)=0,\\& \phantom{\mathbf{S_{3}}=}{} U(1)+1.5U(1.375)+U(1.75)+0.8U(2.125)+1.787U(2.5)=U(3) \bigr\} . \end{aligned}$$

We approximate the solution to this problem with different types of boundary conditions and observe that the approximate solution is very accurate. For illustration purposes we calculate the absolute difference at a different scale levels. The results are displayed in Figure 1 and Figure 2 for boundary conditions \(S_{1}\) and \(S_{2}\), respectively. We compare the exact solution and approximate solution under boundary conditions \(S_{1}\) at different scale levels, and the results are displayed in Table 1. It can easily be noted that with increase of scale level, that the approximate solution becomes more and more accurate, and at scale level \(N=11\), the approximate solution is accurate up to the seventh digit. The accuracy may be increased by using a high scale level. For instance we simulate the algorithm at high scale level and measure \(\Vert E_{N}\Vert_{2}\) and \(\Vert E_{N}\Vert_{\infty}\) at each scale level N. Table 2 shows these results at high scale levels under boundary conditions \(S_{1}\) and \(S_{2}\). From this example, we conclude that the proposed method is convergent for integer order differential equations (linear).

Figure 1
figure 1

Absolute difference of exact and approximate solution for different values of N under boundary condition \(\pmb{S_{1}}\) . Here we fix \(\omega=3\), and use notation \(E_{N}=|U_{\mathrm{exact}}-U_{N}|\).

Figure 2
figure 2

Absolute difference of exact and approximate solution for different values of N under boundary condition \(\pmb{S_{2}}\) . Here we fix \(\omega=3\), and use the notation \(E_{N}=|U_{\mathrm{exact}}-U_{N}|\).

Table 1 Comparison of exact and approximate solution of Example  1 using the boundary condition as defined in \(\pmb{\mathbf{S_{1}}}\)
Table 2 Comparison of exact and approximate solution of Example  1 using the boundary condition as defined in \(\pmb{\mathbf{S_{1}}}\)

To show the efficiency of proposed method in solving nonlocal m-point boundary problem, we solve Example 1 under a 7-point nonlocal boundary condition as defined in \(S_{3}\). We observe that the method works well, the absolute difference is much less than 10−5, a very high accuracy for such complicated problems. We compare the approximate solution with the exact solution at different scale levels. We also calculate \(\Vert E\Vert _{2}\) at different scale levels. The results are displayed in Figure 3.

Figure 3
figure 3

Simulation and observation of Example  1 . (a) Comparison of approximate solution at different scale levels with the exact solution. (b) Absolute difference of exact and approximate solution. (c) Convergence of \(\|E\|_{2} \) at different scale levels.

Example 2

As a second example consider the following fractional-order differential equation:

$$ D^{3.8}U(t)+D^{1.7}U(t)+D^{0.7}U(t)+U(t)=g(t). $$
(89)

Here we consider \(g(t)\) as

$$\begin{aligned} g(t) = & \frac{14{,}714{,}941{,}010{,}515{,}305 t^{\frac{1}{5}} (4375 t^{3} - 24{,}000 t^{2} + 39{,}600 t - 19{,}008 )}{99{,}079{,}191{,}802{,}150{,}912}- t^{3} { (t - 3 )}^{4} \\ &{}- \bigl(150{,}543{,}064{,}388{,}819{,}875 t^{\frac {13}{10}} (2{,}800{,}000 t^{4} - 25{,}440{,}000 t^{3} \\ &{}+ 82{,}044{,}000 t^{2} - 108{,}298{,}080 t + 46{,}703{,}547 )\bigr) \\ &{}/{16{,}878{,}660{,}489{,}253{,}369{,}151{,}488} \\ &{}- \bigl( 752{,}715{,}321{,}944{,}099{,}375 t^{\frac{23}{10}} (400{,}000 t^{4} - 4{,}320{,}000 t^{3} + 17{,}172{,}000 t^{2} \\ &{}- 29{,}535{,}840 t + 18{,}275{,}301 )\bigr)/{75{,}953{,}972{,}201{,}640{,}161{,}181{,}696}. \end{aligned}$$
(90)

We consider the following two types of boundary conditions:

$$\begin{aligned} \mathbf{S_{1}} =& \bigl\{ U(0)=0, U(0.5)=4.83, U(0.25)=0.977, U(3)=0\bigr\} , \\ \mathbf{S_{2}} =&\bigl\{ U(0)=0,U'(0)=0,U''(0)=0,\\ &{} U(1)+1.5U(1.375)+U(1.75)+0.8U(2.125)-62.233U(2.5)=U(3)\bigr\} . \end{aligned}$$

It can easily be observed that the exact solution of the problem is \(U(t)= t^{3} { (t - 3 )}^{4} \).

We solve this problem with the proposed method under boundary conditions \(S_{1}\), and we observe that the approximate solution obtained via the new method is very accurate even for very small value of N. Figure 4(a) shows the comparison of the approximate solution with the exact solution. One can easily see that the approximate solution matches very well with the exact solution. In the same figure we also display the absolute error obtained with the new method. It is clear that the absolute error is less than 10−4 at scale level \(N=7\). We measure \(\|E\|_{2}\) at different values of N and observe that the method is highly convergent. We also approximate solution of this problem under boundary condition \(\mathbf{S_{2}}\). The results are displayed in Figure 5. We can easily observe that the approximate solution of the method converges to the exact solution as the value of N increases.

Figure 4
figure 4

Example  2 . (a) Comparison of approximate solution with the exact solution under boundary condition \(\mathbf{S_{1}}\). (b) Absolute error obtained with the new method at different scale levels. (c) \(\|E\| _{2}\) obtained with the new method at different values of N.

Figure 5
figure 5

Example  2 . (a) Comparison of approximate solution with the exact solution under boundary condition \(\mathbf{S_{2}}\). (b) Absolute error obtained with the new method at different scale levels. (c) \(\|E\| _{2}\) obtained with the new method at different values of N.

Example 3

As a third example consider the following fractional differential equation with variable coefficients:

$$ D^{2.5}U(t)+\bigl(t^{3}-t^{2}-2 \bigr)D^{1.5}+\bigl(t^{2}+1\bigr)D^{0.5}U(t)+tU(t)=g(t). $$
(91)

We consider the following types of boundary conditions:

$$\begin{aligned}& \mathbf{S_{1}} =\bigl\{ U(0)=1, U'(0)=1, U(0.5)+1.5U(0.625)+U(0.75)-1.61U(0.875)=U(1)\bigr\} , \\& \mathbf{S_{1}}=\bigl\{ U(0)=1, U(0.6)=1.8221, U(1)=2.718\bigr\} . \end{aligned}$$

We select a suitable \(g(t)\), such that the exact solution of the problem is \(e^{t}\). We simulate the proposed algorithm to solve this problem under boundary conditions \(S_{1}\) and we observe that the method works well. The results are displayed in Figure 6. In this figure we display the comparison of the exact and the approximate solution, the absolute error of approximation and the square norm of the error. One can easily conclude that the method is highly efficient. We solve the problem under boundary condition \(S_{2}\) and the results are displayed in Table 3. One can easily see that the approximate solution is much more accurate.

Figure 6
figure 6

Example  3 . (a) Comparison of the approximate solution with the exact solution under boundary condition \(\mathbf{S_{1}}\). (b) Absolute error obtained with the new method at different scale levels. (c) \(\|E\|_{2}\) obtained with the new method at different values of N.

Table 3 Comparison of exact and approximate solution of Example  3 using the boundary condition as defined in \(\pmb{\mathbf{S_{2}}}\)

Example 4

As a last example consider the following nonlinear fractional differential equation:

$$ D^{2.8}U(t)+D^{0.8}U(t)+U(t)=D^{0.8}UU+U^{2}+ \bigl(D^{0.8}U\bigr)^{2} +g(t), $$
(92)

with boundary conditions

$$\begin{aligned} \mathbf{S_{1}} =& \bigl\{ U(0)=1, U(0.5)=1.087, U(1)=1.1814 \bigr\} , \\ \mathbf{S_{2}} =& \biggl\{ U(0)=1, U'(0)=1, \\ &{}0.5U\biggl( \frac{1}{2}\biggr)+0.667U\biggl(\frac {2}{3}\biggr)+0.75U\biggl( \frac{1}{4}\biggr)-0.333U\biggl(\frac{7}{8}\biggr)=U(1)\biggr\} . \end{aligned}$$

Select a suitable \(g(t)\) such that the exact and unique solution of the above problem is \(U(t)=e^{t/6}\). We approximate the solution of this problem with the iterative method proposed in the paper under boundary condition \(S_{1}\). We carry out the iteration at different scale levels N. We observe that the method converges more rapidly to the exact solution for high values of N. For instance, at some values of N we calculate \(\|E\|_{2}\) at each iteration. The results are displayed in Figure 7, one can see that \(\|E\|_{2}\) falls below 10−12 at the fifth iteration using scale level \(N=7\). On solving the problem under boundary conditions \(S_{2}\) we observe that the method provides very accurate estimate of solution. The results are displayed in Table 4.

Figure 7
figure 7

Example  2 , \(\pmb{\|E\|_{2}}\) vs. iteration, for Example  4 , obtained with the new method at different values of N . Here we use boundary conditions \(\pmb{S_{1}}\) .

Table 4 Comparison of exact and approximate solution of Example  4 using the boundary condition as defined in \(\pmb{\mathbf{S_{2}}}\)

6 Conclusion

From experimental results and analysis of the proposed method we conclude that the method is efficient in solving linear and nonlinear fractional-order differential equations under different types of boundary conditions. The method has the ability to solve both local and nonlocal boundary value problems. We use normalized Bernstein polynomials for our analysis. But the method can be used to generalize such types of operational matrices for almost all types of orthogonal polynomials. It is also possible to get a more approximate solution of such problems using other types of orthogonal polynomials like Legendre, Jacobi, Laguerre, Hermite etc. It is not clear to us which is the best set of orthogonal polynomials for this method. Further investigation is required to generalize the method to solve other types of scientific problems.