1 Introduction

Fractional calculus (FC) is developing fast, and its various applications are extensively used in many fields of science and engineering. There is a rich literature on the theoretical research of fractional differential equations (FDEs). An introduction to the FDEs, their methods of solutions and some of their applications can be seen in [1]. Kilbas et al. [2] presented the basic concepts of FDEs and their applications. In [3], Baleanu et al. reported new advances in nanotechnology and FC. In addition, the local fractional integral transforms and their applications have been investigated in [4]. We recall that the fractional-order representation provides more realistic behaviors of many real-world phenomena [5]. Due to this fact, the FC has some interesting applications in bioengineering [6], vibration equation [7], hydrologic modeling [8], mobile–immobile advection–dispersion equation [9], heat transfer [10], diffusion and subdiffusion processes [11], viscoelasticity [12], optimization [13], etc. Therefore, finding valuable fractional numerical techniques is one of the most interesting topics in the area of FC [14]. In [15], an efficient finite difference method has been proposed to solve FDEs accurately and robustly. In [16], a piecewise integro quadratic spline interpolation has been used to solve FDEs appeared in the area of fluid dynamics. In [17], a toolbox package in MATLAB has been developed for solving FDEs with spectral convergence based on the operational matrix of fractional differentiation.

The application of FC in the optimal control problems is a strong topic to be considered. In [18], Agrawal formulated the fractional optimal control problems (FOCPs) in terms of Riemann–Liouville fractional derivative (FD). The state and control variables were considered in the form of truncated series, and the solution was obtained by using a virtual work-based approach. In [19], Agrawal converted this fractional problem (in the Caputo sense) into a system of algebraic equations by substituting the FDEs with Volterra-type integral equations. In [20], the FOCPs were considered in the sense of Riemann–Liouville, and the Grünwald–Letnikov approximation was used for the FDs. In [21], a central difference formula was derived in order to modify the Grünwald–Letnikov definition for the optimal control of fractional-order dynamic systems. In [22], necessary conditions of the FOCPs in the sense of Caputo were investigated. In the past decade, Frederico and Torres [23] presented a Noether-type theorem for the FOCPs in the Caputo sense. Recently, Almeida and Torres [24] presented a solution scheme for this problem, in which the original fractional problem is approximated by a new integer one. The latter integer problem is then solved numerically by using the finite difference methods. In [25], a shooting method-like procedure was used for the FOCPs. In [26], a combination of variational and penalty methods was provided for solving a class of FOCPs. In [27], a simple accurate scheme based on the Ritz’s direct method was developed to solve fractional variational and optimal control problems. In [28], a finite horizon linear quadratic optimal control problem was studied for a class of discrete-time fractional-order systems with multiplicative noise. The numerical solution of FOCPs was also investigated based on the pseudospectral method, Legendre orthogonal polynomials and Chebyshev–Legendre operational technique in [29,30,31], respectively.

The FC brings new features in describing complex behaviors of the real-world phenomena with memory effects. However, the description of systems with memory effect is still a big challenge for researchers, since the classic type of FDs with singular kernel cannot characterize always properly the nonlocal dynamics. Hence, it seems there is a need of new FDs with nonsingular kernel to better describe the nonlocality of complex systems. One of the best candidates among existing kernels is the one based on Mittag–Leffler function [32]. As a result, recently a new FD with nonlocal and nonsingular kernel was constructed by using the generalized Mittag–Leffler function [32] and applied to several real-world problems [33,34,35,36]. One of the main advantages of this approach is that we have a new asymptotic behavior which differs from the classic version of fractional operators. However, the properties of FC with Mittag–Leffler nonsingular kernel should be deeply investigated and the related numerical methods should be continuously developed in order to have a better analysis of real-world models within this new calculus. Inspired by the above discussion, the main contribution of this paper is to develop a new formulation of the FOCPs involving Mittag–Leffler nonsingular kernel. Indeed, we believe that the models based on this new derivative have the potential to better control the undesirable behavior of the real-world phenomena than the other FC derivatives. In this paper, the Lagrange multiplier within the calculus of variations and the fractional integration by parts formula are used to derive the necessary optimality conditions in the form of a nonlinear two-point fractional boundary value problem (BVP). To solve this type of BVP, a numerical scheme is presented and its error analysis is also investigated. Finally, the numerical simulations verifying the theoretical analysis are included.

The rest of this paper is structured in the following way. In Sect. 2, we briefly review the new FDs with nonlocal and nonsingular kernel. Section 3 is devoted to the problem statement, which is followed by the necessary optimality conditions in terms of a fractional two-point BVP. In Sect. 4, we solve this problem by a numerical scheme and prove its convergence by using the generalized discrete Grönwall’s inequality. Numerical findings and comparative results are reported in Sect. 5, which demonstrate the efficiency of the suggested technique. Finally, we finish the paper by a conclusion part.

2 Definitions and Preliminaries

Here, we briefly recall some basic definitions and results related to the new FDs with Mittag–Leffler nonsingular kernel (AB) defined in [32].

Definition 2.1

[32] For \(f \in {\mathcal {H}}^1(t_0,t_f)\) and \(0< \alpha < 1\), the (left) AB FD in the Riemann–Liouville sense is defined by

$$\begin{aligned} {\displaystyle ^{R}_{{t_0}}D_t^{\alpha } f(t)}=\frac{B(\alpha )}{1-\alpha }\frac{\mathrm{d}}{\mathrm{d}t}\int _{t_0}^t f(\tau ) E_\alpha \left( -\alpha \frac{(t-\tau )^\alpha }{1-\alpha }\right) \mathrm{d}\tau , \end{aligned}$$
(1)

and in the Caputo sense is given by

$$\begin{aligned} {\displaystyle ^{C}_{{t_0}}D_t^{\alpha } f(t)}=\frac{B(\alpha )}{1-\alpha }\int _{t_0}^t \frac{\mathrm{d}f(\tau )}{\mathrm{d}\tau } E_\alpha \left( -\alpha \frac{(t-\tau )^\alpha }{1-\alpha }\right) \mathrm{d}\tau , \end{aligned}$$
(2)

where \(B(\alpha )\) is a normalization function obeying \(B(0)=1\) and \(B(1) = 1\). The symbol \(E_\alpha \) denotes the generalized Mittag–Leffler function

$$\begin{aligned} E_\alpha (t)=\sum _{k=0}^\infty \frac{t^{k}}{\varGamma (\alpha k+1)}. \end{aligned}$$
(3)

The associated fractional integral is also defined as

$$\begin{aligned} {\displaystyle ^{}_{{t_0}}I_t^{\alpha } f(t)}=\frac{1-\alpha }{B(\alpha )}f(t)+\frac{\alpha }{B(\alpha )\varGamma (\alpha )}\int _{t_0}^t (t-\tau )^{\alpha -1}f(\tau )\mathrm{d}\tau . \end{aligned}$$
(4)

Definition 2.2

[32] For \(f \in {\mathcal {H}}^1(t_0,t_f)\) and \(0< \alpha < 1\), the (right) AB FD in the Riemann–Liouville sense is defined by

$$\begin{aligned} {\displaystyle ^{R}_{{t}}D_{t_f}^{\alpha } f(t)}=-\frac{B(\alpha )}{1-\alpha }\frac{\mathrm{d}}{\mathrm{d}t}\int _t^{t_f} f(\tau ) E_\alpha \left( -\alpha \frac{(\tau -t)^\alpha }{1-\alpha }\right) \mathrm{d}\tau , \end{aligned}$$
(5)

