Fractional derivative API

FractionalCalculus.jl has a disciplinary type system, by specifying which type you want to use, you can use the related algorithm to compute fractional differentiation and fractional integral.

This page contains all of the existing APIs we can use for computing fractional derivatives.

FractionalCalculus.fracdiffFunction
fracdiff(f, α, point, h, FracDiffAlg())

fracdiff is the general function for computing fractional derivative.

Example

julia> fracdiff(x->x^2, 0.5, 1, 0.001, RLDiffL1())
1.5044908143658473

There are many algorithms can be used to computing fractional derivative, please refer to our manual for more details: http://scifracx.org/FractionalCalculus.jl/dev/Derivative/derivativeapi/.

Caputo Sense fractional derivative

FractionalCalculus.CaputoDirectType

Caputo sense fractional derivative.

fracdiff(f::Function, α, start_point, end_point, step_size, ::Caputo)

Example:

julia> fracdiff(x->x^5, 0.5, 0, 2.5, 0.0001, CaputoDirect())

Returns a tuple (result, error), which means the value of this derivative is 141.59714979764541, and the error estimate is 1.1532243848672914e-6.

Refer to Caputo derivative

Note

Caputo Direct algorithms belong to direct computing, precise are ensured, but maybe cause more memory allocation and take more compilation time.

Using the direct mathematic expression:

\[^CD_t^α=\frac{1}{\Gamma(n-α)}\int_0^t\frac{f^{(n)}(τ)}{(t-τ)^{α+1-n}}\]

As for the derivative inside the integral, we use the Complex Step Differentiation to obtain a more accurate value.

FractionalCalculus.CaputoTrapType

Caputo sense Piecewise algorithm

fracdiff(f, α, end_point, h, CaputoTrap())

Using piecewise linear interpolation function to approximate input function and combining Caputo derivative then implement summation.

Example

julia> fracdiff(x->x^5, 0.5, 2.5, 0.001, CaputoTrap())

Return the fractional derivative of $f(x)=x^5$ at point $x=2.5$.

@article{LI20113352,
title = {Numerical approaches to fractional calculus and fractional ordinary differential equation},
author = {Changpin Li and An Chen and Junjie Ye},
}
FractionalCalculus.CaputoDiethelmType

Caputo sense Diethelm computation

fracdiff(f, α, end_point, h, CaputoDiethelm())

Using quadrature weights(derived from product trapezoidal rule) to approximate the derivative.

Example

julia> fracdiff(x->x, 0.5, 1, 0.007, CaputoDiethelm())
1.128378318687192
Scope

0 < α < 1

Diethelm's method for computingn Caputo sense fractional derivative using product trapezoidal rule and Richardsin extrapolation

@article{10.1093/imanum/17.3.479,
author = {DIETTELM, KAI},
title = "{Generalized compound quadrature formulae for finite-part integrals}",
journal = {IMA Journal of Numerical Analysis},
doi = {10.1093/imanum/17.3.479},
}
FractionalCalculus.CaputoHighPrecisionType

Caputo sense fractioal derivative with p-th order precision.

fracdiff(f, α, t, p, CaputoHighPrecision())

Use the high precision algorithm to compute the Caputo sense fractional derivative.

The p here is the grade of precision.

FractionalCalculus.CaputoHighOrderType

Caputo sense fractional derivative high order approximation.

Info

By using CaputoHighOrder method, we can set $0<\alpha<2$

Example

julia> fracdiff(x->x, 0.5, 1, 0.01, 2, CaputoHighOrder())
1.1283791670955123
@article{Li2017HighOrderAT,
  title={High-Order Approximation to Caputo Derivatives and Caputo-type Advection–Diffusion Equations: Revisited},
  author={Changpin Li and Minhao Cai},
  journal={Numerical Functional Analysis and Optimization},
  year={2017},
  volume={38},
  pages={861 - 890}
}

Grunwald Letnikov sense fractional derivative

FractionalCalculus.GLDirectType

Grünwald–Letnikov sense fractional dervivative.

