Numerical Solution of Fractional Differential Equations : A Survey and a Software Tutorial

Solving differential equations of fractional (i.e., non-integer) order in an accurate, reliable and efficient way is much more difficult than in the standard integer-order case; moreover, the majority of the computational tools do not provide built-in functions for this kind of problem. In this paper, we review two of the most effective families of numerical methods for fractional-order problems, and we discuss some of the major computational issues such as the efficient treatment of the persistent memory term and the solution of the nonlinear systems involved in implicit methods. We present therefore a set of MATLAB routines specifically devised for solving three families of fractional-order problems: fractional differential equations (FDEs) (also for the non-scalar case), multi-order systems (MOSs) of FDEs and multi-term FDEs (also for the non-scalar case); some examples are provided to illustrate the use of the routines.


Introduction
The increasing interest in applications of fractional calculus has motivated the development and the investigation of numerical methods specifically devised to solve fractional differential equations (FDEs).Finding analytical solutions of FDEs is, indeed, even more difficult than solving standard ordinary differential equations (ODEs) and, in the majority of cases, it is only possible to provide a numerical approximation of the solution.
Although several computing environments (such as, for instance, Maple, Mathematica, MATLAB and Python) provide robust and easy-to-use codes for numerically solving ODEs, the solution of FDEs still seems not to have been addressed by almost all computational tools, and usually, researchers have to write codes by themselves for the numerical treatment of FDEs.
When numerically solving FDEs, one faces some non-trivial difficulties, mainly related to the presence of a persistent memory (which makes the computation extremely slow and expensive), to the low-order accuracy of the majority of the methods, to the not always straightforward computation of the coefficients of several schemes, and so on.
Writing reliable codes for FDEs can be therefore a quite difficult task for researchers and users with no particular expertise in computational mathematics, and it would be surely preferable to rely on efficient and already tested routines.
The aim of this paper is to illustrate the basic principles behind some methods for FDEs, thus to provide a short tutorial on the numerical solution of FDEs, and discuss some non-trivial issues related to the effective implementation of methods as, for instance, the treatment of the persistent memory term, the solution of equations involved by implicit methods, and so on; at the same time, we present some MATLAB routines for the solution of a wide range of FDEs.This paper is organized as follows.In Section 2, we recall some basic definitions concerning fractional-order operators, and we present some of the most useful properties that will be used throughout the paper.Section 3 is devoted to illustrating multi-step methods for FDEs; in particular, we discuss product-integration (PI) rules and Lubich's fractional linear multi-step methods (FLMMs); we also discuss in detail the main issues and advantages related to the use of implicit methods, and we illustrate a technique based on the fast Fourier transform (FFT) algorithm to efficiently treat the persistent memory term.
In Section 4, we consider two special cases of FDEs: multi-order systems (MOSs) in which each equation has a different fractional-order and multi-term FDEs in which there is more than one fractional derivative in a single equation; in particular, we will see how standard methods studied in the previous section can be adapted to solve these particular problems.
In Section 5, we present some MATLAB routines for solving different families of FDEs and explain their use in detail; finally, Section 6 is devoted to showing the application of the routines to a selection of test problems.