and in the Caputo sense is given by

$$\begin{aligned} {\displaystyle ^{C}_{{t}}D_{t_f}^{\alpha } f(t)}=-\frac{B(\alpha )}{1-\alpha }\int _t^{t_f} \frac{\mathrm{d}f(\tau )}{\mathrm{d}\tau } E_\alpha \left( -\alpha \frac{(\tau -t)^\alpha }{1-\alpha }\right) \mathrm{d}\tau . \end{aligned}$$
(6)

The associated fractional integral is also defined as

$$\begin{aligned} {\displaystyle ^{}_{{t}}I_{t_f}^{\alpha } f(t)}=\frac{1-\alpha }{B(\alpha )}f(t)+\frac{\alpha }{B(\alpha )\varGamma (\alpha )}\int _t^{t_f} (\tau -t)^{\alpha -1}f(\tau )\mathrm{d}\tau . \end{aligned}$$
(7)

There are useful relations between the left and right AB FDs in the Riemann–Liouville and Caputo senses and the associated AB fractional integrals as the following formulas state [32]

$$\begin{aligned} \displaystyle ^{}_{{t_0}}I_t^{\alpha } \left\{ \displaystyle ^{R}_{{t_0}}D_t^{\alpha } f(t)\right\}= & {} \displaystyle ^{}_{{t}}I_{t_f} \left\{ \displaystyle ^{R}_{{t}}D_{t_f}^{\alpha } f(t)\right\} =f(t), \end{aligned}$$
(8)
$$\begin{aligned} \displaystyle ^{}_{{t_0}}I_t^{\alpha } \left\{ \displaystyle ^{C}_{{t_0}}D_t^{\alpha } f(t)\right\}= & {} f(t)-f(t_0), \end{aligned}$$
(9)
$$\begin{aligned} \displaystyle ^{}_{{t}}I_{t_f}^{\alpha } \left\{ \displaystyle ^{C}_{{t}}D_{t_f}^{\alpha } f(t)\right\}= & {} f(t)-f(t_f). \end{aligned}$$
(10)

For more details on the new AB FDs and their properties, the interested reader can refer to [32, 37].

3 Nonlinear FOCPs with Mittag–Leffler Nonsingular Kernel

In this section, we formulate a FOCP with Mittag–Leffler nonsingular kernel and use a variational approach to derive the necessary optimality conditions for this problem. To this end, we consider a fractional dynamic system described by

$$\begin{aligned} \displaystyle ^{C}_{{t_0}}D_t^{\alpha } x(t)=F(x(t),u(t),t),\quad t_0 \le t \le t_f, \quad x(t_0)=x_0, \end{aligned}$$
(11)

where \(x \in {\mathbb {R}}^n\) and \(u \in {\mathbb {R}}^m\) are the state and control vectors, respectively. The expression \({\displaystyle ^{C}_{{t_0}}D_t^{\alpha } x(t)}\) denotes the new AB FD in the Caputo sense given by Eq. (2), \(F:{\mathbb {R}}^{n \times m \times 1} \rightarrow {\mathbb {R}}^n\) is a nonlinear vector function, and \(x_0 \in {\mathbb {R}}^n\) is the specified initial state vector. In order to achieve a desired behavior in terms of performance requirements, here we select a performance index for dynamical system (11). In selecting the performance index, the designer attempts to define a mathematical expression which when minimized indicates that the system is performing in the most desirable manner. Thus, choosing a performance index is a translation of system’s physical requirements into mathematical terms [38]. For fractional dynamic system (11), we choose the following performance index

$$\begin{aligned} J=\int _{t_0}^{t_f} L(x(t),u(t),t) \mathrm{d}t, \end{aligned}$$
(12)

where \(L\,{:}\,{\mathbb {R}}^{n \times m \times 1} \rightarrow {\mathbb {R}}\) is a scalar function. The problem is to find the optimal control \(u^*(t)\) for Eq. (11), which minimizes cost functional (12). In the following, we derive the necessary optimality conditions corresponding to new FOCP (11) and (12).

Theorem 3.1

