Fractional integral 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 integral.
FractionalCalculus.fracint
— FunctionRiemann Liouville sense fractional integral
fracint(f::Function, α, start_point, end_point, h, RL_Direct())
Example:
julia> fracint(x->x^5, 0.5, 0, 2.5, 1e-8, RL_Direct())
Riemann_Liouville fractional integral using complex step differentiation. 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
Riemann Liouville sense fractional integral with first diff known.
fracint(f, fd, α, start_point, end_point, RL_Direct_First_Diff_Known())
Example
julia> fracint(x->x^5, x->5*x^4, 0.5, 0, 2.5, RL_Direct_First_Diff_Known())
With first order derivative known, we can directly use it in the computation of α order fraction integral
Riemann Liouville sense fractional integral using piecewise interpolation.
fracint(f, α, end_point, h, RL_Piecewise())
Example
julia> fracint(x->x^5, 0.5, 2.5, 0.0001, RL_Piecewise())
By deploying Piecewise interpolation to approximate the original function, with small step size, this method is fast and take little memory allocation.
Riemann Liouville sense fractional integral approximation.
fracint(f, α, end_point, h, RLInt_Approx())
Example
julia> fracint(x->x^5, 0.5, 2.5, 0.0001, RLInt_Approx())
Riemann Liouville sense fractional integral using Linear interpolation.
fracint(f, α, end_point, h, RL_LinearInterp())
Example
julia> fracint(x->x^5, 0.5, 2.5, 0.0001, RL_LinearInterp())
RL_LinearInterp is more complex but more precise.
Riemann Liouville sense integral using Triangular Strip Matrix to discrete and compute.
fracint(f, α, end_point, h, RLInt_Matrix())
Using Triangular Strip Matrix to approximate fractional integral.
Example
julia> fracint(x->x^5, 0.5, 2.5, 0.0001, RLInt_Matrix())
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😏
Riemann Liouville sense integral using fractional Simpson's formula to approximate.
《Numerical methods for fractional calculus》. Using Trapezoidal method to approximate fractional integral
Error estimate is $\mathcal{O(h^4)}$, it is determined by the error of the cubic spline interpolation.
For some reason, in the RLIntCubicSpline_Interp method, set h as 0.001 would get better result.
FractionalCalculus.FracIntAlg
— TypeThe base type of a fractional integral sense, in FractionalCalculus.jl, all of the fractional integral senses belong to FracIntAlg
FractionalCalculus.RLInt
— TypeRiemann-Liouville sense fractional integral algorithms
Note this two algorithms belong to direct compute, precise are ensured, but maybe cause more memory allocation and take more compilation time.
FractionalCalculus.RL_Direct
— TypeUsing the direct mathematic expression:
\[(J^αf)(t)=\frac{1}{\Gamma(α)} \int_0^t(t-τ)^{α-1}f(τ)dτ\]
By using QuadGK calculate the integration and obtain the value.
FractionalCalculus.RL_Direct_First_Diff_Known
— TypeWith first derivative known, we can use the Riemann Liouville sense to obtain the fractional integral more effcient.
FractionalCalculus.RL_Piecewise
— TypeUsing 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.RLInt_Approx
— TypeUsing the Staircase approximation to approximate the original function and implement the summation.
FractionalCalculus.RL_LinearInterp
— TypeDeploying the Linear Interpolation between $f_{j+1}$ and $f_j$, RL_LinearInterp method is more precise than RLInt_Approx.
FractionalCalculus.RLInt_Matrix
— TypeUsing Triangular Strip Matrix to discrete the integral.
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