Fractional integral 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 API we can use for computing fractional integral.
FractionalCalculus.fracint
— Functionfracint(f, α, point, h, FracIntAlg())
The general function used for fractional integral computing.
Example
julia> fracint(x->x^2, 0.5, 1, 0.001, RLInt_Approx())
0.6017877646029814
There are many algorithms can be used to computing fractional integral, please refer to our manual for more details: manual.
Riemann Liouville sense fractional integral
FractionalCalculus.RLInt
— TypeRiemann-Liouville sense fractional integral algorithms
As the general fractional order integral type, RLInt is the parent type of all Riemann Liouville sense numerical methods.
FractionalCalculus.RLDirect
— TypeRiemann Liouville sense direct compute
fracint(f::Function, α, start_point, end_point, h, RLDirect())
Riemann_Liouville fractional integral using complex step differentiation.
\[(J^αf)(t)=\frac{1}{\Gamma(α)} \int_0^t(t-τ)^{α-1}f(τ)dτ\]
By using QuadGK calculate the integration and obtain the value.
Example:
julia> fracint(x->x^5, 0.5, 0, 2.5, 1e-8, RLDirect())
(64.36234189727955, 7.742994054849976e-7)
Returns a tuple (1.1639316474512205, 1.0183453796725215e-8), which contains the value of this derivative is 1.1639316474512205, and the error estimate is 1.0183453796725215e-8
FractionalCalculus.RLPiecewise
— TypeRiemann Liouville sense fractional integral using piecewise interpolation.
fracint(f, α, end_point, h, RLPiecewise())
Example
julia> fracint(x->x^5, 0.5, 2.5, 0.0001, RLPiecewise())
64.36234206345209
By deploying Piecewise interpolation to approximate the original function, with small step size, this method is fast and take little memory allocation.
Using piecewise linear interpolation:
\[ y_n(t)=\frac{t-t_{i+1}}{t_i-t_{i+1}}y(t_i)+\frac{t-t_i}{t_{i+1}-t_i}y(t_{i+1})\]
Constitute the original function with the interpolation and implement the summation.
FractionalCalculus.RLIntApprox
— TypeRiemann Liouville sense fractional integral approximation.
fracint(f, α, end_point, h, RLIntApprox())
Example
julia> fracint(x->x^5, 0.5, 2.5, 0.0001, RLIntApprox())
64.36229646291393
Using the Staircase approximation to approximate the original function and implement the summation.
FractionalCalculus.RLLinearInterp
— TypeRiemann Liouville sense fractional integral using Linear interpolation.
fracint(f, α, end_point, h, RLLinearInterp())
Example
julia> fracint(x->x^5, 0.5, 2.5, 0.0001, RLLinearInterp())
64.36234206434942
RLLinearInterp is more complex compared with RLIntApprox but more precise.
Deploying the Linear Interpolation between $f_{j+1}$ and $f_j$, RLLinearInterp method is more precise than RLIntApprox.
FractionalCalculus.RLIntMatrix
— TypeRiemann Liouville sense integral using Triangular Strip Matrix to discrete.
fracint(f, α, end_point, h, RLIntMatrix())
Using Triangular Strip Matrix to approximate fractional integral.
Example
julia> fracint(x->x^5, 0.5, 2.5, 0.0001, RLIntMatrix())
Triangular Strip Matrix method returns the derivative in the interval $[0, T]$ in Vector
With the advancing Triangular Strip Matrix method, you can not only compute fractional integrals, integer order, higher order integral is also supported!!
Try to set α as an integer, arbitrary integer of course! I promise you would enjoy it😏
Using Triangular Strip Matrix to discrete the integral.
FractionalCalculus.RLIntSimpson
— TypeRiemann Liouville sense fractional integral using fractional Simpson's formula to approximate.
Example
julia> fracint(x->x, 0.5, 1, 0.000001, RLIntSimpson())
0.7516516520541335
@inproceedings{Li2015NumericalMF,
title={Numerical Methods for Fractional Calculus},
author={Changpin Li and Fanhai Zeng},
year={2015}
}
Using fractional Simpson's formula to discrete fractional integral.
FractionalCalculus.RLIntTrapezoidal
— TypeRiemann Liouville sense fractional integral using fractional trapezoidal formula to approximate.
Example
julia> fracint(x->x, 0.5, 1, 0.001, RLIntTrapezoidal())
0.7522527780636226
《Numerical methods for fractional calculus》. Using Trapezoidal method to approximate fractional integral
FractionalCalculus.RLIntRectangular
— TypeRiemann Liouville sense fractional integral using fractional rectangular formula to approximate.
Example
julia> fracint(x->x, 0.5, 1, 0.001, RLIntRectangular())
0.7516812175993778
FractionalCalculus.RLIntCubicSplineInterp
— TypeRiemann Liouville sense fractional integral using cubic spline interpolation to approximate.
Example
julia> fracint(x->x, 0.5, 1, 0.0001, RLIntCubicSplineInterp())
0.7529119186452693
Error estimate of this method is $\mathcal{O(h^4)}$, it is determined by the error of the cubic spline interpolation.
For some reason, in the RLIntCubicSplineInterp method, set h as 0.001 would get better result.
Numerical Methods for Fractional Calculus Page 34
Hadamard sense fractional integral
FractionalCalculus.HadamardMat
FractionalCalculus.@fracint
— Macro@fracint(f, α, point)
Return the α-order integral of $f$ at specific point.
julia> @fracint(x->x, 0.5, 1)
0.7522525439593486
FractionalCalculus.@semifracint
— Macro@semifracint(f, point)
Return the semi-integral of $f$ at specific point.
julia> @semifracint(x->x, 1)
0.7522525439593486
Symbolic fractional integral
FractionalCalculus.semiint
— FunctionSymbolic fractional integral
semiint(fun)
semiint
uses SymbolicUtils.jl and Symbolics.jl to compute symbolic fractional integral.
Example
julia> using SymbolicUtils
julia> @syms x
julia> semiint(x^4)
0.45851597901024005(x^4.5)