# 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 contains all of the existing API we can use for computing fractional integral.

FractionalCalculus.fracintFunction
fracint(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.

source

## Riemann Liouville sense fractional integral

FractionalCalculus.RLIntType

Riemann-Liouville sense fractional integral algorithms

As the general fractional order integral type, RLInt is the parent type of all Riemann Liouville sense numerical methods.

source
FractionalCalculus.RLDirectType

Riemann 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

source
FractionalCalculus.RLPiecewiseType

Riemann 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.

source
FractionalCalculus.RLIntApproxType

Riemann 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.

source
FractionalCalculus.RLLinearInterpType

Riemann 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.

source
FractionalCalculus.RLIntMatrixType

Riemann 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())
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 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.

source
FractionalCalculus.RLIntSimpsonType

Riemann 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.

source
FractionalCalculus.RLIntTrapezoidalType

Riemann 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

source
FractionalCalculus.RLIntRectangularType

Riemann Liouville sense fractional integral using fractional rectangular formula to approximate.

Example

julia> fracint(x->x, 0.5, 1, 0.001, RLIntRectangular())
0.7516812175993778
source
FractionalCalculus.RLIntCubicSplineInterpType

Riemann 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.

Set h as 0.001 or bigger

For some reason, in the RLIntCubicSplineInterp method, set h as 0.001 would get better result.

Numerical Methods for Fractional Calculus Page 34

source

## Hadamard sense fractional integral

FractionalCalculus.HadamardMat
FractionalCalculus.@fracintMacro
@fracint(f, α, point)

Return the α-order integral of $f$ at specific point.

julia> @fracint(x->x, 0.5, 1)
0.7522525439593486
source

## Symbolic fractional integral

FractionalCalculus.semiintFunction

Symbolic 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)
source