Preliminary Material on Fractional Calculus
For the sake of clarity, we review in this section some of the most useful definitions in fractional calculus, and we recall the properties that we will use in the subsequent sections.For a more comprehensive introduction to this subject, the reader is referred to any of the available textbooks [1][2][3][4][5] or review papers [6,7] and, in particular, to the book by Diethelm [8] by which this introductory section is mainly inspired.
As the starting point for introducing fractional-order operators, we consider the Riemann-Liouville (RL) integral; for a function y(t) ∈ L 1 [t 0 , T] (as usual, L 1 is the set of Lebesgue integrable functions), the RL fractional integral of order α > 0 and origin at t 0 is defined as: It provides a generalization of the standard integral, which, indeed, can be considered a particular case of the RL integral (1) when α = 1.The left inverse of J α t 0 is the RL fractional derivative: where m = α is the smallest integer greater or equal to α and D m , y (m) or d m /dt m denotes the standard integer-order derivative.
An alternative definition of the fractional derivative, obtained after interchanging differentiation and integration in Equation ( 2), is the so-called Caputo derivative, which, for a sufficiently differentiable function, namely for y ∈ A m [t 0 , T] (i.e., y (m−1) absolutely continuous), is given by: We observe that also D α t 0 y(t) is a left inverse of the RL integral, namely D α t 0 J α t 0 y = y [8] (Theorem 3.7), but not its right inverse, since [8] (Theorem 3.8): where T m−1 [y; t 0 ](t) is the Taylor polynomial of degree m − 1 for the function y(t) centered at t 0 , that is: More generally speaking, by combining [1] (Lemma 2.3) and [8] (Theorem 3.8), it is also possible to observe that for any β > α, it holds: a relationship that will be useful, in a particular way, in Section 4.2 on multi-term FDEs.
The two definitions (2) and ( 3) are interrelated, and indeed, by deriving both sides of Equation ( 4) in the RL sense, it is possible to observe that: and, consequently: Observe that in the special case 0 < α < 1, the above relationship becomes: clearly showing how the Caputo derivative is a sort of regularization of the RL derivative at t 0 .Another feature that justifies the introduction of the Caputo derivative is related to the differentiation of constant function; indeed, since: in several applications, it is preferable to deal with operators for which the derivative of a constant is zero as in the case of Caputo's derivative.One of the most important applications of Caputo's derivative is however in FDEs.Unlike FDEs with the RL derivative, which are initialized by derivatives of non-integer order, an initial value problem for an FDE (or a system of FDEs) with Caputo's derivative can be formulated as: where f (t, y) is assumed to be continuous and y 0 , y (1) 0 , . . ., y (m−1) 0 are the assigned values of the derivatives at t 0 .Clearly, initializing the FDE with assigned values of integer-order derivatives is more useful since they have a more clear physical meaning with respect to fractional-order derivatives.
The application to both sides of Equation ( 6) of the RL integral J α t 0 , together with Equation ( 4), leads to the reformulation of the FDE in terms of the weakly-singular Volterra integral equation (VIE): The integral Formulation (7) is surely useful since it allows exploiting theoretical and numerical results already available for this class of VIEs in order to study and solve FDEs.
We stress the nonlocal nature of FDEs: the presence of a real power in the kernel makes it not possible to split the solution of Equation ( 7) at any point t n as the solution at some previous point t n − h plus the increment term related to the interval [t n − h, t n ], as is common with ODEs.
Furthermore, as proved by Lubich [9], the solution of the VIE (7) presents an expansion in mixed (i.e., integer and fractional) powers: thus showing a non-smooth behavior at t 0 ; as is well-known, the absence of smoothness at t = t 0 poses some problems for the numerical computation since methods based on polynomial approximations fail to provide accurate results in the presence of some lack of smoothness.

Multi-Step Methods for FDEs
Most of the step-by-step methods for the numerical solution of differential equations can be roughly divided into two main families: one-step and multi-step methods.
In one-step methods, just one approximation of the solution at the previous step is used to compute the solution and, hence, they are particularly suited when it is necessary to dynamically change the step-size in order to adapt the integration process to the behavior of the solution.In multi-step methods, it is instead necessary to use more previously evaluated approximations to compute the solution.
Because of the persisting memory of fractional-order operators, multi-step methods are clearly a natural choice for FDEs; anyway, although multi-step methods for FDEs are usually derived from multi-step methods for ODEs, when applied to FDEs, the number of steps involved in the computation is not fixed, but it increases as the integration proceeds forward, and the whole history of the solution is involved in each step's computation.
Multi-step methods for the FDEs (6) are therefore convolution quadrature formulas, which can be written in the general form: where ϕ n and c n are known coefficients and t n = t 0 + nh is an assigned grid, with a constant step-size h > 0 just for simplicity; the way in which the coefficients are derived depends on the specific method.In particular, the following two classes of multi-step methods for FDEs are mainly studied in the literature: • product-integration (PI) rules, • fractional linear multi-step methods (FLMMs).
Both families of methods are based on the approximation of the RL integral in the VIE (7) and generalize, on different bases, standard multi-step methods for ODEs.They allow one to write general-purpose methods requiring just the knowledge of the vector field of the differential equation.
We must mention that several other approaches have been however discussed in the literature: see, for instance, the generalized Adams methods [10], extensions of the Runge-Kutta methods [11], generalized exponential integrators [12,13], spectral methods [14,15], spectral collocation methods [16], methods based on matrix functions [17][18][19][20], and so on.In this paper, for brevity, we focus only on PI rules and FLMMs, and we refer the reader to the existing literature for alternative approaches.