(Necessary optimality conditions) Let (x(t), u(t)) be a minimizer of (12) under dynamic constraint (11); then, there exists a function \({\lambda }(t)\) for which the triplet \((x(t),{\lambda }(t),u(t))\) satisfies

  • the Hamiltonian system

    $$\begin{aligned} \left\{ \begin{array}{ll} {\displaystyle ^{C}_{{t_0}}D_t^{\alpha } x(t)}=\displaystyle \frac{\partial {{\mathcal {H}}}}{\partial {\lambda }(t)}(x(t),{\lambda }(t),u(t),t),&{}\quad t_0 \le t \le t_f,\\ {\displaystyle ^{R}_{{t}}D_{t_f}^{\alpha } {\lambda }(t)}=\displaystyle \frac{\partial {{\mathcal {H}}}}{\partial x(t)}(x(t),{\lambda }(t),u(t),t),&{}\quad t_0 \le t \le t_f, \end{array}\right. \end{aligned}$$
    (13)
  • and the stationary condition

    $$\begin{aligned} \displaystyle \frac{\partial {{\mathcal {H}}}}{\partial u(t)}(x(t),{\lambda }(t),u(t),t)=0,\quad t_0\le t \le t_f, \end{aligned}$$
    (14)

where \({{\mathcal {H}}}\) is a scalar function, called the Hamiltonian, defined by

$$\begin{aligned} {{\mathcal {H}}}(x(t),{\lambda }(t),u(t),t) := L(x(t),u(t),t)+\displaystyle {\lambda }^\mathrm{T}(t)F(x(t),u(t),t). \end{aligned}$$
(15)

Proof

To deduce the necessary optimality conditions that an optimal pair (xu) must satisfy, we use a Lagrange multiplier to adjoin dynamic constraint (11) to performance index (12). Thus, we form the augmented functional

$$\begin{aligned} J_\mathrm{a}(u)=\displaystyle \int _{t_0}^{t_f} \left[ {{\mathcal {H}}}(x(t),{\lambda }(t),u(t),t)-{\lambda }^\mathrm{T}(t){\displaystyle ^{C}_{{t_0}}D_t^{\alpha } x(t)}\right] \mathrm{d}t, \end{aligned}$$
(16)

where \({\lambda } \in {\mathbb {R}}^{n}\) is the Lagrange multiplier also known as costate or adjoint variable. Taking the first variation of augmented performance index \(J_\mathrm{a}(u)\) in Eq. (16), we obtain

$$\begin{aligned} \begin{array}{c} \delta J_\mathrm{a}(u)=\displaystyle \int _{t_0}^{t_f} \left\{ \left[ \frac{\partial {{\mathcal {H}}}}{\partial {x}}\right] ^\mathrm{T}\delta {x}(t)+\left[ \displaystyle \frac{\partial {{\mathcal {H}}}}{\partial {\lambda }}-{\displaystyle ^{C}_{{t_0}}D_t^{\alpha } x(t)}\right] ^\mathrm{T}\delta {\lambda }(t)\right. \\ \left. +\left[ \displaystyle \frac{\partial {{\mathcal {H}}}}{\partial {u}}\right] ^\mathrm{T}\delta {u}(t)-{\lambda }^\mathrm{T}(t){\displaystyle ^{C}_{{t_0}}D_t^{\alpha } \delta x(t)}\right\} \mathrm{d}t. \end{array} \end{aligned}$$
(17)

Using the fractional integration by parts formula [37], the last integral in Eq. (17) can be written as

$$\begin{aligned} \displaystyle \int _{t_0}^{t_f} {\lambda }^\mathrm{T}(t){\displaystyle ^{C}_{{t_0}}D_t^{\alpha } \delta x(t)} \mathrm{d}t=\displaystyle \int _{t_0}^{t_f} \left( {\displaystyle ^{R}_{{t}}D_{t_f}^{\alpha } \lambda (t)}\right) ^\mathrm{T}\delta {x}(t)\mathrm{d}t, \end{aligned}$$
(18)

where \({\displaystyle ^{R}_{{t}}D_{t_f}^{\alpha } \lambda (t)}\) denotes the right AB Riemann–Liouville FD of \(\lambda (t)\) defined in Eq. (5). Note that, the identity in Eq. (18) is satisfied if \(\delta {x}(t_0)=0\) or \({\lambda }(t) = 0\), and \(\delta {x}(t)=0\) or \({\lambda }(t_f) = 0\) [37]. Since \({x}(t_0)\) is specified, we have \(\delta {x}(t_0)=0\). However, \(\delta {x}(t)\) is not equal to zero for all \({t_0<t<t_f}\) and thus we require \({\lambda }(t_f)=0\). With these assumptions, Eq. (18) is satisfied. Using Eqs. (17) and (18), we deduce the following formula

$$\begin{aligned}&\delta J_\mathrm{a}(u)=\displaystyle \int _{t_0}^{t_f} \left\{ \left[ \frac{\partial {{\mathcal {H}}}}{\partial {x}}-{\displaystyle ^{R}_{{t}}D_{t_f}^{\alpha } \lambda (t)}\right] ^\mathrm{T}\delta {x}(t)\right. \nonumber \\&\quad \quad \qquad \qquad \left. +\left[ \displaystyle \frac{\partial {{\mathcal {H}}}}{\partial {\lambda }}-{\displaystyle ^{C}_{{t_0}}D_t^{\alpha } x(t)}\right] ^\mathrm{T}\delta {\lambda }(t)+\left[ \displaystyle \frac{\partial {{\mathcal {H}}}}{\partial {u}}\right] ^\mathrm{T}\delta {u}(t)\right\} \mathrm{d}t. \end{aligned}$$
(19)

The necessary condition for an extremal is that the first variation of \(J_\mathrm{a}(u)\) must vanish on the extremal for all independent variations \(\delta {x}(t), \delta {\lambda }(t)\) and \(\delta {u}(t)\). For this purpose, all factors multiplying a variation in Eq. (19) must vanish. In accordance with the definition of \({\mathcal {H}}\) in Eq. (15), the coefficient of \(\delta {\lambda }(t)\) in (19) is zero since dynamic constraint (11) must be satisfied by an extremal. Taking into account this point and also setting to zero the coefficients of \(\delta {x}(t)\) and \(\delta {u}(t)\) in Eq. (19) yield the necessary conditions for an extremal, as it is shown in Eqs. (13) and (14). \(\square \)

Equations (13) and (14) represent the Euler–Lagrange equations of FOCP (11) and (12). Based on these equations, we shall find the necessary optimality conditions of the following problem

$$\begin{aligned} \text {minimize}\quad J=\frac{1}{2}\int _{t_0}^{t_f} \left( x^\mathrm{T}(t){{Q}}x(t)+u^\mathrm{T}(t){{R}}u(t)\right) \mathrm{d}t, \end{aligned}$$
(20)

subject to

$$\begin{aligned} \displaystyle ^{C}_{{t_0}}D_t^{\alpha }{x}(t)={{A}}{} \mathbf ( t\mathbf ) x(t)+{{B}}{} \mathbf ( t\mathbf ) u(t)+f(x(t)),\quad t_0\le t\le t_f,\quad x(t_0)=x_0, \end{aligned}$$
(21)

where A(t) and B(t) are real-valued continuous matrices of appropriate dimensions, \(f\,{:}\,{\mathbb {R}}^{n} \rightarrow {\mathbb {R}}^n\) is a nonlinear vector function, and QR are positive semidefinite and positive definite matrices, respectively. For FOCP (20) and (21), the Hamiltonian function given by Eq. (15) will be in the form

$$\begin{aligned} {{\mathcal {H}}}(x(t),{\lambda }(t),u(t),t)= & {} \displaystyle \frac{1}{2}\left( x^\mathrm{T}(t){{Q}}x(t)+u^\mathrm{T}(t){{R}}u(t)\right) \nonumber \\&+\,\displaystyle {\lambda }^\mathrm{T}(t)\left( {{A}}{} \mathbf ( t\mathbf ) x(t)+{{B}}{} \mathbf ( t\mathbf ) u(t)+f(x(t))\right) . \end{aligned}$$
(22)

Thus, Euler–Lagrange equations (13) and (14) lead to Eq. (21) and

$$\begin{aligned}&{\displaystyle ^{R}_{{t}}D_{t_f}^{\alpha } {\lambda }(t)}= {{{Q}}}x(t)+{{{A}}}^\mathrm{T}{} \mathbf ( t\mathbf ) {\lambda }(t)+g(x(t),\lambda (t)),\quad t_0 \le t \le t_f, \end{aligned}$$
(23)
$$\begin{aligned}&{{{R}}}u(t)+{{{B}}}^\mathrm{T}{} \mathbf ( t\mathbf ) {\lambda }(t)=0,\quad t_0 \le t \le t_f, \end{aligned}$$
(24)

where \(g(x(t),\lambda (t)) := \left( {\frac{\partial f(x(t))}{\partial x(t)}}\right) ^\mathrm{T}\lambda (t)\). From Eqs. (21) and (23) and (24), we get the necessary optimality conditions

$$\begin{aligned} \left\{ \begin{array}{ll} {\displaystyle ^{C}_{{t_0}}D_t^{\alpha }{x}(t)}={{{A}}}(t)x(t) -S(t)\lambda (t)+f(x(t)),&{}\quad t_0 \le t \le t_f, \\ {\displaystyle ^{R}_{{t}}D_{t_f}^{\alpha }{{\lambda }}(t)}= {{{Q}}}x(t)+{{{A}}}^\mathrm{T}(t){\lambda }(t)+g(x(t),\lambda (t)),&{}\quad t_0 \le t \le t_f, \\ {x}(t_0)=x_0,&{}\quad {\lambda }(t_f)=0, \end{array}\right. \end{aligned}$$
(25)

where \(S(t)={{{B}}}{} \mathbf ( t\mathbf ) {{{R}}}^{-1}{{{B}}}^\mathrm{T}{} \mathbf ( t\mathbf ) \). Thus, the state and costate variables x(t) and \({\lambda }(t)\) are obtained by solving the nonlinear two-point fractional BVP given by Eq. (25). Once \({\lambda }(t)\) is known, the optimal control \(u^*(t)\) can be obtained using Eq. (24)

$$\begin{aligned} u^*(t)=-{{{R}}}^{-1}{{{B}}}^\mathrm{T}{} \mathbf ( t\mathbf ) {\lambda }(t),\quad t_0\le t \le t_f. \end{aligned}$$
(26)

As it is shown, Eq. (25) is a system of coupled nonlinear two-point fractional BVPs involving the left and right FDs simultaneously. This clearly indicates that the solution of nonlinear FOCPs requires the knowledge of both forward and backward derivatives. Finding the exact solution of nonlinear fractional BVP (25) is extremely difficult, if not impossible. To overcome this difficulty, an efficient numerical scheme finding the state and costate variables will be presented in the next section.

4 Numerical Scheme

In this section, we first extend the finite difference methods for the discretization of fractional initial value problems with Mittag–Leffler nonsingular kernel. To approximate the solution of nonlinear two-point fractional BVP (25), a numerical scheme is developed by using the Euler finite difference formula.

4.1 Fractional Initial Value Problems

Consider the following fractional differential equation

$$\begin{aligned} \displaystyle ^{C}_{{t_0}}D_t^{\alpha }{x}(t)=\varphi (t,x(t)),\quad t_0< t \le t_f < \infty ,\quad x(t_0)=x_0, \end{aligned}$$
(27)

where \(0<\alpha <1\). By using the AB fractional integration for Eq. (27), we derive

$$\begin{aligned} x(t)=x_0+\frac{1-\alpha }{B(\alpha )}\varphi (t,x(t))+\frac{\alpha }{B(\alpha )\varGamma (\alpha )}\int _{t_0}^t (t-\tau )^{\alpha -1} \varphi (\tau ,x(\tau ))\mathrm{d}\tau . \end{aligned}$$
(28)

To design a numerical scheme for the approximate solution of Eq. (28), a uniform mesh \(t_i=t_0+ih_N\) on \([t_0,t_f]\) is first considered, where \(i=0,1,\ldots ,N\) and \(h_N=\frac{t_f-t_0}{N}\). Then, by using the Euler convolution quadrature rule for the discretization of Eq. (28), we have

$$\begin{aligned} x_{i+1}=x_0+\frac{1-\alpha }{B(\alpha )}\varphi (t_{i+1},x_{i+1})+\frac{\alpha h_N^{\alpha }}{B(\alpha )\varGamma (\alpha +1)} \displaystyle \sum _{j=0}^{i}b_{i,j}^{(\alpha )} \varphi (t_{j},x_{j}), \end{aligned}$$
(29)

where \(i=1,\ldots ,N\) and \(x_i\) denotes the numerical approximation of \(x(t_i)\). The expression of the coefficient \(b_{i,j}^{(\alpha )}\) has the following form

$$\begin{aligned} b_{i,j}^{(\alpha )}=(i-j+1)^{\alpha }-(i-j)^{\alpha },\quad j=0,\ldots ,i. \end{aligned}$$
(30)

In the following theorem, an error bound for numerical method (29) is provided.

Theorem 4.1

Assume that \(x_i (1 \le i\le N )\) is the solution of Euler method (29), x(t) is the solution of Eq. (27), and \(\varphi (t,x(t))\) satisfies the following Lipschitz condition

$$\begin{aligned} \left| \varphi (t,x_1(t))-\varphi (t,x_2(t))\right| \le M \left| x_1(t)-x_2(t)\right| , \end{aligned}$$
(31)

where M is a positive constant. Then, we have

$$\begin{aligned} |x(t_{i})-x_{i}|\le Ch_N^{\alpha },\quad i=0,1,\ldots ,N-1, \end{aligned}$$
(32)

where C is a positive constant independent of \(h_N\) and i.

Proof

From Eqs. (28) and (29), we have

$$\begin{aligned} x(t_{i})-x_{i}= & {} \frac{1-\alpha }{B(\alpha )}\left( \varphi (t_i,x(t_i))-\varphi (t_i,x_i)\right) \nonumber \\&+\,\frac{\alpha }{B(\alpha )\varGamma (\alpha )} \left( \int _0^{t_i} (t_i-\tau )^{\alpha -1} \varphi (\tau , x(\tau ))\mathrm{d}\tau -\frac{h_N^{\alpha }}{\alpha }\sum _{j=0}^{i}b_{i,j}^{(\alpha )} \varphi (t_{j},x_{j})\right) \nonumber \\= & {} \frac{1-\alpha }{B(\alpha )}(\varphi (t_i,x(t_i))-\varphi (t_i,x_i)) \nonumber \\&+\,\frac{\alpha }{B(\alpha )\varGamma (\alpha )} \left( \int _0^{t_i} (t_i-\tau )^{\alpha -1} \varphi (\tau ,x(\tau ))\mathrm{d}\tau -\frac{h_N^{\alpha }}{\alpha }\sum _{j=0}^{i}b_{i,j}^{(\alpha )} \varphi (t_{j},x(t_{j}))\right) \nonumber \\&+\,\frac{\alpha h_N^{\alpha }}{B(\alpha )\varGamma (\alpha +1)}\sum _{j=0}^{i}b_{i,j}^{(\alpha )} (\varphi (t_{j},x(t_{j}))-\varphi (t_{j},x_{j})). \end{aligned}$$
(33)

Using Lipschitz condition (31), we derive

$$\begin{aligned} |x(t_{i})-x_{i}|\le & {} C_{\alpha }|\frac{1}{\varGamma (\alpha )}\sum _{j=0}^{i}\int _{t_j}^{t_{j+1}} (t_i-\tau )^{\alpha -1} (\varphi (\tau ,x(\tau )) \nonumber \\&-\,\varphi (t_j,x(t_j)))\mathrm{d}\tau | +\frac{C_{\alpha }M h_N^{\alpha }}{\varGamma (\alpha +1)}\sum _{j=0}^{i}b_{i,j}^{(\alpha )} |x(t_{j})-x_{j}|, \end{aligned}$$
(34)

where \(C_{\alpha }=\frac{\alpha }{|B(\alpha )-(1-\alpha )M|}\). From Lemma 3.7 in [39], it leads to

$$\begin{aligned} |x(t_{i})-x_{i}| \le \frac{C_{\alpha }C_1h_N^{\alpha }}{\varGamma (\alpha )} +\frac{C_{\alpha }M h_N^{\alpha }}{\varGamma (\alpha +1)}\sum _{j=0}^{i}b_{i,j}^{(\alpha )} |x(t_{j})-x_{j}|, \end{aligned}$$
(35)

where \(C_1\) is a constant independent of \(h_N\). Applying the Grönwall’s inequality given by Lemma 3.4 in [39], it attributes to inequality (32). \(\square \)

4.2 Fractional Boundary Value Problems

To design a numerical scheme for the approximate solution of fractional BVP (25), we first apply the AB fractional integrations given by Eqs. (4) and (7). Thus, we derive

$$\begin{aligned} \left\{ \begin{array}{l}\displaystyle x(t)=x_0+\frac{1-\alpha }{B(\alpha )}F(x(t),\lambda (t),t) \frac{\alpha }{B(\alpha )\varGamma (\alpha )}\int _{t_0}^t \frac{F(x(\tau ),\lambda (\tau ),\tau )}{(t-\tau )^{1-\alpha }}\mathrm{d}\tau , \\ \displaystyle \lambda (t)=\frac{1-\alpha }{B(\alpha )}G(x(t),\lambda (t),t) +\frac{\alpha }{B(\alpha )\varGamma (\alpha )}\int _t^{t_f} \frac{G(x(\tau ),\lambda (\tau ),\tau )}{(\tau -t)^{1-\alpha }}\mathrm{d}\tau , \end{array}\right. \end{aligned}$$
(36)

where

$$\begin{aligned} \left\{ \begin{array}{l} F(x(t),\lambda (t),t) := {{{A}}}(t)x(t) -S(t)\lambda (t)+f(x(t)),\\ G(x(t),\lambda (t),t) := {{{Q}}}x(t)+{{{A}}}^\mathrm{T}(t){\lambda }(t)+g(x(t),\lambda (t)). \end{array}\right. \end{aligned}$$
(37)

Using the Euler convolution quadrature rule to discretize the convolution integral in the right-hand side of Eq. (36), we then deduce the following formula

$$\begin{aligned} \left\{ \begin{array}{l} x_{i+1}=x_0+r_1F(x_{i+1},\lambda _{i+1},t_{i+1})+r_2{h_N^{\alpha }} \sum _{j=0}^{i}b_{i+1,j}^{(\alpha )} F(x_{j},\lambda _{j},t_{j}), \\ \lambda _i=r_1G(x_i,\lambda _i,t_i)+r_2{h_N^{\alpha }} \sum _{j=0}^{N-(i+1)}\omega _{N-i,j}^{(\alpha )} G(x_{N-j},\lambda _{N-j},t_{N-j}), \end{array}\right. \end{aligned}$$
(38)

where \(0\le i\le N-1, r_1=\frac{1-\alpha }{B(\alpha )}, r_2=\frac{\alpha }{B(\alpha )\varGamma (\alpha +1)}\) and \(\lambda _i\) denotes the numerical approximation of \(\lambda (t_i)\). For \(i=0,1,\ldots ,N-1\), the coefficient \(b_{i+1,j}^{(\alpha )}\) is given by Eq. (30), and \(\omega _{i,j}^{(\alpha )}\) is defined as

$$\begin{aligned} \omega _{N-i,j}^{(\alpha )}=(N-i-j)^{\alpha }-(N-i-(j+1))^{\alpha },\quad j=0,\ldots ,N-(i+1). \end{aligned}$$
(39)

Finally, the algebraic system given by Eq. (38) can be rewritten in the matrix form

$$\begin{aligned} {\mathbf {M}}_1{\mathbf {z}}_1+{\mathbf {M}}_0{\mathbf {F}}({\mathbf {z}}_1)+{\mathbf {M}}_2{\mathbf {z}}_2={\mathbf {C}}_1,\quad {\mathbf {M}}_3{\mathbf {z}}_1+{\mathbf {M}}_4{\mathbf {z}}_2={\mathbf {C}}_2, \end{aligned}$$
(40)

where \({\mathbf {z}}_1=[x_1,x_2,\ldots ,x_N]^\mathrm{T}, {\mathbf {z}}_2=[\lambda _0,\lambda _1,\ldots ,\lambda _{N-1}]^\mathrm{T}\) and

$$\begin{aligned} \left\{ \begin{array}{l} {\mathbf {M}}_0=-\left( r_1{{\mathbf {I}}}+r_2 h_N^{\alpha }{{\mathbf {B}}}_0\right) ,\quad {\mathbf {M}}_1={\mathbf {I}}-r_1{{\mathbf {D}}}_1-r_2 h_N^{\alpha }{\mathbf {G}}_1, \\ {\mathbf {M}}_2=r_1{\mathbf {D}}_2+r_2h_N^{\alpha }{\mathbf {B}},\quad {\mathbf {M}}_3=-r_1{{\mathbf {D}}}_3-r_2 h_N^{\alpha }{\mathbf {G}}_3,\\ {\mathbf {M}}_4={\mathbf {I}}-r_1{\mathbf {D}}_4-r_2 h_N^{\alpha }{\mathbf {G}}_2. \end{array}\right. \end{aligned}$$
(41)

Moreover, the matrix \({\mathbf {I}}\) is the identity matrix of order N, and

$$\begin{aligned} {\mathbf {F}}({\mathbf {z}}_1)= & {} [f(x_1),\ldots ,f(x_{N-1}),f(x_N)]^\mathrm{T},\quad {\mathbf {D}}_1=\text {diag}(A(t_1),\ldots ,A(t_{N})),\nonumber \\ {\mathbf {D}}_4= & {} \text {diag}({\mathbf {v}}_0,{\mathbf {v}}_1,\ldots ,{\mathbf {v}}_{N-1}), \quad {\mathbf {v}}_{i}= {A}^\mathrm{T}(t_{i})+\left. \frac{\partial f(x)}{\partial x}\right| _{x=x_i},\quad i=0,\ldots ,N,\nonumber \\ {\mathbf {C}}_1= & {} \nonumber \\&\left[ x_0+r_2h_N^{\alpha }b_{1,0}^{(\alpha )}(A(t_0)x_0+f(x_0)),\ldots , x_0+r_2h_N^{\alpha }b_{N,0}^{(\alpha )}(A(t_0)x_0+f(x_0))\right] ^\mathrm{T},\nonumber \\ {\mathbf {C}}_2= & {} [r_1Qx_0,0,\ldots ,0]^\mathrm{T}, \end{aligned}$$
(42)
$$\begin{aligned} {\mathbf {D}}_2= & {} \left[ \begin{array}{ccccc} 0 &{} {\mathbf {S}}_1 &{} &{} &{} \\ &{} 0&{} {\mathbf {S}}_2 &{} &{} \\ &{} &{} \ddots &{}\ddots &{} \\ &{} &{} &{} 0 &{}{\mathbf {S}}_{N-1} \\ &{} &{} &{} &{} 0\\ \end{array} \right] ,\quad {\mathbf {D}}_3=\left[ \begin{array}{ccccc} 0 &{} &{} &{} &{} \\ Q &{} 0&{} &{} &{} \\ &{} Q &{} 0&{} &{} \\ &{} &{} \ddots &{}\ddots &{} \\ &{} &{} &{} Q &{} 0\\ \end{array} \right] , \end{aligned}$$
(43)
$$\begin{aligned} {\mathbf {B}}= & {} \left[ \begin{array}{ccccccc} b_{1,0}^{(\alpha )}{\mathbf {S}}_0 &{} &{} &{} &{} &{} &{} \\ b_{2,0}^{(\alpha )}{\mathbf {S}}_0 &{} b_{2,1}^{(\alpha )}{\mathbf {S}}_1 &{} &{} &{} &{} &{}\\ b_{3,0}^{(\alpha )}{\mathbf {S}}_0 &{} b_{3,1}^{(\alpha )}{\mathbf {S}}_1 &{} b_{3,2}^{(\alpha )}{\mathbf {S}}_2 &{} &{} &{} &{}\\ \vdots &{} &{} &{} &{} \ddots &{} &{} \\ b_{N,0}^{(\alpha )}{\mathbf {S}}_0 &{} b_{N,1}^{(\alpha )}{\mathbf {S}}_1 &{} b_{N,2}^{(\alpha )}{\mathbf {S}}_2 &{} &{} \cdots &{} &{} b_{N,N-1}^{(\alpha )}{\mathbf {S}}_{N-1} \\ \end{array} \right] , \end{aligned}$$
(44)
$$\begin{aligned} {\mathbf {B}}_0= & {} \left[ \begin{array}{ccccccc} 0 &{} &{} &{} &{} &{} &{} \\ b_{2,1}^{(\alpha )} &{} 0 &{} &{} &{} &{}&{}\\ b_{3,1}^{(\alpha )} &{} b_{3,2}^{(\alpha )} &{} 0 &{} &{} &{}&{}\\ \vdots &{} &{} &{} \ddots &{} &{} \ddots &{} \\ b_{N,1}^{(\alpha )} &{} b_{N,2}^{(\alpha )} &{} &{} \cdots &{} &{} b_{N,N-1}^{(\alpha )} &{}0\\ \end{array} \right] , \end{aligned}$$
(45)
$$\begin{aligned} {\mathbf {G}}_1= & {} \left[ \begin{array}{ccccccc} 0 &{} &{} &{} &{} &{} &{} \\ b_{2,1}^{(\alpha )}A(t_1) &{} 0 &{} &{} &{} &{}&{}\\ b_{3,1}^{(\alpha )}A(t_1) &{} b_{3,2}^{(\alpha )}A(t_2) &{} 0 &{} &{} &{}&{}\\ &{} &{} &{} \ddots &{} &{} \ddots &{} \\ b_{N,1}^{(\alpha )}A(t_1) &{} b_{N,2}^{(\alpha )}A(t_2) &{} &{} \cdots &{} &{} b_{N,N-1}^{(\alpha )}A(t_{N-1}) &{}0\\ \end{array} \right] , \end{aligned}$$
(46)
$$\begin{aligned} {\mathbf {G}}_2= & {} \left[ \begin{array}{ccccccc} 0\ \ \ &{} w_{N,N-1}^{(\alpha )}{\mathbf {v}}_{1} &{} w_{N,N-2}^{(\alpha )}{\mathbf {v}}_{2} &{} w_{N,N-3}^{(\alpha )}{\mathbf {v}}_{3} &{} &{}\ldots &{} w_{N,1}^{(\alpha )}{\mathbf {v}}_{N-1}\\ &{} 0 &{} w_{N-1,N-2}^{(\alpha )}{\mathbf {v}}_{2} &{} w_{N-1,N-3}^{(\alpha )}{\mathbf {v}}_{3} &{} &{}\ldots &{} w_{N-1,1}^{(\alpha )}{\mathbf {v}}_{N-1}\\ &{} &{} 0 &{} w_{N-2,N-3}^{(\alpha )}{\mathbf {v}}_{3} &{} &{}\ldots &{} w_{N-2,1}^{(\alpha )}{\mathbf {v}}_{N-1}\\ &{} &{} &{} \ddots &{} &{} \ddots &{} \vdots \\ &{} &{} &{} &{} &{} &{} w_{2,1}^{(\alpha )}{\mathbf {v}}_{N-1}\\ &{} &{} &{} &{} &{} &{}0\\ \end{array} \right] , \end{aligned}$$
(47)
$$\begin{aligned} {\mathbf {G}}_3= & {} \left[ \begin{array}{cccccccc} w_{N,N-1}^{(\alpha )}Q &{} W_{N,N-2}^{(\alpha )}Q &{} w_{N,N-3}^{(\alpha )}Q &{} &{}\ldots &{} w_{N,1}^{(\alpha )}Q &{} &{}w_{N,0}^{(\alpha )}Q\\ &{} w_{N-1,N-2}^{(\alpha )}Q &{} w_{N-1,N-3}^{(\alpha )}Q &{} &{}\ldots &{} w_{N-1,1}^{(\alpha )}Q&{} &{} w_{N-1,0}^{(\alpha )}Q\\ &{} &{} \ddots &{} &{} &{} \ddots &{} &{}\vdots \\ &{} &{} &{} &{} &{} w_{2,1}^{(\alpha )}Q &{} &{} w_{2,0}^{(\alpha )}Q \\ &{} &{} &{} &{} &{} &{} &{} w_{1,0}^{(\alpha )}Q\\ \end{array} \right] . \end{aligned}$$
(48)

Remark 4.1

As it is interpreted from Theorem 4.1, if the numerical scheme defined by Eq. (40) is convergent, then the approximate solution converges to the solution of fractional BVP (25). Moreover, fractional problem (25) for \(f(x)\equiv 0\) reduces to a linear problem and the system of equations in (40) reduces to the following linear system

$$\begin{aligned} {\mathbf {M}}_1{\mathbf {z}}_1+{\mathbf {M}}_2{\mathbf {z}}_2={\mathbf {C}}_1,\quad {\mathbf {M}}_3{\mathbf {z}}_1+{\mathbf {M}}_4{\mathbf {z}}_2={\mathbf {C}}_2, \end{aligned}$$
(49)

where matrices \({\mathbf {M}}_i, i=1,2,3,4\), depend only on time.

We give the next theorem, which guarantees the existence of the solution for Eq. (40).

Theorem 4.2

Suppose that the following conditions are satisfied for fractional BVP (25)

$$\begin{aligned} {A}^\mathrm{T}(t)+\left. \frac{\partial f(x)}{\partial x}\right| _{x=x(t)}\ne & {} \frac{B(\alpha )}{1-\alpha }, \quad \forall t\ge t_0, \end{aligned}$$
(50)
$$\begin{aligned} h_N^{\alpha }\le & {} \frac{1+2r_1\alpha _0}{2r_2\alpha _0}, \end{aligned}$$
(51)

where

$$\begin{aligned} \alpha _0=\max \left\{ \Vert Q\Vert , \max \limits _t\{\Vert S(t)\Vert \},\max \limits _t\{\Vert A(t)\Vert \},\max \limits _{i}\sum _jb_{i+1,j}^{(\alpha )}, \max \limits _{i}\sum _jw_{N-i,j}^{(\alpha )} \right\} . \end{aligned}$$
(52)

(i) If \(f(x)\equiv 0\), then the solutions \({\mathbf {z}}_1\) and \({\mathbf {z}}_2\) for system (40) exist and they have the forms

$$\begin{aligned} {\mathbf {z}}_1={\mathbf {M}}_1^{-1}({\mathbf {I}}+{\mathbf {\xi }}_1)^{-1}{\mathbf {\psi }}_1,\quad {\mathbf {z}}_2={\mathbf {M}}_4^{-1}({\mathbf {I}}+{\mathbf {\xi }}_2)^{-1}{\mathbf {\psi }}_2, \end{aligned}$$
(53)

where

$$\begin{aligned}&{\mathbf {\xi }}_1=-{\mathbf {M}}_2{\mathbf {M}}_4^{-1}{\mathbf {M}}_3{\mathbf {M}}_1^{-1},\quad {\mathbf {\psi }}_1={\mathbf {C}}_1-{\mathbf {M}}_2{\mathbf {M}}_4^{-1}{\mathbf {C}}_2, \end{aligned}$$
(54)
$$\begin{aligned}&{\mathbf {\xi }}_2=-{\mathbf {M}}_3{\mathbf {M}}_1^{-1}{\mathbf {M}}_2{\mathbf {M}}_4^{-1},\quad {\mathbf {\psi }}_2={\mathbf {C}}_2-{\mathbf {M}}_3{\mathbf {M}}_1^{-1}{\mathbf {C}}_1. \end{aligned}$$
(55)

(ii) If \(f(x)\ne 0\), then the sequence \(\left\{ ({\mathbf {z}}_1^n,{\mathbf {z}}_2^n)\right\} \) produced by

$$\begin{aligned} {\mathbf {z}}_1^{n+1}={\mathbf {M}}_1^{-1}({\mathbf {I}}+{\mathbf {\xi }}_1)^{-1}{\mathbf {\psi }}_1^{n},\quad {\mathbf {z}}_2^{n+1}={\mathbf {M}}_4^{-1}({\mathbf {I}}+{\mathbf {\xi }}_2)^{-1}{\mathbf {\psi }}_2^{n}, \end{aligned}$$
(56)

tends to the solution of nonlinear system (40), where

$$\begin{aligned}&{\mathbf {\psi }}_1^n={\mathbf {C}}_1-{\mathbf {M}}_0{\mathbf {F}}({\mathbf {z}}_1^n)-{\mathbf {M}}_2{\mathbf {M}}_4^{-1}{\mathbf {C}}_2, \end{aligned}$$
(57)
$$\begin{aligned}&{\mathbf {\psi }}_2^n={\mathbf {C}}_2-{\mathbf {M}}_3{\mathbf {M}}_1^{-1}({\mathbf {C}}_1-{\mathbf {M}}_0{\mathbf {F}}({\mathbf {z}}_1^n)). \end{aligned}$$
(58)

Proof

The matrix \({\mathbf {M}}_4={\mathbf {I}}-r_1{{\mathbf {D}}}_4-r_2 h_N^{\alpha }{\mathbf {G}}_2\) is a lower triangular matrix in which the main diagonal elements are \(1-r_1(A^\mathrm{T}(t_i)+\left. \frac{\partial f(x)}{\partial x}\right| _{x=x_i})\ne 0, i=1,\ldots ,N\). The relation given by Eq. (50) guarantees that all elements on the main diagonal of \({\mathbf {M}}_4\) have nonzero values. Thus, the matrix \({\mathbf {M}}_4\) is invertible. Multiplying the second equation in (40) by \({\mathbf {M}}_2{\mathbf {M}}_4^{-1}\) and subtracting the resultant equation from Eq. (40), we obtain

$$\begin{aligned} \left( {\mathbf {I}}-{\mathbf {M}}_2{\mathbf {M}}_4^{-1}{\mathbf {M}}_3{\mathbf {M}}_1^{-1}\right) {\mathbf {M}}_1{\mathbf {z}}_1+{\mathbf {M}}_0{\mathbf {F}}({\mathbf {z}}_1) ={\mathbf {C}}_1-{\mathbf {M}}_2{\mathbf {M}}_4^{-1}{\mathbf {C}}_2. \end{aligned}$$
(59)

Similarly, the inverse of matrix \({\mathbf {M}}_1={\mathbf {I}}-r_1{\mathbf {D}}_1-r_2 h_N^{\alpha }{\mathbf {G}}_1\) also exists, and we have

$$\begin{aligned} {\mathbf {z}}_2={\mathbf {M}}_4^{-1}({\mathbf {C}}_2-{\mathbf {M}}_3{\mathbf {z}}_1). \end{aligned}$$
(60)
  1. (i)

     If \(f(x)\ne 0\), then \(\Vert {\mathbf {\xi }}_1\Vert =\Vert {\mathbf {\xi }}_2\Vert \le \frac{(\alpha _0(r_1+r_2h_N^{\alpha }))^2}{(1-\alpha _0(r_1+r_2h_N^{\alpha }))^2}\). Using the relation given by Eq. (51), we conclude that \(\Vert {\mathbf {\xi }}_1\Vert =\Vert {\mathbf {\xi }}_2\Vert \le 1\). Therefore, matrices \({\mathbf {I}}+{\mathbf {\xi }}_1\) and \({\mathbf {I}}+{\mathbf {\xi }}_2\) are invertible (see Lemma 4.4.14 in [40]). Thus, we can get the solutions \({\mathbf {z}}_1\) and \({\mathbf {z}}_2\) from Eq. (53).

  2. (ii)

     If \(f(x)\ne 0\), then the system given by Eq. (40) is a nonlinear one. We can linearize this system as follows

$$\begin{aligned} {\mathbf {M}}_1{\mathbf {z}}_1^{n+1}+{\mathbf {M}}_0{\mathbf {F}}({\mathbf {z}}_1^{n})+{\mathbf {M}}_2{\mathbf {z}}_2^{n+1}={\mathbf {C}}_1,\quad {\mathbf {M}}_3{\mathbf {z}}_1^{n+1}+{\mathbf {M}}_4{\mathbf {z}}_2^{n+1}={\mathbf {C}}_2. \end{aligned}$$
(61)

Using part (i), the solution of system (61) is in the form given by Eq. (56), when f(x(t)) is a Lipschitz function. \(\square \)

5 Illustrative Examples

In this section, two illustrative examples are given to show the effectiveness of the proposed approach. In these examples, the effect of using the classic and AB Caputo fractional operators is investigated on the behavior of controlled system in terms of performance requirements such as settling time and overshoot. Notice that, all computations have been performed using a PC Intel Core i5-2410M/2.3 GHz.

Example 5.1

Consider the problem of minimizing

$$\begin{aligned} J= \frac{1}{2} \int _{0}^5 \left( 2x^2(t)+u^2(t)\right) \mathrm{d}t, \end{aligned}$$
(62)

subject to the nonlinear fractional-order system

$$\begin{aligned} \displaystyle ^{C}_{{0}}D_t^{\alpha }{x}(t)=\sin (x(t))+t^2 u(t), \quad 0 \le t \le 5, \quad {x}(0)=\pi . \end{aligned}$$
(63)

The objective is to find the optimal control \(u^*(t)\), which minimizes Eq. (62) such that fractional dynamic constraint (63) is satisfied.

From Eq. (25), the necessary optimality conditions of FOCP (62) and (63) are formulated as

$$\begin{aligned} \left\{ \begin{array}{ll} {\displaystyle ^{C}_{{0}}D_t^{\alpha }{x}(t)}=\sin (x(t))-t^4 \lambda (t), &{}\quad 0 \le t \le 5, \\ {\displaystyle ^{R}_{{t}}D_{5}^{\alpha }{{\lambda }}(t)}= 2 x(t)+\cos (x(t)){\lambda }(t),&{}\quad 0 \le t \le 5,\\ {x}(0)=\pi ,&{}\quad {\lambda }(5)=0, \end{array}\right. \end{aligned}$$
(64)

while the optimal control law is computed from Eq. (26) in the form

$$\begin{aligned} u^*(t)=-t^2{\lambda }(t),\quad 0\le t \le 5. \end{aligned}$$
(65)

Table 1 includes the cost functional value and the elapsed CPU time derived by fractional Euler method (38) for different values of \(\alpha \) and N. The reported results in Table 1 verify that the proposed algorithm converges extremely fast and a satisfactory precision is achieved within less than 1.75 seconds of CPU time. Applying numerical Euler method (38) for \(N=320\), simulation curves of x(t) and u(t) for \(\alpha =0.7,0.8,0.9,1\) are plotted in Fig. 1. In this figure, we also provided the solution of classical Euler–Lagrange equations in addition to some different solutions of Eq. (64) for \(0<\alpha \le 1\). This figure indicates that the numerical solution of Eq. (64) approaches the classic case as \(\alpha \) approaches 1. Figure 1 also verifies that decreasing the fractional-order \(\alpha \) leads to decreasing the settling time of the response. Therefore, the behavior of controlled system depends notably on the fractional-order \(\alpha \). This provides an additional control parameter \(\alpha \) to be selected in order to achieve a desired behavior of controlled system in terms of performance requirements such as settling time. Table 2 provides a comparison of using the classic and AB Caputo FDs for Example 5.1. As it is shown in Table 2, the cost functional values obtained within the AB Caputo FD are less than those of the classic Caputo for all values of \(\alpha \). Figure 2 compares the manner of performance within the classic and AB Caputo fractional operators. This figure indicates that applying the AB Caputo FD instead of classic Caputo provides better results in terms of settling time for all values of \(0<\alpha <1\). Moreover, both definitions of the FDs lead to the same results for \(\alpha =1\), as expected. Comparing the results in Table 2 and Fig. 2 verifies the superiority of AB Caputo in comparison with the classic Caputo for the FOCPs.

Table 1 The cost value (J) and the elapsed CPU time in seconds (CTs) for Example 5.1 by fractional Euler method (38)
Fig. 1
figure 1

Simulation curves of x(t) and u(t) for Example 5.1 when \(\alpha =0.7,0.8,0.9,1\) and the classic solution. a The state x(t). b The control u(t)

Table 2 Comparative results of J for Example 5.1 within the classic and AB Caputo FDs
Fig. 2
figure 2

Simulation curves of x(t) for Example 5.1 within the classic and AB Caputo FDs. a \(\alpha =0.7\). b \(\alpha =0.8\). c \(\alpha =0.9\). d \(\alpha =1\)

Example 5.2

Minimize

$$\begin{aligned} J= \frac{1}{2} \int _{0}^{20} \left( x_1^2(t)+x_2^2(t)+100u^2(t)\right) \mathrm{d}t, \end{aligned}$$
(66)

subject to

$$\begin{aligned} \left\{ \begin{array}{l} {\displaystyle ^{C}_{{0}}D_t^{\alpha }{x}_1(t)}=x_2(t), \quad 0 \le t \le 20,\\ {\displaystyle ^{C}_{{0}}D_t^{\alpha }{x}_2(t)}=-tx_1(t)+(1-x_1^2(t))x_2(t)+ 10t\mathrm{e}^{-t} u(t), \quad 0 \le t \le 20,\\ {x}_1(0)=1,\quad x_2(0)=0. \end{array}\right. \end{aligned}$$
(67)

From Eq. (25), the necessary optimality conditions of FOCP (66) and (67) are formulated as

$$\begin{aligned} \left\{ \begin{array}{l} {\displaystyle ^{C}_{{0}}D_t^{\alpha }{x}_1(t)}=x_2(t),\\ {\displaystyle ^{C}_{{0}}D_t^{\alpha }{x}_2(t)}=-tx_1(t)+(1-x_1^2(t))x_2(t)- t^2\mathrm{e}^{-2t} \lambda _2(t),\\ {\displaystyle ^{R}_{{t}}D_{20}^{\alpha }{{\lambda }}_1(t)}= x_1(t)-(t+2x_1(t)x_2(t))\lambda _2(t),\\ {\displaystyle ^{R}_{{t}}D_{20}^{\alpha }{{\lambda }}_2(t)}= x_2(t)+{\lambda }_1(t)+(1-x_1^2(t))\lambda _2(t),\\ {x}_1(0)=1,\quad x_2(0)=0,\quad {\lambda }_1(20)={\lambda }_2(20)=0. \end{array}\right. \end{aligned}$$
(68)

Also, from Eq. (26), the following formula is obtained for the optimal control law

$$\begin{aligned} u^*(t)=- 0.1t\mathrm{e}^{-t}{\lambda }_2(t),\quad 0 \le t \le 20. \end{aligned}$$
(69)
Table 3 The cost value (J) and the elapsed CPU time in seconds (CTs) for Example 5.2 by fractional Euler method (38)
Fig. 3
figure 3

Simulation curves of \(x_1(t), x_2(t)\) and u(t) for Example 5.2 when \(\alpha =0.7,0.8,0.9,1\) and the classic solution. a The state \(x_1(t)\). b The state \(x_2(t)\). c The control u(t)

Table 4 Comparative results of J for Example 5.2 within the classic and AB Caputo FDs
Fig. 4
figure 4

Simulation curves of \(x_1(t)\) for Example 5.2 within the classic and AB Caputo FDs. a \(\alpha =0.7\). b \(\alpha =0.8\). c \(\alpha =0.9\). d \(\alpha =1\)

Fig. 5
figure 5

Simulation curves of \(x_2(t)\) for Example 5.2 within the classic and AB Caputo FDs. a \(\alpha =0.7\). b \(\alpha =0.8\). c \(\alpha =0.9\). d \(\alpha =1\)

Table 3 reports our numerical findings for different values of \(\alpha \) and N. Simulation curves of x(t) and u(t) computed by numerical Euler method (38) for \(\alpha =0.7,0.8,0.9,1\) and \(N=320\) are also plotted in Fig. 3. As it is shown in Fig. 3, the numerical solution of Eq. (68) approaches the classic case as \(\alpha \) approaches 1. In addition, decreasing the FD order \(\alpha \) leads to decreasing the settling time and overshoot of the response. This confirms that the performance of controlled system depends notably on the fractional-order \(\alpha \). Therefore, the parameter \(\alpha \) can be selected as a control parameter in order to achieve a desired behavior of controlled system in terms of performance requirements such as settling time and overshoot. Table 4 compares the results of using the classic and AB Caputo FDs for Example 5.2. As it is shown in Table 4, the cost functional values obtained within the AB Caputo are less than those of the classic Caputo for all values of \(\alpha \). Figures 4 and 5 compare the performance of solution within the classic and AB Caputo fractional operators. These figures indicate that applying the AB Caputo FD instead of classic Caputo provides better results in terms of settling time and overshoot of the response for all values of \(0<\alpha <1\). Moreover, both definitions of the FDs lead to the same results for \(\alpha =1\), as expected. Comparing the results in Table 4 and Figs. 4 and 5 verifies that applying the AB Caputo FD in the FOCPs (rather than the classic Caputo) has the advantages of less cost functional value and better settling time and overshoot of the response.

6 Conclusions

Motivated by the fact that the memory effects have various behaviors, many researchers tried to suggest several new FDs to describe more accurately these phenomena. Recently, a new FD with Mittag–Leffler nonsingular kernel was proposed and applied to some real-world models. An important issue for this new type of FDs is to discuss the numerical methods based on this new derivative. The first purpose of this manuscript was to investigate a new formulation of the FOCPs involving the AB FD with Mittag–Leffler nonsingular kernel. We used the Lagrange multiplier within the calculus of variations and applied the fractional integration by parts in order to derive the necessary optimality conditions in terms of a nonlinear two-point fractional BVP. Then, a numerical scheme was presented and its error bound was investigated by using the Grönwall’s inequality. Numerical results including the cost functional value and the elapsed CPU time reported in Tables 1 and 3 confirm that the proposed method is accurate and fast-convergent. The effect of using the classic and AB Caputo fractional operators was also investigated on the behavior of controlled system in terms of performance requirements such as settling time and overshoot of the response. Numerical findings in Tables 2 and 4 and Figs. 2, 4 and 5 verify that applying the AB Caputo FD in the FOCPs (rather than the classic Caputo) has the advantages of less cost functional value and better settling time and overshoot of the response. Consequently, new aspects of the FC provide more flexible models and have the potential to better control the undesirable behavior of the real-world phenomena.