# [ANN] FdeSolver.jl: solve fractional differential equations (FDEs)

I’d like to announce a package for solving differential equations (and systems) with fractional derivatives (in the sense of Caputo).

Fractional derivatives are suitable tools for modeling memory effects in complex systems, such as microbial communities.

The core function is FDEsolver, which includes a numerical solution based on predictor - corrector methods (the number of correction steps is customisable).

Here’s how FDEsolver can be used to solve a generalised Lotka-Volterra model with memory:

using FdeSolver
using Plots

# Inputs
tSpan = [0, 25]                    # [intial time, final time]
y0 = [34, 6]                       # initial values
β = [0.98, 0.99]                   # order of derivatives
par = [0.55, 0.028, 0.84, 0.026]   # model parameters

# ODE Model
function F(t, y, par)

α1 = par[1]      # growth rate of the prey population
β1 = par[2]      # rate of shrinkage relative to the product of the population sizes
γ = par[3]       # shrinkage rate of the predator population
δ = par[4]       # growth rate of the predator population as a factor of the product
# of the population sizes

u = y[1]         # population size of the prey species at time t[n]
v = y[2]         # population size of the predator species at time t[n]

F1 = α1 .* u .- β1 .* u .* v
F2 = - γ .* v .+ δ .* u .* v

[F1, F2]

end

## Solution
t, Yapp = FDEsolver(F, tSpan, y0, β, par)

# Plot
plot(t, Yapp, linewidth = 5, title = "Solution to LV model with 2 FDEs",
xaxis = "Time (t)", yaxis = "y(t)", label = ["Prey" "Predator"])
plot!(legendtitle = "Population of")

In the future, we would like to add the following features:

• Support solutions for FDEs with multiterm fractional derivatives in each equation;
• Improve the efficiency (accuracy and speed) of the current solver;
• Expand to other numerical methods.

We happily seek new collaborations, feedback, and ideas, either by getting in touch or simply by opening an issue or pull request in FdeSolver.jl.

This FDE solver is based on some of the MATLAB solvers provided by R. Garrappa (FDE_PI2_Im and FDE_PI12_PC).

For additional examples and information on the solver, check out its documentation or the readme.

9 Likes

Would it make sense to make this package follow the interface of DifferentialEquations where you have a separate solve command from the command to setup the problem? That distinction has worked well for them.

3 Likes

Hi!

I’m pretty sure that could be implemented.

Besides adding consistency with DifferentialEquations, could it also improve the solver in any other way?

The reason DifferentialEquations chose this approach is it lets you separate the arguments that relate to the solver from the arguments that relate to the problem. The *Problem defines things like the function, initial conditions, and parameters for the function, while the solve takes parameters like tolerance, convergence criteria, and algorithms used to solve.

There are 2 main reasons why this is nice. It’s a separation of concerns, and it makes it easier to solve the same problem with a variety of different parameters (eg to test what works best).

3 Likes

Thanks for making this, I was thinking about doing the exact same thing to start to learn Julia . It will end up being very useful to me.

2 Likes

It’s my pleasure. I’ll be very interested to hear from you where and how you will be using it.