Product-Integration Rules
PI rules were introduced by Young [21] in 1954 to numerically solve second-kind weakly-singular VIEs; they hence apply in a natural way to FDEs due to their formulation in Equation (7).
Given a grid t n = t 0 + nh, with constant step-size h > 0, in PI rules, the solution of the VIE (7) at t n is first written in a piece-wise way: and f (τ, y(τ)) is approximated, in each subinterval [t j , t j+1 ], by means of some interpolant polynomial; the resulting integrals are hence evaluated in an exact way, thus to lead to y n .According to the way in which the approximation is made, explicit or implicit rules are obtained, and this is perhaps the most straightforward way to generalize Adams multi-step methods commonly employed for integer-order ODEs [22].
For instance, to extend to FDEs the (explicit) forward and (implicit) backward Euler methods, it is sufficient to approximate, in each interval [t j , t j+1 ], the integrand f (τ, y(τ)) by the constant values f (t j , y j ) and f (t j+1 , y j+1 ), respectively; the resulting methods are: Impl.PI Rectangular : with b ; the term rectangular comes after the underlying quadrature rules used for the integration.In a similar way, when f (τ, y(τ)) is approximated by the first order interpolant polynomial: one obtains a generalization (of implicit type) of the standard trapezoidal rule: Impl.PI Trap.: with: An explicit version of the trapezoidal PI rule ( 12) is also possible, but it is not frequently encountered in the literature.
Unlike what one would expect, using interpolant polynomials of higher degree does not necessarily improve the accuracy of the obtained approximation.This phenomenon, already studied in [23], is related to the behavior of the solution of FDEs, which (with few exceptions [24]) have a non-smooth behavior also in the presence of a smooth given function f (t, y); some of the derivatives of y(t), and consequently of f (t, y(t)), are indeed unbounded at t 0 and hence not properly approximated by polynomials.
Thus, methods (10) and (11), as expected, converge with order one with respect to h, that is the error between the exact solution y(t n ) and the approximation y n is: Differently, the convergence order of the trapezoidal PI rule (12) usually drops to 1 + α when 0 < α < 1, and the expected order two is obtained only when α > 1 or just for well-selected problems with a sufficiently smooth solution (see, for instance, [23][24][25][26]).Actually, as one of the most general results, the error of the trapezoidal PI rule ( 12) is: although other special cases could be encountered.For this reason, PI rules of (just virtual) higher order, based on polynomial interpolation of degree two or more, are seldom considered in practice since in the majority of cases, they do not actually lead to any improvement of accuracy and convergence order.
To avoid the solution of the nonlinear equations in Equation ( 12) for the evaluation of y n , a predictor-corrector (PC) approach is sometimes preferred, in which a first approximation of y n is predicted by means of the explicit PI rectangular rule (10) and hence corrected by the implicit PI trapezoidal rule (12) according to: The PC method for FDEs has been extensively investigated (see, for instance, [25,[27][28][29]).With the aim of improving the approximation, a multiple number, say µ, of corrector iterations can be applied: Each iteration is expected to increase the order of convergence of a fraction α from the first order of convergence of the predictor method, until the order of convergence of the corrector method is achieved: thus, one or very few corrector iterations are usually necessary.The explicit PI rectangular rule ( 10) is obtained when µ = 0; the standard predictor-corrector method (13) clearly requires µ = 1.

Fractional Linear Multi-Step Methods
FLMMs were introduced and extensively studied by Lubich in [30] (it is, however, also useful to refer the reader to the papers [31][32][33], where these methods are studied under a more general perspective in connection with wider classes of convolution integrals).
The main feature of FLMMs is that they generalize, in a robust and elegant way, quadrature rules obtained from standard linear multi-step methods (LMMs).Thus, they are one of the most powerful methods for FDEs.
Given the initial value problem: its solution can be approximated by means of an LMM given by: the first and second characteristic polynomial of the LMM.Problem (15) can be rewritten in the integral form: and as investigated by Wolkenfelt [34,35] and also explained in the textbook [36], the solution y(t) can be approximated by using LMMs reformulated in terms of convolution quadrature formulas: where the weights ω n depend on the characteristic polynomials ρ(z) and σ(z), but not on h.The computation of the weights ω n is usually not easy, but interestingly, it is possible to represent them as the coefficients of the formal power series (FPS) of the generating function of the LMM [37], namely: The idea underlying FLMMs, supported by a rigorous theoretical reasoning, is to derive convolution quadratures for the RL integral (1) with convolution weights given by the coefficients of the FPS of the function: being F(s) = s −α the Laplace transform of the kernel t α−1 /Γ(α) in ( 1).The assumptions that make possible this generalization of LMMs are that the generating function δ(ξ) has no zeros in the closed unit disc |ξ| ≤ 1, except for ξ = 1, and LMMs satisfying these assumptions are, for instance, the backward differentiation formulas (BDFs) and the trapezoidal rule, which are reported in Table 1.

Name Formula ρ(z) σ(z) δ(ξ)
When an LMM is generalized to Equation (1) in the above Lubich sense, the resulting FLMM reads as: where the convolution quadrature weights ω n are obtained from: When f (t) is sufficiently smooth and the LMM has order p of convergence, the approximation provided by Equation ( 17) satisfies [33] (Theorem 2.1): for come constant C, which does not depend on h.Anyway, when f (t) lacks smoothness, for instance at t 0 , it is no longer possible to preserve the order p of convergence, and for f (t) = (t − t 0 ) γ the following result holds (see [31] (Theorem 5.1) and [33] (Theorem 2.2)): Thus, to handle non-smooth functions (as happens in the solution of fractional-order problems), it is necessary to introduce a correction term: where the starting quadrature weights w n,j are suitably selected in order to eliminate low order terms in the error bounds (18) and obtain the same convergence of order p of the underlying LMM.
From the application of the discretized convolution quadrature rule (19) to integral Equation ( 7), we are able to derive FLMMs for the approximation of the solution of FDEs: with the starting weights w n,j selected in order to cope with the non-smooth behavior of y(t) highlighted by Equation (8).Thus, to achieve the same order of convergence of the underlying LMM, the starting weights w n,j are chosen by imposing that the quadrature rule ( 19) is exact when applied to f (t) = t γ , with γ assuming all the possible fractional values expected in the expansion of the true solution and, hence, by solving at each step the algebraic linear system: with One of the simplest FLMMs is obtained from the implicit Euler method (or BDF1).No starting weights are necessary in this case, and since the generating function is δ(ξ) = 1 − ξ (see Table 1), we see that ω (α) n , n = 0, 1, . . ., are the coefficients of the generalized binomial series (1 − ξ) −α , namely: which can be also evaluated by the recurrence ω The corresponding method: is commonly referred to as the Gr ünwald-Letnikov scheme [5].
It is possible to derive several FLMMs with second order of convergence, which mainly differ for stability properties; for this purpose, we refer the reader to the paper [26], where the MATLAB code FLMM2.m implementing three different FLMMs is also presented.
The regularization operated by the starting weights is one of the most attractive features of FLMMs since it makes it possible to substantially achieve the same order of the underlying LMM.Unlike PI for which, in general, it is difficult to obtain a convergence order equal to or greater than two, FLMMs make the development of high order methods possible.However, round-off errors may accumulate when solving the ill-conditioned linear systems (21) [38], and hence, it is advisable to avoid very high order methods.

Implicit vs. Explicit Methods
Numerical methods for solving differential equations can be of an explicit or implicit nature.In explicit methods, such as method (10) or (27), the evaluation of each y n does not present any particular difficulty once the previous values y 0 , y 1 , . . ., y n−1 have already been evaluated.In implicit methods, such as method ( 11), ( 12), (28) or (29), the approximation of y n is expressed by means of a functional relationship of the kind: where with Ψ n we denote the term collecting all the explicitly known information.Implicit methods possess better stability properties, but they need some numerical procedure to solve the nonlinear equation, or system of nonlinear equation (22).
One of the most powerful methods is the iterative Newton-Raphson method; given an initial approximation y n for y n , the Newton-Raphson method when applied to solve Equation ( 22) evaluates successive approximations of y n by means of the relationship: where J f (t, y) is the Jacobian of f (t, y) with respect to y and I the identity matrix of compatible size (in the scalar case, a simple derivative replaces the Jacobian matrix).
The Newton-Raphson method converges in a fast way (it indeed has second-order convergence properties, i.e., y n − y 2 ), but its convergence is local, i.e., it is necessary to start sufficiently close to the solution.In general, there is no available information to localize the solution of Equation ( 22), and a usually satisfactory strategy is to start from the last evaluated approximation, namely y n = y n−1 ; since, under standard assumptions, it is reasonable to assume that at least y n = y n−1 + O(h), a sufficiently small step-size h will in general assure the convergence of Newton-Raphson iterations unless y or f change very rapidly.
An alternative approach, which is used to reduce the computational cost, consists of evaluating the Jacobian just once and reusing it for all the following approximations, namely: This approach, usually known as the modified Newton-Raphson method, not only allows one to save the cost of computing a new Jacobian matrix at each step, but also reduces the computational cost related to the solution of the linear algebraic system since it is possible to evaluate an LU decomposition of the matrix I − c 0 J f (t n , y (0) n ) and solve all the systems in the iterative process by using the same decomposition.
Although the derivative (or the Jacobian in the non-scalar case) could be numerically approximated, it is not advisable to introduce a further source of error; moreover, the numerical approximation of derivatives is usually an ill-conditioned problem.Therefore, to avoid a loss of accuracy, all the codes for implicit methods presented in this paper require that derivatives or Jacobian matrices are explicitly provided.As for f (t, y), some parameters could be optionally specified also for J f (t, y), thus to allow solving general problems depending on user-supplied parameters.

Efficient Treatment of the Persistent Memory
The numerical solution of FDEs demands for a large amount of computation, which, if not suitably organized, represents a serious issue.Most of the methods for FDEs, such as PI rules or FLMMs, are indeed discrete convolution quadrature rules of the form (9), and since the computation of each approximation y n requires a number of floating-point operations proportional to n, the whole evaluation of the solution on a grid t 0 , t 1 , . . ., t N involves a number of operations proportional to: When the interval of integration [t 0 , T] is large or stability reasons demand for a very small step-size h, the required number N = (T − t 0 )/h of grid points can be too high to perform the computation in a reasonable time.This is one of the most serious consequences of the persistent memory of non-local operators such as fractional integrals and derivatives.Although it is possible to apply short memory procedures relying on a truncation of the memory tail (e.g., see [39]) or on some more sophisticated approaches [40,41], their use introduces a further source of errors and/or increases the computational complexity.
For general-purpose codes, it is, instead, preferable to adopt techniques that are easy to implement and do not affect the accuracy of the solution.
An extremely powerful approach, exploiting general properties of convolution quadratures and based on the FFT algorithm, has been proposed by Hairer, Lubich and Schlichte [42,43].
This approach evaluates only the first r steps directly by means of the discrete convolution (9), namely: with r denoting a moderately small integer value selected, for convenience, as a power of two.
To determine the following r approximations, after writing: we observe that the set of partial sums each of length r: S r (n, 0, r − 1) := r−1 ∑ j=0 c n−j f j , n ∈ {r, r + 1, . . ., 2r − 1} can be evaluated by the FFT algorithm (described, for instance, in [44]), requiring only O 2r log 2 2r floating-point operations instead of O r 2 , as with standard computation.The same process can be recursively repeated by doubling the time-interval; thus, for the successive 2r approximations y n , for n ∈ {2r, 2r + 1, . . ., 4r − 1}, after writing: again, it is possible to use the FFT algorithm to evaluate the two sets of partial sums: of length 2r and r, respectively, with a computational cost proportional to O 4r log 2 4r and O 2r log 2 2r .The whole process can be iteratively repeated; for instance, to evaluate the 4r approximations y n in the interval n ∈ {4r, . . ., 8r − 1}, we have: To better understand how this process works, Figure 1 can be of some help, where each square represents the computation of a set of partial sums (by means of the FFT algorithm), and each triangle represents the standard computation of each final convolution term: To determine the whole computational cost, we assume, for simplicity, that the total number N of grid points is a power of two.Hence, the computation of one partial sum of length N/2 (the square S 4r in Figure 1) is requested, involving O N log 2 N operations, two partial sums of length N/4 (the squares S 2r ) each involving O N 2 log 2 N 2 operations, four partial sums of length N/8 (the squares S r ) each involving O N 4 log 2 N 4 operations, and so on.Additionally, N/r convolution sums of length r (the triangles T r ) are requested each with a computational cost proportional to r(r + 1)/2.Thus, the total amount of computation is proportional to: and by means of some simple manipulations, we are able to estimate a computational cost proportional to: which, for sufficiently large N, is clearly smaller than N 2 , i.e., the number of operations required by a computation performed in the standard way.

Some Particular Families of FDEs and Systems of FDEs
Equation ( 6) is perhaps the most standard example of FDEs.The numerical methods presented in the previous sections can be applied both to scalar equations and to systems of FDEs of any size.
There are however other types of fractional-order problems whose treatment necessitates a particular discussion.

Multi-Order Systems of FDEs
As a special case of non-linear systems of FDEs, we consider systems in which each equation has its own order, which can differ from the order of the other equations.The general form of a MOS of FDEs is: with y(t) = (y 1 (t), . . ., y Q (t)); it must be coupled with the initial conditions: where their number is m = max{m 1 , m 2 , . . ., m Q }, with m i = α i , i = 1, 2, . . ., Q. Also in this case, it is possible to reformulate each equation of the system (23) in terms of the VIEs: and apply one of the methods described in Section 3.
From the theoretical point of view, there are no particular differences with respect to the solution of a system of FDEs (6) in which all the equations have the same order.The computation is however more expensive due to the need for computing different sequences of weights and evaluating more than one discrete convolution quadrature.It is therefore necessary to optimize the codes to exploit the possible presence of equations having the same order, thus to avoid unnecessary computations; the codes presented in the next section provide this kind of optimization.

Linear Multi-Term FDEs
A further special case of FDE is when more than one fractional derivative appears in a single equation.Equations of this kind are called multi-term equations, and in the linear case, they are described as: where λ 1 , λ 2 , . . ., λ Q−1 , λ Q are some (usually real) coefficients and the orders α 1 , α 2 , . . ., α Q−1 , α Q of the fractional derivatives are assumed (just for convenience) to be sorted in an ascending order, i.e., 0 Note that here we focus on multi-term FDEs, which are linear with respect to the fractional derivatives, but with a (possible) nonlinearity of f (t, y).
The number of initial conditions is given by m Q , where as usual, m i = α i , i = 1, . . ., Q (and clearly m Q = max m i ), and they are expressed in the usual way as derivatives of the solution at the starting point t 0 : Multi-term FDEs are more difficult to solve than standard FDEs.Anyway, as proposed in [45,46], it is always possible to recast Equation (25) in such a way that some of the methods for FDEs can be easily adapted.Indeed, thanks to Equations ( 4) and ( 5) and by applying J α Q t 0 to Equation ( 25), we can reformulate the multi-term FDE as: Hence, numerical methods are straightforwardly devised by applying any method for the discretization of RL integrals (PIs or FLMMs).
As illustrative examples, we consider the generalization of the explicit and implicit first-order PI rules (10) and (11).For this purpose, we first observe that: and hence, after denoting: the corresponding methods for the multiterm FDE (25) are respectively: Expl.PI 1 : Impl.PI 1 : In a similar way, it is possible to extend to multi-term FDEs also the implicit trapezoidal rule (12): Impl.PI 2 : which usually assures a higher accuracy; alternatively, in order to avoid the solution, at each step of the nonlinear equations to determine y n (see the discussion in Section 3.3), also in this case, a predictor-corrector strategy can be of some practical help.Clearly, all these methods apply in a straightforward way to non-scalar problems, as well.
Although several other approaches have been proposed to solve linear multi-term FDEs, we think that the one discussed in this section could be privileged due to its simplicity.The application of FLMMs to Equation ( 26) is surely possible, but some problems must be solved to properly identify the starting weights on the basis of the behavior analysis of the exact solution; we do not address this problem in this paper.
The computational cost is proportional to Q times the cost of standard PI rules and can be kept under control by applying to each discrete convolution the technique discussed in Section 3.4.

MATLAB Routines for Fractional-Order Problems
In this section, we present some MATLAB routines specifically devised to solve fractional-order problems by means of the methods illustrated in this paper.The routines are listed in Table 2 with the indicated kind of problem that is aimed to be solved and the specific implemented method.
All the MATLAB routines are available on the software section of the web-page of the author, at the address: https://www.dm.uniba.it/Members/garrappa/Software.(25) Predictor-corrector PI rules The number 1 in the name of routines based on the PI rectangular rule refers to the convergence order of the underlying formula, while the number 2 stands for the maximum obtainable order (under suitable smoothness assumptions) of the PI trapezoidal rule.For this reason, routines based on PC, which use both PI rectangular rules (as predictor) and PI trapezoidal rules (as corrector), have 1 and 2 in the name.These names have been selected in analogy with the names of some built-in MATLAB functions for ODEs.
The way in which the different routines can be used is quite similar.One of the main differences is in implicit methods, which, in addition to the right-hand side f (t, y), denoted by the function handle f fun, require also the Jacobian J f (t, y) of the right-hand side, namely the function handle J fun; this is necessary to solve the inner nonlinear equation by means of Newton-Raphson iterations as described in Section 3.3.
Codes for linear multi-term FDEs (25) are used in a slightly different way since they additionally require providing the parameters λ i , according to: [t, y] = MT_FDE_PI1_Ex(alpha,lambda,f_fun,t0,T,y0,h,param) [t, y] = MT_FDE_PI1_Im(alpha,lambda,f_fun,J_fun,t0,T,y0,h,param,tol,itmax) [t, y] = MT_FDE_PI2_Im(alpha,lambda,f_fun,J_fun,t0,T,y0,h,param,tol,itmax) [t, y] = MT_FDE_PI12_PC(alpha,lambda,f_fun,t0,T,y0,h,param,mu,mu_tol) The meaning of each parameter is explained as follows (note that some of the parameters are optional and can be therefore omitted): • alpha: order of the fractional derivative; when solving standard systems (6), alpha must be a single scalar value, while with MOSs ( 23) and linear multi-term FDEs (25), alpha must be a vector; • lambda: only for linear multi-term FDEs (23), lambda is the vector of the coefficients λ i of each derivative in Equation ( 23); • f fun: function defining the right-hand side f (t, y) or f (t, y, param) of the equation; param denotes a possible optional parameter (or a set of parameters collected in a single vector); • J fun: Jacobian matrix (or derivative in the scalar case) of the right-hand side f (t, y) of the equation (only for implicit methods) with respect to the second variable y; also, the Jacobian J f (t, y) can have some parameters, namely J f (t, y, param); • t0 and T: initial and final endpoints of the integration interval; • y0: matrix of the initial conditions with the number of rows equal to the size of the problem and the number of columns equal to the smallest integer greater than max{α 1 , . . ., α Q }; • h: step-size for integration; it must be real and positive; • param: (optional) vector of possible parameters for the evaluation of the vector field f (t, y) and its Jacobian (if not necessary, this vector can be omitted or an empty vector [ ] can be used); • tol: (optional) fixed tolerance for stopping the Newton-Raphson iterations when solving the internal system of nonlinear equations (only for implicit methods); when not specified, the default value 10 −6 is assumed; • itmax: (optional) maximum number of iterations for the Newton-Raphson method; when not specified, the default value itmax = 100 is used; • mu: (optional) number of corrector iterations (only for predictor-corrector methods); when not specified, the default value mu = 1 is used; • mu tol: (optional) tolerance for testing the convergence of corrector iterations when mu=Inf; when not specified, the default value mu tol = 10 −6 is used.
All the codes give two outputs: • t: the vector of nodes on the interval [t 0 , T] in which the numerical solution is evaluated; • y: the matrix whose columns are the values of the solution evaluated in the points of t.

Some Applicative Examples
In the following, we present some applications of the routines described in the previous section, also in order to show the way in which they can be used.
For problems for which the analytical solution is not known, we will use, as reference solution, the numerical approximation obtained with a tiny step h by the implicit trapezoidal PI rule, which, as we will see, usually shows an excellent accuracy.All the experiments are carried out in MATLAB Ver.8.3.0.532 (R2014a) on a computer equipped with a CPU Intel i5-7400 at 3.00 GHz running under the operating system Windows 10.
As we can see from the results in Table 3, the explicit methods (including the predictor-corrector, which actually works as an explicit method) provide wrong or inaccurate results for small step-sizes, while implicit methods are able to return reliable results even with large step-sizes (as usual, numbers as 6.38(−6) denote 6.38 × 10 −6 ).This issue is related to the bounded stability region of explicit methods as already investigated in the paper [29] (see also [48,49]).In all the tables, we denote with EOC the estimated order of convergence obtained as log 2 E(h)/E(h/2) , with E(h) the error corresponding to the step-size h.
For the next test problem, we consider the equation proposed in [25]: with the exact solution given by y(t) = t 8 − 3t 4+ α 2 + 9 4 t α .This problem is surely of interest because, unlike several other problems often proposed in the literature, it does not present an artificial smooth solution, which is indeed not realistic in most of the fractional-order applications.
The right-hand side and its Jacobian (for implicit methods), together with the main parameters of the problem, are defined by means of the MATLAB lines: f_fun = @(t,y,al) 40320/gamma (   With the aim of showing the application to MOSs of FDEs we first consider a classical fractional-order dynamical system consisting of the nonlinear Brusselator system: and we perform the computation for (α 1 , α 2 ) = (0.8, 0.7), (A, B) = (1.0,3.0) and (x 0 , z 0 ) = (1.2,After showing in Figure 2 the behavior of the solution, the errors and the EOCs are presented in Table 5.Table 5. Errors and EOC at T = 100.0for the Brusselator system of FDEs ( 32) with (α 1 , α 2 ) = (0.8, 0.7), (A, B) = (1.0,3.0) and (x 0 , z 0 ) = (1.2,2.8).A more involved problem has been considered in [50] as a benchmark problem for testing software for fractional-order problems.It is defined as: 6 (y(t) − 0.5)(z(t) − 0.3) + √ t D 0.2 t 0 y(t) = Γ(2.2)(x(t)− 1) D 0.6 t 0 z(t) = Γ(2.8)Γ(2.2) (y(t) − 0.5) x(0) = 1, y(0) = 0.5, z(0) = 0.3, (33) and its analytical solution is x(t) = t + 1, y(t) = t 1.2 + 0.5 and z(t) = t 1 .8+ 0.  We must report that integrating on [0, 5000] with small step-sizes by the two methods based on the PI trapezoidal rules leads to some loss of accuracy, while the two methods based only on PI rectangular rules still continue to provide accurate results; this phenomenon, which suggests avoiding the use of PI trapezoidal rules on very large integration intervals, seems related to the accumulation of round-off errors due to the huge number of floating point operations (indeed, the same issue is not reported on smaller integration intervals); as already mentioned in Section 3.4, the number of floating-point operations is proportional to O N(log 2 N) 2 (this value is reported in the last column of Table 9), a number that becomes very high in this case.
The propagation of round-off errors for the integration of fractional-order problems on large intervals needs however to be studied in a more in-depth way; as a rule of thumb, in these cases, we just suggest to prefer PI rectangular rules to PI trapezoidal rules due to their better stability properties [29].

Conclusions
In this paper we have presented some of the existing methods for numerically solving systems of FDEs and we have discussed their application to multi-order systems and linear multi-term FDEs.In particular, we have focused on the efficient implementation of product integration rules and we have presented some Matlab routines by providing a tutorial guide to their use.Their application has been moreover illustrated in details by means of some examples.

Supplementary Materials:
The MATLAB codes presented in the paper and listed in Table 2 are available on the software page of the author's web-site at https://www.dm.uniba.it/Members/garrappa/Software.

Figure 1 .
Figure 1.Scheme of the efficient algorithm for the convolution quadrature (9); squares S p represent the evaluation of partial sums of length p, and triangles T r represent convolution sums of fixed length r.

Figure 2 .
Figure 2. Behavior of the solution of the Brusselator multi-order system (MOS) (32) in the phase plane (a) and in the (t, x) and (t, z) planes (b).
and the results concerning errors and EOCs are reported in Table4.