Submitted:
18 April 2025
Posted:
18 April 2025
You are already at the latest version
Abstract
Keywords:
MSC: 34A08; 65R20; 65-04
1. Introduction
2. The Matlab© Codes
2.1. The Code fde12
| [t,y] = fde12(alpha,fdefun,t0,tfinal,y0,h,param,mu,mutol) |
- alpha is the order of the derivative;
- fdefun is the identifier of the function evaluating the vector field (fdefun(t,y)) which returns a column vector;
- [t0,tfinal] is the integration interval;
- y0 is a matrix with the initial conditions;
- h is the used stepsize, assumed constant;
- param (optional) contains possible parameters for fdefun;
- mu is the parameter in (4). The default value is , corresponding to the classical PECE implementation;
- mutol is the tolerance for testing the convergence of the corrector iteration in (4) (the default value is ).
2.2. The Code flmm2
- gives the coefficients of the fractional trapezoidal rule;
- defines a so-called fractional Newton-Gregory formula;
- gives the fractional BDF2 method.
| [t,y] = flmm2(alpha,fdefun,Jdefun,t0,tfinal,y0,h,param,method,tol,itmax) |
- alpha is the order of the derivative;
- fdefun is the identifier of the function evaluating the vector field (fdefun(t,y)), returning a column vector;
- Jfdefun is the identifier of the function evaluating the Jacobian (Jfdefun(t,y));
- [t0,tfinal] is the integration interval;
- y0 is a matrix with the initial conditions;
- h is the used stepsize, assumed constant;
- param contains possible parameters needed by fdefun and Jfdefun;
- method denotes the used fractional linear multistep method: 1 for the trapezoidal rule; 2 for the Newton-Gregory formula; 3 for the BDF2;
- tol is the tolerance for the convergence of the Newton iteration for solving (9) (the default value is );
- itmax is the maximum number of Newton iterations for solving (9) (the default value is 100).
2.3. The Code fcoll
| [t,y] = fcoll(f,b,gam,alpha,eta,r,N) |
- f is the identifier of the function implementing the vector field (f(t,y));
- b is the final integration time (the starting time is 0);
- gam is a column vector containing the initial conditions;
- alpha is the order of the fractional derivative;
- r is the parameter for the graded mesh (15);
- N is the number of mesh points.
2.4. The Code tsfcoll
| [t,y] = tsfcoll(f,b,gam,alpha,eta,r,N) |
2.5. The Code fhbvm
| [t,y,stats,err] = fhbvm( fun, y0, T, M ) |
-
fun is the identifier of a function computing:
- -
- the vector field (fun(t,y)), also in vector mode, returning row vectors;
- -
- the Jacobian (fun(t,y,1));
- -
- the order of the fractional derivative, if called without arguments;
- y0 is a matrix containing the initial conditions in (1);
- T is the width of the integration interval (the initial time being set at 0);
- t,y contain the computed solution (y is stored by rows);
-
stats is an optional vector containing the following four times:
- -
- the pre-processing time;
- -
- the execution time;
- -
- the pre-processing time for the error estimation;
- -
- the execution time for the error estimation.
Consequently, the total execution time is given by their sum; - err is an optional vector containing the estimated error on a doubled mesh (this is an expensive procedure, which is done only if this parameter is specified in output).
2.6. The Code fhbvm2
| [t,y,etim] = fhbvm2( fun, y0, T, N, n, nu ) |
-
fun is the identifier of a function computing:
- -
- the vector field (fun(t,y)) also in vector mode, returning row vectors;
- -
- the Jacobian (fun(t,y,1));
- -
- the order of the fractional derivative, if called without arguments;
- y0 is a matrix containing the initial conditions in (1);
- T is the width of the integration interval (the initial time being set at 0);
- t,y contain the computed solution (y is stored by rows);
- etim is an optional parameter containing the elapsed time.
3. The Test Problems
- alpha = probX, which returns the order of the fractional derivative;
- f = probX(t,y), which returns the vector field, with , if t is a scalar, or , if ;
- Jf = probX(t,y,1), which returns its Jacobian (only in one point);
- y = probX(t), which returns the solution evaluated at all points of t (if explicitly known), or numerically evaluated at . In this latter case, only probX(T) returns a non void vector. Moreover, if , then .
3.1. Linear Problems
3.1.1. Problem 1
3.1.2. Problem 2
3.1.3. Problem 3
3.1.4. Problem 4
3.2. Nonlinear Problems
3.2.1. Problem 5
3.2.2. Problem 6
3.2.3. Problem 7
3.2.4. Problem 8
3.2.5. Problem 9
3.2.6. Problem 10
4. Results
- fde12: we shall consider two values of the parameter mu, i.e., 1 and 10: we shall denote them as fde12 and fde12-10, respectively;
- flmm2: we set the parameters tol to , and itmax to , respectively. Moreover, we shall denote by flmm2-1, flmm2-2, flmm2-3 the usage of the code with the trapezoidal rule, the Newton-Gregory formula, and the BDF2 method, respectively;
- fcoll: we consider the collocation points, specified in the vector eta, fixed at the s Gauss-Legendre abscissae, . Moreover, we shall fix the following values of r for the graded mesh: 1 (if appropriate), 5, and 10. In general, we shall denote fcoll-s-r the corresponding implementation;
- tsfcoll: we choose the abscissae of the vector eta as , . Moreover, the parameter r is fixed as done for fcoll, and the respective implementations will be denoted as tsfcoll-s-r.
4.1. Results for Linear Problems
4.1.1. Problem 1
- fde12, fde12-10: , ;
- flmm2-1, flmm2-2, flmm2-3: , ;
- fcoll-3-5, fcoll-3-10, tsfcoll-3-5, tsfcoll-3-10: , ;
- fcoll-4-5, fcoll-4-10, tsfcoll-4-5, tsfcoll-4-10: , ;
- fcoll-5-5, fcoll-5-10, tsfcoll-5-5, tsfcoll-5-10: , ;
- fhbvm: ;
- fhbvm2: , , .
- fde12 is the less efficient code (about 500 sec are needed to obtain less than 6 digits of accuracy), and additional corrections are not effective, since only increase the execution time, without improving accuracy;
- flmm2 is more efficient that fde12, but less effective than the other codes. Moreover flmm2-3 achieves slightly more than 7 digits accuracy, whereas flmm2-1 and flmm2-2 can achieve slightly less than 10 significant digits in about 70 sec;
- fcoll is more efficient than flmm2, and the higher the number of collocation points, the more accurate the solution, which can reach more than 12 digits in 0.5 sec. Moreover, the choice of the parameter r seems not to affect the performance that much, even though is slightly better;
- tsfcoll performs quite differently, depending on the choice of the parameter r. In particular, the choice is much more effective than . In fact, for the same value of N, the execution time is approximately the same but the accuracy is pretty different: with , tsfcoll can reach about 14 digits of accuracy in 6 sec by using 3 collocation points, which are approximately the double of those obtained by using . Further, the code appears to be more effective when using 3 collocation points only;
- fhbvm and fhbvm2 are the most effective codes, showing a uniform accuracy of about 14 digits, and a negligible execution time (of less than sec).
4.1.2. Problem 2
- also in this case, the two codes fhbvm and fhbvm2 turn out to be the most effective ones, among those considered, with a uniformly high accurate solution (about 14 mescd) and a negligible execution time (less than sec);
- as for the previous problem, the highest order collocation fcoll implementations are the most effective, and appear not to be very sensitive to the choice of the parameter r used for the graded mesh (almost 12 digits of accuracy are obtained in about 0.5 sec);
- differently, also for this problem, the larger the parameter r is, the better the accuracy of the computed solution by tsfcoll with 3 collocation points (which is the only one always converging). In particular, tsfcoll-3-10 can reach an accuracy comparable to that of fhbvm and fhbvm2, thought with a much higher execution time (6 sec vs. and sec, respectively).
4.1.3. Problem 3
- fde12, fde12-10: ;
- flmm2-1, flmm2-2, flmm2-3 : ;
- fhbvm: ;
- fhbvm2: , , , .
- fde12 is able to reach about 3.5 significant digits in slightly more than 700 sec (fde12-10 does not improve accuracy but only increases the execution time);
- flmm2 is able to reach 5 significant digits in about sec, when using both the trapezoidal rule or the Newton-Gregory formula, whereas the version using BDF2 is less accurate, though requiring comparable execution times;
- fhbvm and fhbvm2 are the most efficient codes, reaching about 13 and 14 digits of accuracy, respectively, in less than sec.
4.1.4. Problem 4
- fde12, fde12-10: ;
- flmm2-1, flmm2-2, flmm2-3 : ;
- fhbvm: , ;
- fhbvm2: , , , .
- fde12-10 can reach an accuracy of about 3 mescd, higher than that of fde12, but with a high execution time (more than 2500 sec);
- flmm2-1 is more accurate than flmm2-2, which in turn is more accurate than flmm2-3 (all methods reach about 2 mescd), and all requiring about 700 sec of execution time;
- the codes fhbvm and fhbvm2 are able to reach more than 10 significant digits, in a much lower time. In particular, the double-mesh implementation used in the code fhbvm2, which is particularly efficient for solving problems with oscillatory solutions, results into an execution times of 1.5 sec, whereas fhbvm requires 70 sec (though it is slightly more accurate than fhbvm2).
4.2. Results for Nonlinear Problems
4.2.1. Problem 5
- fde12, fde12-10, flmm2-1, flmm2-2, flmm2-3 : ;
-
fcoll-3-1, fcoll-4-1, fcoll-5-1, tsfcoll-3-10, tsfcoll-4-10, tsfcoll-5-10:,
- fhbvm: , ;
- fhbvm2: , , .
- fde12-10 can reach 10 significant digits in 2 sec, thus performing better than fde12;
- flmm2-1 reaches about 11 mescd, and is slightly more accurate than flmm2-2, in turn slightly more accurate than flmm2-3, all methods requiring about 1 sec;
- the higher the number of the Gauss points, the more accurate is fcoll, which can reach about 14 significant digits in about sec;
- tfscoll is generally much less effective than fcoll, and when using 5 collocation points it has a very low accuracy;
- fhbvm and fhbvm2 have a uniform accuracy of about 15 significant digits with a very low execution time ( and sec, respectively).
4.2.2. Problem 6
- fde12, fde12-10, flmm2-1, flmm2-2, flmm2-3 : ;
-
fcoll-3-5, fcoll-3-10, tsfcoll-3-5, tsfcoll-3-10, fcoll-4-5, fcoll-4-10,tsfcoll-4-5, tsfcoll-4-10, fscoll-5-5, fscoll-5-10, tsfcoll-5-5, tsfcoll-5-10:, ;
- fhbvm: ;
- fhbvm2: , , , .
- fde and fde12-10 can reach about 9 significant digits in about 5 and 20 sec, respectively;
- flmm2 has a similar performance as fde12, with the exception for the BDF2 method, which is is less accurate, though all requiring about 7 sec with the smallest timestep;
- the higher the number of the Gauss points, the more accurate is fcoll, which can reach about 15 significant digits in sec. The use of the smaller parameter turns out to be slightly more effective than the choice ;
- tsfscoll with 4 or 5 collocation points and is comparable to the best results of fcoll, though requiring a slightly higher execution time;
- fhbvm reaches a uniform accuracy of about 11 significant digits with a very low execution time (less than sec);
- fhbvm2 has a uniform accuracy of about 15 significant digits with a very low execution time (about sec).
4.2.3. Problem 7
- fde12, fde12-10, flmm2-1, flmm2-2, flmm2-3 : ;
-
fcoll-3-5, fcoll-3-10, tsfcoll-3-5, tsfcoll-3-10, fcoll-4-5, fcoll-4-10,tsfcoll-4-5, tsfcoll-4-10, fscoll-5-5, fscoll-5-10, tsfcoll-5-5, tsfcoll-5-10:, ;
- fhbvm: ;
- fhbvm2: , , , .
- fde12 can reach about 3 significant digits of acuracy, with an execution time of more than 100 sec for fde12, and more than 500 sec for fde12-10;
- flmm2 achieves, whichever is the method used, the same accuracy of less than 6 digits, but requires about 1 hour of execution time, and about 100 sec for getting 5 digits of accuracy;
- fcoll has a better accuracy when considering a higher number of collocation points, and when using the larger value of the parameter r. In particular, when using 5 Gauss points and , it achieves an accuracy of more than 13 digits, in about 200 sec;
- tsfcoll does not converge, as said before, for , with the best results obtained by using and . In particular, about 8 significant digits in about 280 sec;
- fhbvm has a uniform accuracy of about 11 significant digits, in about 0.5 sec, whereas fhbvm2 has a uniform accuracy of 14 digits, in less than sec.
4.2.4. Problem 8
- fde12, fde12-10: ;
- flmm2-1, flmm2-2, flmm2-3 : ;
- fhbvm: ;
- fhbvm2: , .
- flmm2 is the less efficient code (all the 3 methods are roughly equivalent), able to reach about 10 significant digits in 10 sec;
- fde12 is slightly better, and more efficient than fde12-10, being able to achieve more than 11 digits of accuracy in about 6 sec;
- fhbvm and fhbvm2 have a uniform accuracy of more than 15 digits with an execution time of about sec.
4.2.5. Problem 9
| [t,y]=fhbvm2(’prob9’,[1.2 2.8],200,1000,50,1000); |
- fde12, fde12-10: , ;
- flmm2-1, flmm2-2, flmm2-3: , ;
- fhbvm: , ;
- fhbvm2: , , , .
- flmm2, whichever is the method used, has a comparable performance, and is able to obtain an accuracy of at most 8 significant digits in about 400 sec;
- fde12-10 performs better than fde12, but is is able to achieve less than 8 digit of accuracy (further decreasing the timestep does not improve accuracy but only increase the execution time) in about 40 sec;
- fhbvm and fhbvm2 have a uniform accuracy of 13 digits, reached in about 2.5 sec and 0.5 sec, respectively.
4.2.6. Problem 10
| [t,y]=fhbvm2(’prob10’,[0 -2],30,1000,50,1000); |
- fde12 and fde12-10 do not converge even when using a timestep as small as ;
- flmm2-1, flmm2-2, and flmm2-3 exhibit problems in the convergence of the nonlinear iteration, even when using a timestep as small as .
- fhbvm: , ;
- fhbvm2: , , , .
5. Discussion and Conclusions
- the code fde12 is appropriate for problems for which a constant timestep (with possible corrections terms at the initial point) works well, and having smooth solutions. In this case, also the PECE implementation of the methods is appropriate. This code is generally not effective, when a high accuracy is required for the numerical approximation;
- the code flmm2 has similar features as fde12, but it is more robust, due to the implicit nature of the methods implemented into the code. These latter have roughly the same effectiveness (BDF2 slightly less), and are appropriate when a low accurate solution is enough;
- the code fcoll can be very effective, when using a high number of Legendre collocation points. It appears to be not very sensitive to the choice of the grading parameter of the mesh, which confers robustness. It has, however, a couple of severe weak points: the fact of solving scalar problems only, and the use of a general purpose function for solving the generated discrete problems (the Matlab© function fsolve);
- the code tsfcoll appears to be less robust than fcoll, since it is more sensitive on the choice of the grading parameter, and on the number of collocation points. In particular, their choice is, in our experience, another open problem. Alike fcoll, tsfcoll is currently restricted to the solution of scalar problems, and uses a non-specialized method for solving the generated discrete problems;
- fhbvm appears to be among the most effective codes here tested, with the additional feature of requiring almost no tuning parameter, to reach a high accurate solution. It is very effective when either a constant mesh or a graded one are to be used and, in the latter case, it automatically computes the optimal parameters for it. The code is less efficient, though always being able to obtain a fully accurate solution, when the problem at hand couples a nonsmooth vector field at the origin with an oscillatory subsequent solution;
- the code fhbvm2 can reach the same high accuracy of the code fhbvm, only requiring to tune a few input parameters. Moreover, it has the ability of coupling an initial graded mesh with a subsequent uniform one, thus resulting efficient also for problems having both a nonsmooth vector field at the origin, and a subsequent periodic solution. In such a case, its execution time can be quite a bit smaller than that of fhbvm.
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Diethelm, K. The Analysis of Fractional Differential Equations. An Application-oriented Exposition using Differential Operators of Caputo Type. Lecture Notes in Math., Springer, Berlin, 2010. [CrossRef]
- Podlubny, I. Fractional differential equations: an introduction to fractional derivatives, fractional differential equations, to methods of their solution and some of their applications. Academic Press, Inc., San Diego, CA, 1999.
- Garrappa, R. Numerical Solution of Fractional Differential Equations: A Survey and a Software Tutorial. Mathematics 2018, 6, 16. [Google Scholar] [CrossRef]
- Diethelm, K.; Garrappa, R.; Stynes, M. Good (and Not So Good) Practices in Computational Methods for Fractional Calculus. Mathematics 2020, 8, 324. [Google Scholar] [CrossRef]
- https://people.dimai.unifi.
- https://archimede.uniba.it/~testset/testsetivpsolvers/ (accessed on April 6, 2025).
- Garrappa, R. On linear stability of predictor-corrector algorithms for fractional differential equations. Internat. J. Comput. Math. 2010, 87, 2281–2290. [Google Scholar] [CrossRef]
- http://www.mathworks.com/matlabcentral/fileexchange/32918 (accessed on March 24, 2025).
- Hairer, E.; Lubich, Ch.; Schlichte, S. Fast numerical solution of nonlinear Volterra convolution equations SIAM J. Sci. Statist. Comput. 1985, 6, 532–541. [Google Scholar] [CrossRef]
- Garrappa, R. Trapezoidal methods for fractional differential equations: theoretical and computational aspects. Math. Comput. Simulation 2015, 110, 96–112. [Google Scholar] [CrossRef]
- http://www.mathworks.com/matlabcentral/fileexchange/47081-flmm2 (accessed on March 24, 2025).
- Lubich, C. Discretized fractional calculus. SIAM J. Math. Anal. 1986, 17, 704–719. Available online: https://epubs.siam.org/doi/pdf/10.1137/0517050. [CrossRef]
- Cardone, A; Conte, D.; Paternoster, B. A MATLAB implementation of spline collocation methods for fractional differential equations. In: Gervasi O. et al. (eds.) Computational Science and Its Applications – ICCSA 2021. Lecture Notes in Computer Science 12949,2021, pp. 387–401. [CrossRef]
- Cardone, A; Conte, D.; Paternoster, B. A MATLAB Code for Fractional Differential Equations Based on Two-Step Spline Collocation Methods. In: Cardone A. et al. (eds.), Fractional Differential Equations – INDAM 2021. Springer INdAM Series 50, 2023 pp. 121–146. [CrossRef]
- Brugnano, L.; Burrage, K.; Burrage, P.; Iavernaro, F. A spectrally accurate step-by-step method for the numerical solution of fractional differential equations. J. Sci. Comput. 2024, 99, 48. [Google Scholar] [CrossRef]
- Amodio, P.; Brugnano, L.; Iavernaro, F. Analysis of Spectral Hamiltonian Boundary Value Methods (SHBVMs) for the numerical solution of ODE problems. Numer. Algorithms 2020, 83, 1489–1508. [Google Scholar] [CrossRef]
- Brugnano, L.; Gurioli, G.; Iavernaro, F. Numerical solution of FDE-IVPs by using Fractional HBVMs: the fhbvm code. Numer. Algoritms 2025, 99, 463–489. [Google Scholar] [CrossRef]
- Brugnano, L.; Gurioli, G.; Iavernaro, F. Solving FDE-IVPs by using Fractional HBVMs: Some experiments with the fhbvm code. J. Comput. Methods Sci. Eng. 2025. [Google Scholar] [CrossRef]
- https://people.dimai.unifi.it/brugnano/fhbvm/ (accessed on April 10, 2025).
- Brugnano, L.; Iavernaro, F. Line Integral Methods for Conservative Problems. Chapman et Hall/CRC, Boca Raton, FL, 2016.
- Brugnano, L.; Iavernaro, F. Line integral solution of differential problems. Axioms 2018, 7(2), 36. [Google Scholar] [CrossRef]
- Brugnano, L.; Gurioli, G.; Iavernaro, F.; Vikerpuur, M. Analysis and implementation of collocation methods for fractional differential equations. arXiv 2025, arXiv:2503.17719. [Google Scholar] [CrossRef]
- Garrappa, R. Numerical evaluation of two and three parameter Mittag-Leffler functions. SIAM J. Numer. Anal. 2015, 53(3), 1350–1369. [Google Scholar] [CrossRef]
- http://www.mathworks.com/matlabcentral/fileexchange/48154-the-mittag-leffler-function (accessed on April 7, 2025).
- Satmari, Z. Iterative Bernstein spline technique applied to fractional order differential equations. Math. Foundations Computing 2023, 6, 41–53. [Google Scholar] [CrossRef]
- Petrás̆, I. Fractional-order nonlinear systems. Modeling, analysis and simulation. Nonlinear Physical Science Ser., Springer, Heidelberg, 2011.




















Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