fracdiff(f, α, start_point, end_point, GLDirect())

Example:

julia> fracdiff(x->x^5, 0, 0.5, GLDirect())
Scope

Please note Grunwald-Letnikov sense fracdiff only support $0 < \alpha < 1$.

Please refer to Grünwald–Letnikov derivative for more details.

Grunwald Letnikov direct compute method to obtain fractional derivative, precision are guaranteed but cause more memory allocation and compilation time.

FractionalCalculus.GLFiniteDifferenceType

Grünwald Letnikov sense finite difference approximation

fracdiff(f::Union{Function, Number}, α::AbstractArray, end_point, h, ::GLFiniteDifference)::Vector

Use finite difference method to obtain Grünwald Letnikov sense fractional derivative.

Example

julia> fracdiff(x->x, 0.5, 1, 0.01, GLFiniteDifference())
1.1269695801851276
FractionalCalculus.GLMultiplicativeAdditiveType

Grünwald Letnikov sense Multiplicative and Addtive approximation

fracdiff(f, α, end_point, h, GLMultiplicativeAdditive())

Grünwald–Letnikov multiplication-addition-multiplication-addition··· method to approximate fractional derivative.

Example

julia> fracdiff(x->x, 0.5, 1, 0.007, GLMultiplicativeAdditive())
1.127403405642918
@book{oldham_spanier_1984,
title={The fractional calculus: Theory and applications of differentiation and integration to arbitrary order},
author={Oldham, Keith B. and Spanier, Jerome},
year={1984}} 
FractionalCalculus.GLLagrangeThreePointInterpType

Grünwald Letnikov sense three point interpolation

fracdiff(f, α, end_point, h, GLLagrangeThreePointInterp())

Using Lagrange three poitns interpolation to approximate the fractional derivative.

Example

julia> fracdiff(x->x, 0.5, 1, 0.006, GLLagrangeThreePointInterp())
1.1261297605404632

Riemann Liouville sense fractional derivative

FractionalCalculus.RLDiffL1Type

Riemann Liouville sense derivative approximation

fracdiff(f, α, end_point, h, RLDiffL1())

Using the L1 algorithm Linear interpolation to approximate fractional derivative in Riemann Liouville fractional derivative sense.

Example

julia> fracdiff(x->x^5, 0.5, 2.5, 0.0001, RLDiffL1())
141.59707906952633
Warning

The RLDiffL1 algorithm only support for 0 < α < 1.

FractionalCalculus.RLDiffMatrixType

Riemann Liouville sense derivative using Triangular Strip Matrix to discrete and compute.

fracdiff(f, α, end_point, h, RLDiffMatrix())

Using Triangular Strip Matrix to approximate fractional derivative.

Example

julia> fracdiff(x->x^5, 0.5, 2.5, 0.0001, RLInt_Matrix())
Info

Triangular Strip Matrix method returns the derivative in the interval $[0, T]$ in Vector

@article{2009,
title={Matrix approach to discrete fractional calculus II: Partial fractional differential equations},
DOI={10.1016/j.jcp.2009.01.014},
author={Podlubny, Igor and Chechkin, Aleksei and Skovranek, Tomas and Chen, YangQuan and Vinagre Jara, Blas M.},
}
FractionalCalculus.RLLinearSplineInterpType

Riemann Liouville sense linear spline interpolation.

fracdiff(f, α, end_point, h, RLLinearSplineInterp())

Using linear spline interpolation method to approximate the Riemann Liouville fractional derivative.

FractionalCalculus.RLG1Type

Riemann Liouville sense G1 scheme

fracdiff(f, α, start_point, end_point, h, RLG1())

Remove the limit symbol in the definition of Grunwald-Letnikov fractional derivative, thereby leading to a discretization scheme in form of truncated series.

Tip
**RLG1** also can be used to compute fractional integral~
``+\alpha`` for fractional derivative and ``-\alpha`` for fractional integral.
@inproceedings{Guo2015FractionalPD,
  title={Fractional Partial Differential Equations and their Numerical Solutions},
  author={Boling Guo and Xueke Pu and Feng-Hui Huang},
  year={2015}
}
FractionalCalculus.RLDType

