Abstract
It has recently been demonstrated that both regular derivatives and contour integrals of analytic functions can be numerically evaluated to very high orders of accuracy utilizing only grid-based function values in the complex plane. Using closely related techniques, we show here the same to be true for the task of evaluating fractional order derivatives of analytic functions across the complex plane. Several cases are illustrated.
Similar content being viewed by others
Avoid common mistakes on your manuscript.
1 Introduction
During the last decades, fractional derivatives have been utilized in increasingly many application areas, as surveyed for ex. in [3, 23]. Regarding their numerical evaluations, previously available methods have generally suffered from low convergence rates. For functions that are analytic along a path connecting the fractional derivative’s base and evaluation points, the approach presented here converges faster than \(O(h^{22})\), where h is the grid spacing, thereby easily providing close to machine precision \(10^{-15}\) accuracy.
1.1 Concept of Present Method
A fractional derivative takes the form of an integral between a base point and an evaluation point. In the case that function values are available on an equispaced grid in the complex plane, we show here that the quadrature method developed in [6, 7] generalizes to the fractional derivative case, which features an end point singularity. Since the method is here applied to analytic functions, there is a wide choice of integration paths. We use straight line segments that follow grid lines, together with \(5\times 5\)-sized ‘correction stencils’ at each path corner and at the base and evaluation points.
1.2 Outline of Paper
Section 2 starts with an introductory description of fractional derivatives and of complex plane finite difference (FD) approximations of regular derivatives. We focus on Caputo derivatives, since this type commonly preferred in the context of differential equations. Such derivatives of analytic functions again become analytic functions, with the base point typically becoming a branch point of the derivative. Sections 3 and 4 review the complex plane quadrature method described in [6, 7] and generalize this to the situation with the end point singularity in the integrand. The case when the base- and evaluation points are only a few grid points apart requires a somewhat different method, discussed in Sect. 5. Other special cases arise when the function to be differentiated has singularities, discussed in Sect. 6. Some previous numerical methods, in particular the Grünwald-Letnikov formula, are briefly commented on in Sect. 7. Following Conclusions, two appendices give examples of correction stencil weights and illustrate computed fractional derivatives in a number of cases, respectively. The latter is supplemented by displays of convergence rates as the grid spacing h is reduced. In contrast to the case of regular (integer order) derivatives, it is less common that fractional derivatives of elementary functions are available in closed form. The examples in the last appendix where chosen among with analytic results available, in order to readily confirm theoretically predicted convergence rates and that machine precision accuracies indeed are reached.
2 Some Background Materials
2.1 Fractional Derivatives
The history of fractional derivatives is almost as old as that of regular (integer order) derivatives.Footnote 1 However, most applications as well as computational approaches are much more recent. An aspect that still has received very little attention is accurate numerical computation of fractional derivatives of analytic functions. We find in this study that for this task, a very effective computational approach becomes available.
One standard reference for the main types of fractional derivatives is the monograph [20] (briefly summarized in [14]). The two most commonly used definitions are
Riemann-Liouville:
and Caputo [2]:
With no loss of generality, we let the base point a be located at \(a=0\) and (initially) assume that the evaluation point t satisfies \(t>0\) (later t will be generalized to an arbitrarily placed point z in the complex plane). The two definitions are closely related:
In a complex z-plane, the derivatives \(f^{(k)}(0)\) can be approximated very effectively from grid-based values for f(z) [9]. Our present focus on Caputo rather than on Riemann-Liouville derivatives is largely motivated by the simplicity these offer in the contexts of Laplace transforms and in formulating initial conditions for ODEs, as described in [20], Chapter 4 and [14], Chapters 2,4.Footnote 2 We simplify the notation by writing \(_{0}^{C}D_{z}^{\alpha }f(z)\) as \(D^{\alpha }f(z)\). Since, for m integer, \(D^{\alpha +m}f(z)=D^{\alpha }D^{m}f(z),\) we furthermore focus on \(n=1\), i.e., \(0<\alpha <1\).
2.2 Fractional Derivatives of Analytic Functions
Functions f(z) with \(z=x+iy\) are analytic if \(\frac{df}{dz}=\lim _{\triangle z\rightarrow 0}\frac{f(z+\triangle z)-f(z)}{\triangle z}\) is uniquely defined, no matter from which direction in the complex plane \(\triangle z\) approaches zero. Analyticity has a large number of important consequences, as surveyed in complex variables textbooks, e.g., [1, 11]. Most of the commonly used functions in applied mathematics generalize from the real axis to analytic functions over parts or all of the complex plane.
Theorem 1
The fractional derivative
of an analytic function f(z) is again an analytic function.
Proof
We give two arguments below:
By Taylor expansion: With f(z) analytic around the base point \(z=0\), it has around this point a convergent Taylor expansion. Since for \(m\in {\mathbb {N}},\) \(D^{\alpha }z^{m}=\frac{\Gamma (m+1)}{\Gamma (m+1-\alpha )}z^{m-\alpha }\), a ratio test argument gives that \(D^{\alpha }f(z)=z^{-\alpha }\cdot \left\{ \begin{array}{l} \text {Taylor series with same}\\ \text {radius of convergence} \end{array}\right\} \). The fractional derivative introduces a branch point at the base point, but is otherwise analytic within at least the same circle of convergence.
By integration by parts: Let \(g(z)=D^{\alpha }f(z)\). Integration by parts in (4) gives \(g(z)=\frac{1}{\Gamma (2-\alpha )}\left( f'(0)\,z^{1-\alpha }+\int _{0}^{z}f''(\tau )\,(z-\tau )^{1-\alpha }d\tau \right) \) and therefore \(g'(z)=\frac{1}{\Gamma (1-\alpha )} \left( \frac{f'(0)}{z^{\alpha }}+\int _{0}^{z}\frac{f''(\tau )}{(z-\tau )^{\alpha }}d\tau \right) \). This derivative being well defined is a sufficient condition for g(z) to be analytic. Alternatively, we can note that \(g'(z)=\,_{0}^{RL}D_{z}^{\alpha }f'(z)\), which again is well defined. \(\square \)
2.3 Complex Plane FD Approximations
This section recalls briefly some observations from [9], in parts earlier described in [6, 7]. Complex plane FD stencils with \(N=(2n+1)\times (2n+1)\) nodes (\(n=1,2,\ldots \)) on a grid with spacing h will, for the \(p{\text {th}}\) derivative (\(p=1,2,3,\ldots \)), be accurate of order \(O(h^{N-p})\).Footnote 3 As examples of such stencils, Table 1 illustrates the weights in the cases of \(n=1\) and \(n=2\) for the first two derivatives. The order of accuracy for the shown \(3\times 3\) stencils are \(O(h^{8})\) and \(O(h^{7})\), and for the \(5\times 5\) stencils \(O(h^{24})\) and \(O(h^{23})\), respectively.
One major difference from traditional (real axis) FD approximations is that complex plane FD weights decrease in magnitude very much faster with the distance from the stencil’s center. With stencil nodes at \(z_{k}=\mu +i\,\nu ,\) \(-n\le \mu ,\nu \le +n\), the decay rate contains again an algebraic factor, but now further multiplied by the extremely rapidly decreasing factor \(e^{-\,\frac{\pi }{2}(\mu ^{2}+\nu ^{2})}\). This makes the approximations remain highly localized even when their stencil sizes / accuracy orders are increased.Footnote 4
3 Complex Plane FD Approximations for a Fractional Derivative
The present task is to numerically evaluate
for \(0<\alpha <1\). Assuming that f(t) is analytic and singularity free along the integration path that we choose, two issues prevent the trapezoidal rule (TR) end correction approach from [6] to be immediately applicable to the numerical evaluation of (5):
-
(i)
The factor \(\frac{1}{(z-\tau )^{\alpha }}\) causes a singularity at the upper end of the integration interval, and
-
(ii)
The numerator of the integrand is \(f'(\tau )\) rather than \(f(\tau )\).Footnote 5
3.1 End Corrections—Concept
Before embarking on derivations of end correction stencils for numerical integration, we illustrate their concept with two examples. The integral (5) is over a finite interval, and the path from 0 to z (complex) can be changed to line segments following grid lines horizontally and vertically in the complex plane. With insights from [6, 7], placing a correction stencil at each sub-interval end point, together with applying the trapezoidal rule (TR) in-between gives for analytic functions the accuracy \(O(h^{N+1})\), where N is the total number of nodes in each of the correction stencils.Footnote 6 For short intervals, the stencils at the two ends may overlap.
For both conceptual descriptions and derivations, it is simplest to consider the semi-infinite interval \([0,\infty ]\). In the case of \(\int _{0}^{\infty }f(z)dz\), one finds
The stencil is centered at the origin \(z=0\), and its entries are here rounded to four decimal places. These entries, as well as those for its \(5\times 5\) counterpart (accurate to \(O(h^{26})\)), were given in exact rational form in [6]. Apart from the central stencil entry 1/2 (alternatively included in the TR sum), the entries are numerically very small, but nevertheless greatly increase the accuracy order from \(O(h^{2})\) for the standard TR.
In the case of \(0<\alpha <1\), the upper end point in (5) is singular. After changing variable to move the singularity to \(z=0\), an integration by part is needed to get f(z) instead of \(f'(z)\).Footnote 7 Additionally, the interval [0, h] needs to be separated out to avoid subtracting infinities at the origin (arising from the integration by parts). The present novelty is that similarly accurate end corrections are again available. For example, in the case of \(\alpha =1/2\) (with the correction weight matrix again centered at \(z=0\)):
With \(5\times 5\) stencils, the accuracy orders increases to \(O(h^{49/2})\). End correction stencils of these kinds provide the key tools utilized below for accurate evaluation of (5). Appendix A shows the counterpart matrices to those in (6) and (7) for some different values of \(0<\alpha <1\), and also the \(n=2\) (size \(5\times 5\)) counterpart to the matrix in (7).
3.2 End Corrections—Explicitly
The task has become to numerically approximate
for \(0<\alpha <1\) and \(z>0\). Following the splitting of the interval [0, z] into \([0,z-h]\) and \([z-h,z]\) and integration by parts for the first of these sub-intervals, we obtain
For the central ‘interval’ part, we consider the trapezoidal rule (TR)-like approximationFootnote 8:
For the discussion that follows, we introduce the notation \(b(\tau )=\frac{f(\tau )}{(z-\tau )^{\alpha +1}}\) and \(c(\sigma )=f(z-\sigma )\) such that the ends of the original integration interval [0, z] correspond to \(\tau =0\) and \(\sigma =0\), respectively. We will next show how to obtain the weights in these correction stencils at the two ends.
3.2.1 Left End
We assume for now that the function \(f(\tau )\) and, with that, also \(b(\tau )\) is regular around \(\tau =0\).Footnote 9 Since (10) amounts to a TR approximation, the correction approach sketched out in Sect. 3.1 applies. Following the methodology in [6, 7], we replace \(b(\tau )=\frac{f(\tau )}{(z-\tau )^{\alpha +1}}\) in (10) by \(e^{\xi \tau }\), obtaining from (9) and (10)
In this Taylor expansion (convergent for \(\left| h\xi \right| <2\pi \)), the terms for \(k=2,4,6,\ldots \) vanish, as these correspond to the trivial zeros of the zeta function.Footnote 10 The approach described below in Sect. 3.3 will convert this series expansion to weights in an end correction stencil.
3.2.2 Right End
We here changed notation by \(z-\tau =\sigma \), and therefore \(f(\tau )=f(z-\sigma )=c(\sigma ).\) The end correction strategy, now replacing \(c(\sigma )\) by \(e^{\xi \sigma }\) in (10), leads us to consider (for \(\text {Re }\xi <0\)):
From the ‘interval’ part of (9):
It is critically important to what follows that the fractional power of \(\xi \), present in both (13) and (14), cancels when summed. The expression for \(S_{2}\) is thus a Taylor series in \(h\xi \) (again convergent for \(\left| h\xi \right| <2\pi \)). Without the terms with the fractional \(\xi \)-powers canceling, FD-based end correction would not have been possible since these, described further in Sect. 3.3, can only eliminate terms with integer powers of \(\xi \).
From the ‘right end’ part of (9):
We note that this sum \(S_{3}\) exactly cancels the sum in (13).
The calculation of I as given in (8) (and thereby also of \(D^{\alpha }(z)\)) now amounts to calculating the sum in (10) and then correcting this with stencils corresponding to the expansions above in integer powers of \(\xi \). Next section describes the conversion of these Taylor expansions to FD correction stencil weights.
3.3 Converting Taylor Expansions in \(\xi \) to Stencil Weights
With use of nodes located at \(z_{k},\) \(k=1,\ldots ,N\),Footnote 11 the task is to find weights \(w_{k}\) at these nodes, such that as many leading terms in an error expansion \(S(\xi )=\sum _{k=0}^{\infty }\alpha _{k}\xi ^{k}\) can be matched (and thus canceled by subtraction). Applying such a stencil also to the function \(e^{\xi \,z}\), the key idea is to make \(\sum _{k=1}^{N}w_{k}e^{\xi z_{k}}=\sum _{k=0}^{\infty }\alpha _{k}\xi ^{k}\) agree to as many powers of \(\xi \) as possible. Taylor expanding the exponentials and equating powers of \(\xi \) gives (when truncated to N terms)
Since the coefficients in each of the \(S_{1},S_{2},S_{3}\)-expansions have a factorial in their denominators, the factorials in the right hand side vector of (16) immediately cancel out. This linear system for finding the correction stencil weights \(w_{k}\) has a Vandermonde-type coefficient matrix, and is therefore always non-singular (assuming the nodes \(z_{k}\) are distinct). As described previously in [10] and here illustrated in Fig. 1, the weights in quadrature end correction stencils grow rapidly with n (stencil size), making sizes above \(n=3\) in most cases impractical.Footnote 12
In the descriptions in the next two Sects. 4 and 5, we continue to focus on the case when the base point (B) is at the origin, but let the evaluation point (E) be at some arbitrary grid point location in the complex plane (rather than only along the positive real axis; denoting its location by z).
4 Evaluation Point z Well Separated from Base Point: z Complex
We assume again that f(z) is non-singular at the base point \(z=0\). The main idea is to follow horizontal and vertical grid lines from B to E, as used for contour integrals in [6, 7] (i.e., with correction stencils also at each path corner). A key consideration is that no correction stencil, either centered at B or at a path corner point, can be close to E (as the integrand has a singularity there, and these correction stencils would then become inaccurate). Following this strategy, Fig. 2a, b illustrate suitable paths for two cases of E in the first quadrant. The dashed lines show branch cuts of the integrand in (1), (2), typically directed from E to the right. In case E is close to the negative real axis, Parts (c), (d) of the figure illustrate why the fractional derivative will have a branch line extending to the left from B (caused by the integrand being different in the two cases, when approaching E from the right).
Depending on the direction by which an interval end point is arrived at, the order of weights in the stencil will change as illustrated in Fig. 3 and a different factor of \(\left( \frac{h}{\triangle x+i\,\triangle y}\right) ^{\alpha }\) will also have to be applied to the stencil (e.g. when the evaluation point is reached from right to left, \(\triangle x=-h\) and \(\triangle y=0\) giving a factor of \((-1)^{\alpha }\).)
5 Evaluation Point Close to Base Point
The end correction approach described by (6) assumes that f(z) is smooth (can be well represented by a polynomial approximation) near the end point \(z=0\). When z in (10) is only a few grid points away from zero, the integrand \(\frac{f(\tau )}{(z-\tau )^{\alpha +1}}\) violates this, necessitating a different strategy, as is illustrated in Fig. 4a. We find the midpoint between B and E and approximate the Taylor expansion of f(z) centered at this midpoint. The resulting fractional derivative integral can then be evaluated analytically, term by term. Two practical issues this gives rise to are described next.
5.1 Numerically Stable Way to Approximate the Taylor Coefficients
The linear system that provides Taylor coefficients from grid data is of Vandermonde type, and the task is generally very ill-conditioned. However, if the data points are equispaced around a circle centered at the expansion point, the Vandermonde matrix becomes a scaled version of the DFT (Discrete Fourier Transform) matrix, which is orthogonal, and thus perfectly conditioned. This motivates the choice of grid points marked blue in Fig. 4, as an approximation to this perfect circle case. For our standard choice of \(n=2\) (i.e., \(5\times 5\) size correction stencils), the ‘rule of thumb’ we have followed is to apply the midpoint procedure within a radius of 10h from the origin.Footnote 13
5.2 Analytic Form of the Resulting Integrals
The key formula here is
where
This formula can be obtained for example by repeated integration by parts. Applying it to the Taylor terms obtained as described above produces the value of the fractional derivative at the evaluation point.
6 Some Special Cases
6.1 Function f(z) Singular at the Base Point \(z=0\)
If f(z) features a branch point at \(z=0\), such as \(f(z)=z^{\beta }g(z)\), where g(z) is analytic at the origin, the methods described above require some minor modifications. When the evaluation point is in the vicinity of the base point, we can Taylor expand g(z) around the origin (c.f., Fig. 4b) and apply the formula \(D^{\alpha }z^{\beta +k}=\frac{\Gamma (1+\beta +k)z^{\beta +k-\alpha }}{\Gamma (1+\beta +k-\alpha )}\) to each term of \(z^{\beta }g(z)\). On the other hand, when evaluation and base points are far from each other, a new correction stencil at the origin must be computed. The new weights will be applied to the function from which the singular term has been extracted, so will be applied to the values of g(z). In order to compute those weights, we will follow the same procedure as in Sect. 3.2.2, and obtain similarly to (12)
Figures 9 and 10 show no loss of accuracy compared to the cases when f(z) is non-singular at the base point. If \(\beta \) is a negative integer, f(z) has a pole at the origin. Then \(D^{\alpha }z^{\beta }\) diverges, as also reflected by the last sum in (18) containing a term with \(\zeta (1)=\infty \).
6.2 Function f(z) with Poles in the Complex Plane
The integral diverges if f(z) features a pole along the integration path. We will therefore choose integration paths that go beside poles while not crossing branch cuts. The integrals whose evaluation points are located at or within n nodes of the poles will diverge. Integrals following paths to some evaluation point \(z_{0}\), on the different sides of a pole \(z_{p}\) will differ by \(\frac{2\pi i}{\Gamma (1-\alpha )}\mathrm{Residue\left( \frac{f'(z)}{(z_{0}-z)^{\alpha }},\{z,z_{p}\}\right) }\). Fractional derivatives of a function with poles will therefore feature branch points where the poles of f are located. The path of the branch cut is arbitrary and points in Fig. 8 (showing the fractional derivative of \(f(z)=\frac{1}{1+z^{2}}\)) away from the origin. Function values on different sheets are further illustrated in Figs. 13 and 14, again for \(f(z)=\frac{1}{1+z^{2}}\).
6.3 Functions f(z) with Branch Cuts in the Complex Plane
Apart from some additional care being needed to not integrate across any branch cut, the methods described above apply. One case is illustrated in Fig. 11.
7 Previously Available Computational Approaches
Previously described numerical approaches for calculating fractional derivatives based only on function values consider only the case of real-valued evaluation points. They fall in three main categories:
-
1.
Function values are given on an equispaced grid,
-
2.
Function values are required at prescribed non-equispaced locations [12],Footnote 14 and
- 3.
Further references and discussions can be found for example in [4, 22]. Chapter 2 of the monograph [16] also contains an extensive survey of numerical methods for fractional derivatives. These are in many cases based on approximating f(t) by global or by piecewise polynomials, using either equi-spaced or Gaussian quadrature-type node sets. We will not make any attempt here to survey these numerous algorithm proposals, but refer readers to the references above. Concerns about several methods include slow rates of convergence under refinement, or restrictive assumptions (such as that the Taylor expansion of f(z), centered at the base or evaluation points, converges across the full interval of interest).
Grünwald-Letnikov formula: The sum
satisfies
It has a long history (introduced in 1868). Numerical usage of it is described for ex. in [20], Chapter 7. Following the idea (11)–(15) and again using \(f(z)=e^{\xi z}\) gives
The leading term \(-\xi ^{\alpha }\) agrees with the exact result, but the next term reflects an error of size \(O(h^{1})\). Since all terms in the expansion (20) contain fractional powers of \(\xi \), there is in this case no opportunity for FD-type end corrections.
8 Concluding Discussion
The approach for calculating fractional derivatives introduced here (trapezoidal rule along grid lines together with end corrections) is both highly accurate (better than \(O(h^{20})\) convergence rate) and computationally fast. Grid resolutions typical for ‘reasonably resolved’ functional displays suffice for double precision accuracy. Future opportunities for investigations include
-
(i)
Numerical evaluation of certain special functions. Cases listed in Table 17.1 in [15] include functions such as \(_{1}F_{1}(a;c;z)\) and \(_{2}F_{1}(a;b;c;z)\) expressed as fractional derivatives of elementary functions.
-
(ii)
Generalizations to cases when the functional data is available only along the real axis.Footnote 15
Data Availability
The code prepared during and analyzed during the current study is available on GitHub, as described in the text.
Notes
Usually considered to have begun with Leibniz’ reply in 1695 to an inquiry by L’Hôpital “... This is an apparent paradox from which one day useful consequences will be drawn.”
Another convenience with the Caputo version is that (2) implies that \(D^{\alpha }\{\text {constant}\}=0.\)
The infinite order accuracy (pseudospectral) \(n\rightarrow \infty \) limit is studied in [10].
We do not assume that also the derivative \(f'(z)\) is numerically available.
The TR part is exponentially accurate once interval end effects have been handled, and will not influence the order of accuracy.
This changes the singularity at origin from \(O(1/z^{\alpha })\) to \(O(1/z^{\alpha +1})\).
Including in the sum the right but not the left end point.
The case when \(f(\tau )\) has a singularity at \(\tau =0\) is considered in Sect. 6.1.
The nodes are in the present application on an h-spaced grid in the complex plane, but can also be arbitrarily located.
See also comments in the last paragraph of Appendix A.
Euler-Maclaurin-based estimates suggest error levels of around \(O(\frac{h}{|z|})^{(2n+1)^{2}}\), indicating \(r\approx 60h\) (impractically large) for \(n=1\) and \(r\approx 3h\) for \(n=3\).
Similar to the case for Gaussian quadrature methods.
As \(\alpha \rightarrow 0\), the divergence of \(\zeta (\alpha +1)\) is canceled by the factor \(\alpha \) in front of it; \(\lim _{\alpha \rightarrow 0}\alpha \,\zeta (\alpha +1)=1\).
References
Ahlfors, L.V.: Complex Analysis. McGraw-Hill, New York (1966)
Caputo, M.: Linear model of dissipation whose Q is almost frequency independent - II. Geophys. J. R. Astr. Soc. 13(5), 529–539 (1967)
Diethelm, K.: The Analysis of Fractional Differential Equations. Springer, Berlin, Heidelberg (2010)
Djida, J.D., Atangana, A., Area, I.: Numerical computation of a fractional derivative with non-local and non-singular kernel. Math. Model. Nat. Phenom. 12(3), 4–13 (2017)
Fornberg, B.: Euler-Maclaurin expansions without analytic derivatives. Proc. Royal Soc. Lond. Ser. A 476, 20200441 (2020). https://doi.org/10.1098/rspa.2020.0441
Fornberg, B.: Contour integrals of analytic functions given on a grid in the complex plane. IMA J. Numer. Anal. 41(2), 814–825 (2021)
Fornberg, B.: Generalizing the trapezoidal rule in the complex plane. Numer. Algorithms 87(1), 187–202 (2021)
Fornberg, B.: Improving the accuracy of the trapezoidal rule. SIAM Rev. 63(1), 167–180 (2021)
Fornberg, B.: Finite difference formulas in the complex plane. Numer. Algorithms 90(3), 1305–1326 (2022)
Fornberg, B.: Infinite order accuracy limit of finite difference formulas in the complex plane. IMA J. Num. Anal. (2023). https://doi.org/10.1093/imanum/drac064
Fornberg, B., Piret, C.: Complex Variables and Analytic Functions: An Illustrated Introduction. SIAM, Philadelphia (2020)
Hale, N., Olver, S.: A fast and spectrally convergent algorithm for rational-order fractional integral and differential equations. SIAM J. Sci. Comput. 80(4), A2456–A2491 (2018)
Higgins, A.: Numerical computations of fractional derivatives of analytic functions. SIAM Undergrad. Res. Online 15, 511–525 (2022). https://doi.org/10.1137/22S1520566
Ishteva, M.K.: Properties and applications of the Caputo fractional operator, Master’s thesis, University of Karlsruhe, (2005)
Lavoie, J.L., Osler, T.J., Tremblay, R.: Fractional derivatives and special functions. SIAM Rev. 18(2), 240–268 (1976)
Li, C., Zeng, F.: Numerical Methods for Fractional Calculus. CRC Press, Abingdon (2015)
Olver, F.W.J., Lozier, D.W., Boisvert, R.F., Clark, C.W.: NIST Handbook of Mathematical Functions. Cambridge University Press, Cambridge (2010)
Piret, C.: (2023). https://github.com/cmpiret/FractionalDerivatives
Piret, C., Hanert, E.: A radial basis functions method for fractional diffusion equations. J. Comput. Phys. 238, 71–81 (2013)
Podlubny, I.: Fractional Differential Equations. Academic Press, San Diego (1990)
Podlubny, I., Skovranek, T., Vinagre Jara, B.M., Petras, I., Verbitsky, V., Chen, Y.Q.: Matrix approach to discrete fractional calculus III: non-equidistant grids, variable step length and distributed orders. Phil. Trans. R. Soc. A 371, 21020153 (2013)
Pooseh, S., Almeida, R., Torres, D.F.M.: Numerical approximations of fractional derivatives with applications. Asian J. Control 15(3), 698–712 (2013)
Sun, H., Zhang, Y., Baleanu, D., Chen, W., Chen, Y.Q.: A new collection of real world applications of fractional calculus in science and engineering. Commun. Nonlinear Sci. Numer. Simul. 64, 213–231 (2018)
Vargas, A.M.: Finite difference method for solving fractional differential equations at irregular meshes. Math. Comput. Simul. 193, 204–216 (2022)
Funding
The authors declare that no funds, grants, or other support were received during the preparation of this manuscript.
Author information
Authors and Affiliations
Contributions
Both authors contributed to the study conception and design, and performed material preparation and analysis. Both authors read and approved the final manuscript.
Corresponding author
Ethics declarations
Conflict of interest
The authors have no relevant financial or non-financial interests to disclose.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendices
Appendix A: Examples of End Correction Stencils at a Singular End Point
We give here some examples of correction stencils for TR evaluation of \(\int _{h}^{\infty }\frac{f(z)}{z^{\alpha +1}}dz\), to be applied to f(z)-values around \(z=0\) for some \(\alpha \) in the range \(0<\alpha <1\), and having omitted the factor \(h^{-\alpha }\) in the right hand side of (16). Below are first some examples of \(n=1\) (\(3\times 3\)) stencils.
This value of \(\alpha =0.01\) is close to \(\alpha =0\) in which case the fractional derivative reduces to the function value at the evaluation point. Therefore, this stencil is close to one at its center point, and to zero at all other entries. In this and all following cases, the values above and below the real axis are the complex conjugates of each other, in particular being real along the real axis.
As \(\alpha \) approaches one, the weights diverge towards infinity (since the second term in the right hand side of (12) diverges).Footnote 16
In the (much more accurate) \(n=2\) case, the central weights differ very little from the \(n=1\) case, and the outer ones are numerically close to zero. For example for \(\alpha =0.5\):
If n is increased further, the stencil weights grow rapidly, with the central weight \(-19.04\) for \(n=3\) and around \(10^{12}\) for \(n=4\). If extremely high accuracy is desired, these larger stencils are nevertheless computationally cost-efficient, although their use requires extended precision arithmetic.
Appendix B: Illustrations of Fractional Derivatives and Numerical Convergence Rates
1.1 Illustrations of Some Computed Fractional Derivatives
The examples are all cases for which the analytic fractional derivatives are known, in order to allow straightforward verification that the numerical accuracy is consistently close to machine precision across the entire displayed regions. For more illustrations using this same numerical approach as developed here, see [13]. Examples of codes for the present algorithm can be found on GitHub [18].
For each function considered, we display the real and imaginary parts, the magnitude with phase angle, and the relative error of the approximation. Regarding the errors, the numbers by the colorbar correspond to \(\log _{10}\) of the error, i.e., -16 matches roughly the machine precision. The plots were produced using \(n=2\) (i.e., size \(5\times 5\) correction stencils) and only function values at the nodes of the displayed computational domain (padded with \(n=2\) layers of nodes). The end correction scheme is used in the entire domain except within the red circles shown in the error plots, where instead the Taylor expansion approaches described in Sect. 5 is used.
Fractional derivatives of analytic functions are, except on rare occasions (such as the one illustrated in Fig. 9) multi-valued functions. The method presented here can just as well compute values on any of its sheets, according to the formula \(D^{\alpha }f(z)=\frac{1}{e^{2\pi \,k\,\alpha \,i}}\left( \frac{1}{\Gamma (1-\alpha )}\int _{0}^{z}\frac{f'(\tau )}{(z-\tau )^{\alpha }}d\tau \right) \), where \(k\in \mathbb {{\mathbb {Z}}}\) and f(z) is assumed to be analytic at \(z=0\). Figures 13 and 14 illustrate both sheets in the case of of \(D^{1/2}\frac{1}{1+z^{2}}\).
1.2 Convergence Rates
Theoretically, with end correction stencils of size \(5\times 5\), we expect convergence to occur in the outer region at a rate better than \(O(h^{22})\). The computations in the inner regions (as described in Sect. 5) were implemented to give matching levels of accuracy. To verify these rates in a log-log plot of error vs. h, it is necessary to have a wide range of h-values that give results that are mostly free from the influence of rounding errors (which arise at the level \(O(10^{-15})\)). That can be achieved by using a much larger physical domain \([-20,20]\times [-20,20]\) than used in our previous displays. As seen in Fig. 15, this allows the high convergence rate to be confirmed for both outer and inner regions, although with the misleading impression that the error levels for the two regions are strongly different (rather than comparable, as seen in the previous Figs. 5, 6, 7, 8, 9, 10, 11 and 12). In Figs. 15a, b, the thin dashed and solid lines show the errors in the inner and outer regions, respectively, for the five choices of \(\alpha =0.1,\)0,3, 0.5, 0.7, 0.9 and the heavy solid lines indicates the slopes for \(O(h^{26})\) and for \(O(10^{-15}/h^{\alpha })\) in case of \(\alpha =1/2\), corresponding to theoretically expected error rates due to truncation and rounding errors, respectively.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Fornberg, B., Piret, C. Computation of Fractional Derivatives of Analytic Functions. J Sci Comput 96, 79 (2023). https://doi.org/10.1007/s10915-023-02293-4
Received:
Revised:
Accepted:
Published:
DOI: https://doi.org/10.1007/s10915-023-02293-4
Keywords
- Fractional derivatives
- Finite differences
- Complex variables
- Analytic functions
- Euler–Maclaurin
- Contour integration