Numerical computation of fractional order derivatives and integrals can be done by applying many approaches. They include Riemann-Liouville and Caputo formulas. Both formulas include fractional order integration and integer order differentiation but in a different order: fractional order integration can be preceded by integer order differentiation or it can be done in the reverse order. In the paper we apply both formulas for FOD computation and investigate if an application of a particular order have any advantages, e.g. resulting in higher accuracy. The outcome of the experiment is that by applying adequately selected formula of FOD computation according to the shape of a particular function, the accuracy of computation can often be increased. Application of Riemann-Liouville formula enables successful FOD computation for functions which nth derivative does not exist.
Fractional calculus involves among the others application of fractional order derivatives (FOD) and fractional order integrals (FOI), which order can assume a real or a complex value. Thus derivatives and integrals of integer order can be considered as one of special cases of fractional calculus.
Fractional derivatives can be calculated using numerous approaches which include Riemann-Liouville fractional derivative (RL) and Caputo fractional derivative (C) . The latter definition is often preferred for simulations of real world processes and systems in a form of fractional differential equations (FDE) [2, 3] due to its ability to accept initial conditions in terms of integer order values. Riemann-Liouville fractional derivative definition does not have this practical application advantage and thus is mostly applied for theoretical considerations. However, regarding the subject of the paper, the substantial difference between RL and C definitions lies in the method of their computation: RL method involves repeated integration of a function and then differentiation of the resulting function with an integer order; C method attempts to arrive at the same result using the same operations, but in the reverse order. Thus using direction terms we can call RL and C left-hand and right-hand definitions, respectively.
The aim of the paper is to compare computational accuracy of fractional derivatives by applying the left-hand and the right hand definitions.
To fulfill this goal we have divided the paper in the following subsections: first there are presented formulas for fractional derivatives computation. The second subsection explains the terms left-hand and right-hand. The next one contains brief description of problems associated with FOD/FOI computation and presents numerous numerical methods which are applied for fractional derivatives computation. Difficulties associated with FOD/FOI application include computation of reference values required for accuracy assessment. Thus, the next section presents formulas and methods for their computation. The section after that one is devoted to computational accuracy comparison of the right- and left-hand definitions. It includes detailed results for computation of FOD for some functions in various ranges and short comment about it. The paper ends with conclusion which summarize the reasons for applying a particular definition for FOD computation.
2 Useful Formulas
The following formulas are applied for FOD/FOI computations. To differentiate between fractional and integer orders, fractional orders are commonly denoted by the Greek letters ν and μ and integer orders by the letters n and m.
Riemann-Liouville fractional integral for ν > 0 is defined as
Riemann-Liouville fractional derivative for ν > 0, μ > 0 is defined as
Caputo fractional derivative
with conditions f (t) = 0 for t ≤ 0, f (0) = 0, f(1) = f (2) ... f (n) = 0.
3 Explanation of Terms Left-hand Definition and Right-hand Definition
As it was stated in introduction, the reason for selecting such a naming schema for RL and C formulas is due to the method of their computation: first we select order ν ε R+. Then we calculate order n such that n − 1 < ν < n.
Having selected both numbers, we can calculate fractional derivative using left-hand definition presented in figure 1 and formulas (2) and (3). Here we first integrate a function with order n − ν and then we calculate nth derivative of the resulting function.
By applying right-hand definition presented in figure 2 and formula (4) and (6) we attempt to arrive at the same results in the reverse order: first we calculate nth order derivative of a function and then we integrate the resulting function with order n − ν.
4 Computation of Fractional Order Derivatives
Riemann-Liouville fractional order derivative and integral and Caputo fractional order derivative formulas (1)-(6) consist of an ordinary integral. However, the integral is difficult to compute due to presence of a singularity at the end of integration interval that is preceded by rapid values increase. Similarly to the term used for such occurrence in the world of differential equations, it will be called the stiffness.
The stiffness can increase or decrease correspondingly to the values of the exponent in the integrand in formulas (1)-(6) and characteristics of a function. However, it is the stiffness and the singularity presence that determine the accuracy of integral computation.
To compute fractional order derivatives and integrals by applying formulas (1)-(6) there can be applied commonly used methods of numerical integration, e.g. midpoint rule, trapezoidal rule, gauss quadratures of a general use, etc. However, their accuracy and effectiveness are heavily decreased by the presence of the singularity and the stiffness. Additionally, computation of FOD/FOI of the fractional orders near integer orders (e.g. 0 and 1) of any function is usually burdened with several hundred percent relative error. Thus we can say that none of commonly applied methods of integration can be considered as methods of general use for the purpose of computing FOD/FOI with high accuracy independently of order and interval.
To increase computational accuracy of FOD/FOI, either an applied method of numerical integration must be adapted to handle a difficult integrand properly or an integrand must be transformed to fit into the requirements of an applied numerical method of integration. Furthermore replacing standard double precision computer arithmetic with arbitrary precision for numerical integration enables increasing many times the overall accuracy of computation.
In our papers [5, 6] we presented two-way approach for computation accuracy increase of FOD/FOI, which included integrand transformation and adaptation of Gauss-Jacobi quadrature weight function with significant additional accuracy increase obtained by applying the GNU GMP  and the GNU MPFR  arbitrary precision mathematical libraries with C++ MPFR C++ interface  for programming.
For the reason of its high-accuracy abilities, efficiency and versatility, Gauss-Jacobi quadrature with adapted weight function is applied for the purpose of accuracy comparison of the FOD/FOI right- and left-hand definitions.
Application of Gauss quadratures enables solving efficiently problems associated with singularities and infinite limits by approximating an integrand and its difficult features by using polynomials. Wherein, particular polynomial is selected according to its properties to address a specific problem encountered in an integrand. If that is the case, the application of one of the Gauss quadratures assures high accuracy integration with a few sampling points.
Application of a Gauss quadrature (except for Gauss-Legendre quadrature) enables removing a problematic area or feature of an integrand from the integration and computing it by applying the formulas for the weights of a quadrature. However, Gauss quadratures can only be applied to a specific types of integrands, which is conditioned by the linkage to their weight functions.
By applying Gauss-Jacobi quadrature with the weight function p(x)
general formula of an approximate calculation of definite integral
can be expressed as
in which xk are zeros of Jacobi polynomial
We can use this property for FOD/FOI computation.
Removing kernel from an integrand
substituting λ = ν − 1, β = 0, we obtain
where Ak are weights of the quadrature.
Transforming the interval [0, t] into 〈−1,1〉
we obtain a formula (10) for Gauss-Jacobi quadrature (8) that is perfectly suited for FOD/FOI computation by applying formulas (1)-(6), i.e. kernel in integrand is not integrated but computed by applying the formula for the weights Ak of the quadrature and it does not determine accuracy of integration anymore.
From now on Riemann-Liouville fractional derivative formula (6) assumes the following computational form
in which n = ⌈ν⌉.
The ordinarily sufficient method of Gauss quadrature application is reduced to the use of tabulated values of nodes and weights. They are freely available and easy to incorporate into a computer program . However, its application becomes difficult if nodes and weights must be customized and computed, e.g. if the integrand does not meet fully or at all the requirements of a quadrature or required integration interval is different than foreseen for a quadrature. In all of the cases nodes and weights must be computed prior the integration.
Existing approaches for computing the nodes and the weights, some of which have been widely used for many years, suffer from
Fractional order derivative calculation by applying formulas (1)-(6) requires computation of n-th derivative of a function, where n is an integer. The following formulas are used for that purpose in the paper [12, 13]:
First derivative 3-points stencil Central Difference
where f1 ≡ f(x0 + h) and f−1 ≡ f(x0 − h).
Second derivative 3-points stencil Central Difference
Third derivative 3-points stencil Central Difference
The selection of uniform C++ equipped with the standard mathematical library as a main programming tool is not enough nowadays to take full advantage of available hardware. The application of arbitrary precision computing for increasing accuracy and correctness of numerical calculations and Nvidia CUDA parallelization technology for their effectiveness, are the best examples in this context .
Application of arbitrary precision makes it possible for the user to choose precision for calculation and for each variable storing a value. It is not machine-depended or IEEE standard types. With its help we can - among the others - increase general accuracy of mathematical computations. However, its application purpose is above all to increase accuracy of numerical calculations, e.g. by eliminating under- and overflows, increasing accuracy of a polynomial zeros finding and derivative and integral calculating.
The importance of elimination of limited precision in computer calculations was aptly presented by Toshio Fukushima in The Astronomical Journal in 2001 by giving the following example: “In the days of powerful computers, the errors of numerical integration are the main limitation in the research of complex dynamical systems, such as the long-term stability of our solar system and of some exoplanets [...]” and gives an example where using double precision leads to an accumulated round-off error of more than 1 radian for angular position of planets .
Double precision computer arithmetic is optimized for speed and has many flaws which negatively influence the accuracy of computations, e.g. limitations of number values which double precision variables can hold or no programmer influence on mathematical operations rounding.
However, it is the lack of clarity in handling of intermediate results which troubles the most, i.e. the floating-point standard  only defines that the results must be rounded correctly to the destination’s precision and fails to define the precision of destination variable. This choice is commonly made by a system or a programming language. The user can not influence it in any way. Therefore, the same program can return significantly different results depending on the implementation of the IEEE standard.
Arbitrary precision is applied in conjunction with special libraries which include their own data structures and mathematical functions.
5 Computational Accuracy Assessment of Fractional Order Derivatives
Accuracy and the efficiency assessment are crucial components in the process of programming because it enables examining a program for its proper operation and accuracy.
Common approach to the accuracy assessment requires an exact value.
In case of FOD/FOI computation, an effective accuracy assessment is difficult, sometimes not possible due to general lack of formulas for exact values.
Despite the availability of a handful of analytical formulas for fractional order
The following formulas for FOD/FOI are used further in the paper for calculations of their exact values:
Exponential function f (t) = e(at) by applying the Mittag-Leffler function with α = β = 1
In practice ∞ is replaced by large number N.
In our work we have to be able to assess the accuracy of FOD/FOI computation of any function. Thus we have developed a method of accuracy assessment by applying operators concatenation  of fractional order differentiation and integration.
The main idea behind this versatile criteria presented in Figure 3 is the ability to compare computed values of FOD/FOI with values of classical - integer order derivatives and integrals, which can be calculated by applying well known (and accurate) formulas.
6 Rules of Accuracy Comparison of FOD Computation
To compare computational accuracy of FOD we use relative error and infinity norm ||er||L∞ to measure similarity of two vectors x and
Tables 1-4 contain maximum relative error between vectors x and
|Function (18)||Function (19)||Function (20)||Function (21)|
|N||1.0e−06||1.0e− 36||1.0e− 06||1.0e− 36||1.0e− 06||1.0e− 36||1.0e− 06||1.0e− 36||←d|
|Function (18)||Function (19)||Function (20)||Function (21)|
|N||1.0e−06||1.0e− 36||1.0e − 06||1.0e − 36||1.0e − 06||1.0e − 36||1.0e − 06||1.0e − 36||←d|
|Function (18)||Function (19)||Function (20)||Function (21)|
|N||1.0e − 06||1.0e − 16||1.0e − 06||1.0e − 16||1.0e − 06||1.0e − 16||1.0e − 06||1.0e − 16||←d|
|Function (18)||Function (19)||Function (20)||Function (21)|
|N||1.0e−06||1.0e− 16||1.0e −06||1.0e − 16||1.0e − 06||1.0e − 16||1.0e − 06||1.0e − 16||←d|
7 Results of Accuracy Comparison of FOD Computation
Results presented in tables 1-4 confirm shape of integrand as the main factor which determines accuracy of FOD computation. The term ”shape of integrand” describes the behavior of a function in a given interval. In this scope: if we say ”dramatical shape changes of integrand”, we mean certain behavior of a function, in which the values of its derivatives (1st, 2nd and higher) assume high values.
The integrand included in RL and C formulas can be divided into a kernel and a function, i.e.
The kernel, which includes singularity determines difficulty of FOD/FOI computation. By applying Gauss-Jacobi quadrature for computation, it is possible to exclude the kernel from numerical integration and compute it by applying formulas for the weights of the quadrature (9) which assures significantly higher accuracy. However, results presented in tables 1-4 show that the accuracy can also be decreased by the shape of the function. For this reason an amount of sampling points (N) required for highest accuracy of FOD for a particular function varies from 4 to 64.
Accuracy of integer order numerical differentiation depends mainly on the width of sampling step of a function. As it is easy to see, the width required for the highest accuracy is beyond the capabilities of the standard double precision computer arithmetic. In this scope, an application of high precision libraries for programming is required. How many points are included is of secondary importance. However, 3-points stencil central difference is an optimum for the most cases. More points does not increase the accuracy.
FOD can be computed by using numerous approaches. It includes application of integer order differentiation of fractional order integral (Riemann-Liouville formula) or fractional order integration of integer order derivative (Caputo formula).
The goal of numerical experiment described in the paper was to compare accuracy of FOD computation by applying both approaches.
During the experiment we calculated FOD of selected orders for exponential, power and periodic functions in various ranges.
As it was mentioned in the problem description, computation of FOD with high accuracy is a real challenge for the computer and it can not be succeed by applying standard numerical methods. For this purpose it is required application of Gauss-Jacobi quadrature with adapted weight function for integration part and central differences method of higher order for integer order differentiation. Additionally, the standard double precision C++ programming language limitations were eliminated by applying for programming arbitrary precision with a help of mathematical libraries (GNU MPFR/GNU GMP and MPFR C++).
The resulting conclusion is that high accuracy computation of FOD can be achieved by applying both approaches (RL and C), provided the appropriate numerical method of integration and differentiation is used. However, due to the fact that accuracy of numerical integration and differentiation generally depends on a shape of a function, by applying an appropriate sequence of numerical calculations (RL or C formula) selected according to a shape of a particular function, can result with significantly higher accuracy.
An important advantage of RL formula over C formula is its capability of computing FOD of function which nth derivative does not exist (see results for computation of FOD of order 2.3 for a power function). In such case, application of C formula gives nan (not a number) result, where in the same situation, RL method results with accurate value of FOD.
Remark: To be able to apply C formula for computation of FOD for any function, it is required to apply equivalent Riemann-Liouville formula (6).
Communicated by Juan L.G. Guirao
I. Podlubny. Fractional Differential Equations. Academic Press, INC, San Diego Ca, 1999.
P. Ostalczyk. Zarys rachunku różzniczkowego i całkowego ułamkowych rzędów . Wydawnictwo Politechniki Łódzkiej, Łódź, Poland, 2006.
M. Abramowitz and I. A. Stegun. Handbook of Mathematical Functions. Applied Mathematics Series . Cambridge University Press, 1968.
N. Hale and A. Townsend. Fast and accurate computation of gauss-legendre and gauss-jacobi quadrature nodes and weights. Oxford Centre for Collaborative Applied Mathematics, 2012. OCCAM Preprint Number 12/79.
B.P. Demidowicz, I.A. Maron, and E.Z. Szuwałowa. Metody Numeryczne. Państwowe Wydawnictwo Naukowe, Warszawa, Poland, 1965.
J. M. Müller, N. Brisebarre, F. De Dinechin, C. P. Jeannerod, V. Lefevre, G. Melquiond, N. Revol, D. Stehle, and S. Torres. Handbook of Floating-Point Arithmetic . Birkhauser, New York, NY, 2010.
K. R. Ghazi, V. Lefevre, P. Theveny, and P. Zimmermann. Why and how to use arbitrary precision. IEEE Computer Society , 12(3):1–5, 2001.