Is there any package for fractional derivatives?
Is there a package for fractional calculus?
I don’t think so. I more or less use fractional derivatives in my research. There are some related things in Julia.
Can you give more details on what you are looking for ?
Depending on your needs you can use ApproxFun: https://github.com/JuliaApproximation/ApproxFunExamples/blob/master/Extras/Fractional%20Integral%20Equations.ipynb
I have a data vector and I try to make the derivative of this data (I want to use it on a fractional controller.), I was developing a code using the Caputo derivative and power series but I decided to look for some package that already does that.
Few weeks ago I programmed the Grunwald-Letnikov fractional derivative for the analytic continuation of the Riemann zeta function. While there is a complex fractional differentiation recurrence relation I discovered which is generally applicable to any analytic function, the actual evaluations of this GL fractional derivative rather specific to the Hurwitz zeta function and requires the use of non-central Stirling numbers and MacLaurin summation… which is a specific formulation and is not universal.
I don’t know of a Julia package for this. Maybe this: https://github.com/JuliaControl/ControlSystems.jl could be useful.
Here’s how to do it in ApproxFun, assuming the data is smooth:
S = Legendre()
n = 50; # number of data points
p = range(-1,stop=1,length=n); # a non-default grid
v = exp.(p); # values at the non-default grid
m = 20 # number of basis functions
V = Array{Float64}(undef,n,m); # Create a Vandermonde matrix by evaluating the basis at the grid
for k = 1:size(V,2)
V[:,k] = Fun(S,[zeros(k-1);1]).(p)
end
f = Fun(S,V\v); # least squares fit to data
f_rl = LeftDerivative(0.5)*f # RL left half-derivative
f_cap = LeftIntegral(0.5)*Fun(f', S) # Caputo left half-derivative
using Plots
plot(f_rl;ylims=(0,3),legend=:bottomright,label="RL")
plot!(f_cap; label="Caputo")