Skip to content

Commit

Permalink
Update FDDEProblem
Browse files Browse the repository at this point in the history
Signed-off-by: ErikQQY <2283984853@qq.com>
  • Loading branch information
ErikQQY committed Jun 26, 2024
1 parent 973c3db commit 8576eb0
Showing 1 changed file with 79 additions and 3 deletions.
82 changes: 79 additions & 3 deletions src/types/problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,87 @@ end
struct StandardFDDEProblem end

"""
FDDEProblem(f, ϕ, α, τ, tspan)
Defines a fractional delay differential equation (FDDE) problem.
- `f`: The function describing fractional delay differential equations.
## Mathematical Specification of an FDDE problem
To define an FDDE problem, you simply need to given the function ``f``, the history function ``ϕ``, the fractional order ``α``, the delay ``τ`` and the initial condition ``u₀`` which define an FDDE:
```math
D^\\alpha_t y(t)=f(t,y(t),y(t-τ)),t ≥ 0
```
```math
y(t)=ϕ(t), t ≤ 0
```
There are two different ways of specifying `f`:
- `f(du,u,h,p,t)`: The function describing fractional delay differential equations.
- `f(u,h,p,t)`: returning `du`. Less memory-efficient way, particularly suitable when mutation is not allowed (e.g. with certain automatic differentiation packages such as Zygote).
- `ϕ`: History function
Construct a fractional delayed differential equation problem.
- `α`: The fractional order of the differential equations, commensurate and non-commensurate is both supported.
- `τ`: The time delay of the differential equations.
## Problem Type
### Constructors
`FODEProblem` can be constructed by first building an `ODEFunction` or
by simply passing the FODE right-hand side to the constructor. The constructors
are:
- `FDDEProblem(f::ODEFunction,order,u0,ϕ,tspan,p=NullParameters();kwargs...)`
- `FDDEProblem{isinplace,specialize}(f,order,u0,ϕ,tspan,p=NullParameters();kwargs...)` :
Defines the FODE with the specified functions. `isinplace` optionally sets whether
the function is inplace or not. This is determined automatically, but not inferred.
`specialize` optionally controls the specialization level. See the
[specialization levels section of the SciMLBase documentation](https://docs.sciml.ai/SciMLBase/stable/interfaces/Problems/#Specialization-Levels)
for more details. The default is `AutoSpecialize`.
For more details on the in-place and specialization controls, see the ODEFunction
documentation.
Parameters are optional, and if not given, then a `NullParameters()` singleton
will be used which will throw nice errors if you try to index non-existent
parameters. Any extra keyword arguments are passed on to the solvers. For example,
if you set a `callback` in the problem, then that `callback` will be added in
every solve call.
For specifying Jacobians and mass matrices, see the `ODEFunction` documentation.
### Fields
- `f`: The function in the FDDE.
- `ϕ`: The history function in the FDDE.
- `order`: The order of the FDDE.
- `τ`: The time delay of the FDDE.
- `tspan`: The timespan for the problem.
- `p`: The parameters.
- `kwargs`: The keyword arguments passed onto the solves.
## Example Problem
```julia
function ϕ(p, t)
if t == 0
return 19.00001
else
return 19.0
end
end
function f(y, ϕ, p, t)
return 3.5 * y * (1 - ϕ / 19)
end
τ = [0.8]
order = 0.97
u0 = 19.00001
tspan = (0.0, 2.0)
dt = 0.5
prob = FDDEProblem(f, order, u0, ϕ, constant_lags = τ, tspan)
sol = solve(prob, DelayPIEX(), dt = dt)
```
"""
struct FDDEProblem{uType, tType, oType, lType, isinplace, P, F, H, K, PT} <:
SciMLBase.AbstractDDEProblem{uType, tType, lType, isinplace}
Expand Down

1 comment on commit 8576eb0

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark Results

Benchmark suite Current: 8576eb0 Previous: 973c3db Ratio
FLMM/Trapezoid 20342051 ns 20946614 ns 0.97
FLMM/NewtonGregory 16888141 ns 16455634 ns 1.03
FLMM/BDF 16795517 ns 16555383 ns 1.01

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.