Riemann Liouville sense D scheme

    fracdiff(f, α, point, h, RLD())
@inproceedings{Guo2015FractionalPD,
  title={Fractional Partial Differential Equations and their Numerical Solutions},
  author={Boling Guo and Xueke Pu and Feng-Hui Huang},
  year={2015}
}

Hadamard sense fractional derivative

FractionalCalculus.HadamardLRectType

Hadamard sense left rectangular approximating algorithm

fracdiff(f, α, a, x, h, HadamardLRect())

Using finite part integral of left rectangular formula to compute the fractional hadamard derivative.

Example

julia> fracdiff(x->x, 0.5, 0, 1, 0.001, HadamardLRect())
0.9738507879228357
FractionalCalculus.HadamardRRectType

Hadamard sense right rectangular approximating algorithm

fracdiff(f, α, a, x, h, HadamardTrap())

Using finite part integral of right rectangular formula to compute the fractional hadamard derivative.

Example

julia> fracdiff(x->x, 0.5, 0, 1, 0.001, HadamardRRect())
0.9738507879228337
FractionalCalculus.HadamardTrapType

Hadamard sense trapezoidal approximating algorithm

fracdiff(f, α, a, x, h, HadamardTrap())

Using finite part integral of trapezoidal formula to compute the fractional hadamard derivative.

Example

julia> fracdiff(x->x, 0.5, 0, 1, 0.001, HadamardTrap())
0.9738507879228328

Riesz sense fractional derivative

FractionalCalculus.RieszSymmetricType

Riesz sense symmetric fractional derivative algorithm.

fracdiff(f, α, end_point, h, RieszSymmetric())

Compute fractional derivative of Riesz sense using Triangular Strip Matrix algorithm.

Example

julia> fracdiff(x->x, 0.5, 1, 0.01, RieszSymmetric())
FractionalCalculus.RieszOrtigueiraType

Riesz sense Ortigueira definition fractional derivative

fracdiff(f, α, end_point, h, RieszOrtigueira())

Ortigueira's definition of the symmetric Riesz derivative via centred differences

Usage

julia> fracdiff(x->x, 0.5, 1, 0.01, RieszOrtigueira())

Atangana Baleanu sense fractional derivative

FractionalCalculus.AtanganaSedaType

Atangana Baleanu sense fractional derivative computing using AtanganaSeda(Newton Polynomial) method.

fracdiff(f::Function, α, start_point, end_point, step_size, ::AtanganaSeda)

Example:

julia> fracdiff(x->x^5, 0.5, 2.5, 0.0001, AtanganaSeda())
-91.4589645808849

Reference

Fractional Stochastic Differential Equations

Caputo Fabrizio sense fractional derivative

FractionalCalculus.CaputoFabrizioASType

Atangana Seda algorithm for approximating Caputo-Fabrizio fractional Derivatives

fracdiff(f, α, point, h, CaputoFabrizioAS())

Example

julia> fracdiff(x->x, 0.5, 1, 0.001, CaputoFabrizioAS())
0.9893315392351845

Reference

Fractional Stochastic Differential Equations
FractionalCalculus.@fracdiffMacro
@fracdiff(f, α, point)

Return the α-order derivative of f at specific point.

julia> @fracdiff(x->x, 0.5, 1)
1.1283791670955188
FractionalCalculus.@semifracdiffMacro
@semifracdiff(f, point)

Return the semi-derivative of f at spedific point.

julia> @semifracdiff(x->x, 1)
1.1283791670955188

Symbolic fractional differentiation

FractionalCalculus.semidiffFunction

Symbolic fractional differentiation

semidiff(fun)

semidiff uses SymbolicUtils.jl and Symbolics.jl to compute symbolic fractional differentiation.

Example

julia> using SymbolicUtils
julia> @syms x
julia> semidiff(log(x))
log(4x) / sqrt(πx)