Fractional derivative API

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

This page contain all of the existing API we can use for computing fractional derivative.

FractionalCalculus.fracdiffFunction

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, Caputo_Direct())

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

When the input end points is an array, fracdiff will compute

Refer to Caputo derivative

source

Caputo sense fractional derivative with first derivative known.

fracdiff(fd, α, start_point, end_point, Caputo_Direct_First_Diff_Known())

If the first order derivative of a function is already known, we can use this method to compute the fractional order derivative more precisely.

The inout function should be the first order derivative of a function

Example

julia> fracdiff(x->5*x^4, 0.5, 0, 2.5, Caputo_Direct_First_Diff_Known())

Return the semi-derivative of $f(x)=x^5$ at $x=2.5$.

Compared with Caputo_Direct method, this method don't need to specify step size, more precision are guaranteed.

source

Caputo sense fractional derivative with first and second derivative known.

fracdiff(fd1, fd2, α, start_point, end_point, Caputo_Direct_First_Second_Diff_Known)

If the first and second order derivative of a function is already known, we can use this method to compute the fractional order derivative more precisely.

Example

julia> fracdiff(x->5*x^4, x->20*x^3, 0.5, 0, 2.5, Caputo_Direct_First_Second_Diff_known())

Return the semi-derivative of $f(x)=x^5$ at $x=2.5$.

Compared with Caputo_Direct method, this method don't need to specify step size, more precision are guaranteed.

source

Caputo sense Piecewise algorithm

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

Using the piecewise algorithm to obtain the fractional derivative at a specific point.

Example

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

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

source

Caputo sense Diethelm computation

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

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

Example

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

!!!info "Scope" 0 < α < 1

source
fracdiff()

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

source

Grünwald–Letnikov sense fractional dervivative.

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

Example:

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

Please note Grunwald-Letnikov sense fracdiff only support 0 < α < 1.

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

source

Grünwald Letnikov sense derivative approximation

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

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

Example

julia> fracdiff(x->x, 0.5, 1, 0.007, GL_Multiplicative_Additive())
1.127403405642918
Inaccurate

The GL_Multiplicative_Additive method is not accruate, please use it at your own risk.

source

Grünwald Letnikov sense derivative approximation

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

Using Lagrange three poitns interpolation to approximate the fractional derivative.

Example

julia> fracdiff(x->x, 0.5, 1, 0.007, GL_Lagrange_Three_Point_Interp())
1.1283963376811044
Inaccurate

The GL_Multiplicative_Additive method is not accruate, please use it at your own risk.

source

Grünwald Letnikov sense derivative approximation

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

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

Example

julia> fracdiff(x->x, 0.5, 1, 0.01, GL_Finite_Difference())
1.1269695801851276
Inaccurate

GL_Finite_Difference method is not accruate, please use it at your own risk.

source
fracdiff(f, α, point, h, GL_High_Precision())

Use the high precision algorithms to compute the Grunwald letnikov fractional derivative.

Tip

The value interval passing in the function should be a array!

source
fracdiff(f, α, a, x, h, Hadamard_LRect())

Compute Hadamard sense using left rectangular formula.

source
fracdiff(f, α, a, x, h, Hadamard_Trap())

Compute Hadamard sense using right rectangular formula.

source
fracdiff(f, α, a, x, h, Hadamard_Trap())

Compute Hadamard sense using Trapezoidal formula.

source
fracdiff(f, α, end_point, h, Riesz_Symmetric())

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

source

Riemann Liouville sense derivative approximation

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

Using approximation to obtain fractional derivative value.

Example

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

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

source

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

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

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

Tip

With the advancing Triangular Strip Matrix method, you can not only compute fractional derivatives, integer order, higher order derivative is also supported!!

Try to set α as an integer, arbitrary integer of course! I promise you would enjoy it😏

source

Numerical methods for fractional calculus by Li, Changpin Page 57

Linear Spline Interpolation

source
FractionalCalculus.FracDiffAlgType

Base type of fractional differentiation algorithms, in FractionalCalculus.jl, all of the fractional derivative algorithms belong to FracDiffAlg

source
FractionalCalculus.Caputo_DirectType

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.

source
FractionalCalculus.GL_DirectType

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

source
FractionalCalculus.@fracdiffMacro
@fracdiff(f, α, point)

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

julia> @fracdiff(x->x, 0.5, 1)
1.1283791670955188
source