scifracx / fractionaldiffeq.jl Goto Github PK
View Code? Open in Web Editor NEWSolve Fractional Differential Equations using high performance numerical methods
Home Page: https://scifracx.github.io/FractionalDiffEq.jl/dev/
License: MIT License
Solve Fractional Differential Equations using high performance numerical methods
Home Page: https://scifracx.github.io/FractionalDiffEq.jl/dev/
License: MIT License
Since last Friday, it has shown, Cannot convert
an object of type and has not worked it. Could you help me how to fix it?
MethodError: Cannot convert
an object of type
Tuple{Int64, Int64} to an object of type
AbstractArray
Closest candidates are:
convert(::Type{T}, ::LinearAlgebra.Factorization) where T<:AbstractArray at C:\Users\skim\AppData\Local\Programs\Julia-1.8.2\share\julia\stdlib\v1.8\LinearAlgebra\src\factorization.jl:58
convert(::Type{T}, ::Intervals.IntervalSet) where T<:AbstractArray at C:\Users\skim.julia\packages\Intervals\wE73a\src\interval_sets.jl:64
convert(::Type{T}, ::Intervals.AnchoredInterval{P, T}) where {P, T} at C:\Users\skim.julia\packages\Intervals\wE73a\src\anchoredinterval.jl:181
...
Stacktrace:
[1] convert(#unused#::Type{Union{Nothing, AbstractArray}}, x::Tuple{Int64, Int64})
@ Base .\some.jl:36
[2] MultiTermsFODEProblem(parameters::Vector{Float64}, orders::Vector{Float64}, rightfun::Function, rparameters::Vector{Int64}, rorders::Tuple{Int64, Int64})
@ FractionalDiffEq C:\Users\skim.julia\packages\FractionalDiffEq\uk4Ug\src\PECE.jl:19
[3] top-level scope
@ In[4]:4
[4] eval
@ .\boot.jl:368 [inlined]
[5] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base .\loading.jl:1428
Like the ODEFunction
in DifferentialEquations.jl, we can provide FODEFunction
to pass the jacobian and reduce the jacobian generating cost by ForwardDiff.jl
When you try running the following example:
using FractionalDiffEq, Plots
function chua!(du, x, p, t)
a, b, c, m0, m1 = p
du[1] = a*(x[2]-x[1]-(m1x[1]+0.5(m0-m1)(abs(x[1]+1)-abs(x[1]-1))))
du[2] = x[1]-x[2]+x[3]
du[3] = -bx[2]-c*x[3]
end
α = [0.93, 0.99, 0.92];
x0 = [0.2; -0.1; 0.1];
tspan = (0, 100);
p = [10.725, 10.593, 0.268, -1.1726, -0.7872]
prob = FODESystem(chua!, α, x0, tspan, p)
sol = solve(prob, NonLinearAlg(), dt=0.01)
plot(sol, vars=(1, 2), title="Chua System", legend=:bottomright)
You get the following error:
ERROR: UndefVarError: FODESystem
not defined
This did not happen in version 0.3.1. Is there a different syntax for version 0.3.5? Can you help me?
Thank you very much.
While the FODEMatrixDiscrete
method has changed due to the method redesign, we need to update the example in README.
Three-parametric Mittag Leffler function: https://arxiv.org/abs/1503.06569
Matrix arguments Mittag Leffler function: https://link.springer.com/article/10.1007%2Fs10915-018-0699-5
Hi,
For multiterm examples, like bagleytorvik, I have found that we need to use arguments as parameters of the problem.
But, isn't it better to have a solver function for a class of problems with muliterm of derivatives and let the user define the problem function manually? Like fractional ODE problems that you made, the user can define the problem and then use the function as an argument (like chua.jl). This way is more user-friendly and more flexible than having a specific problem inside the solver and giving control of the parameters to the user.
https://www.sciencedirect.com/science/article/abs/pii/S009630031830506X
Can you provide in the set of examples, an example of ODE system with Caputo derivatives and Mittag-Leffler function. I could not find in the docs a clear documentation of a Caputo derivative. Something like a Chua circuit with ML function or some other two or three DiffEq system with ML functions.
Right now, the commensurate Lyapunov exponents computing routine doesn't support passing parameters, we need to set that up!
FractionalDiffEq.jl/src/lyapunov.jl
Lines 142 to 150 in f21d3e2
The delayChen is running fine whereas the delaySolow gives the following error:
#using FractionalDiffEq, Plots
#α=[0.94, 0.94, 0.94]; ϕ=[0.2, 0, 0.5]; τ=0.009; T=1.4; h=0.001
#function delaychen!(dy, y, ϕ, t)
# a=35; b=3; c=27
# dy[1] = a*(y[2]-ϕ[1])
# dy[2] = (c-a)*ϕ[1]-y[1]*y[3]+c*y[2]
# dy[3] = y[1]*y[2]-b*ϕ[3]
#end
#prob = FDDESystem(delaychen!, ϕ, α, τ, T)
#sol=solve(prob, h, DelayABM())
# Solow model with time delay FDDESystem
using FractionalDiffEq, Plots
q = [0.7, 0.7, 0.7] # order
ϕ = [4.0152, 0.1383, 1.7788] # initial value of delayed variable
τ = [0., 2.0, 0.] # delays
tspan = (0., 150) # final time
h = 0.01 # step length
function delaysolow!(dy, y, ϕ, t)
α = 0.6; p = 0.06; w = 0.
dy[1] = 0.05*(1.0 - ϕ[1]/8.)*ϕ[1]
dy[2] = 0.4*y[3]*y[2]^(α)*y[1]^(1-α) - 0.2*ϕ[2]
dy[3] = p*ϕ[3] + w*ϕ[1] + h*ϕ[2]
end
prob = FDDESystem(delaysolow!, ϕ, q, τ, tspan)
Caputo Euler method for single term fractional differential equations
https://github.com/mattja/fodeint
Relating papers:
https://www.sciencedirect.com/science/article/pii/S037847542100361X
https://link.springer.com/content/pdf/10.1023/B:NUMA.0000027736.85078.be.pdf
Since we are in the early stage, the main goal is to make it correct, so we should get rid of the unused dependencies for now.
I would like to solve the following problem where the righfunc is given by 8 if x<= 0 and 0 otherwise. However, with FODEMatrixDiscrete() algorithm does not work
h=0.075
f(x) = (x <= 1) ? 8 : 0;
prob = MultiTermsFODEProblem([1, 1 , 1], [2, 3/2 , 0], f , [0, 0], (0, 30))
sol = solve(prob, h, FODEMatrixDiscrete())
This example from http://www.mathworks.com/matlabcentral/fileexchange/22071 where the same algorithm is used by Matlab.
Currently, the images in our docs is published from github static files, we want to use Documenter.jl instead to generate images in the docs builing period to get higher quality docs images.
See https://github.com/JuliaControl/ControlSystems.jl/blob/master/docs/make.jl
After the discretization, the linear fractional differential equation is transformed to a linear problem:
The current solver is the default solver in Julia, we can use the SciML LinearSolve.jl:
https://github.com/SciML/LinearSolve.jl
See the Julia session below:
julia> using FractionalDiffEq, Plots
julia> function sys!(du, u, p, t)
du[1] = -0.05u[2] - 0.05u[3] + 0.01tanh(u[2])
du[2] = 0.05u[1] + 0.02u[2] + 0.01tanh(u[1])
du[3] = 0.1 - 0.2u[3] + 0.05u[1]u[3] + 0.01tanh(u[3])
end
sys! (generic function with 1 method)
julia> prob = FractionalDsicreteSystem(sys!, 0.98, [1, -1, 0])
ERROR: UndefVarError: FractionalDsicreteSystem
not defined
Stacktrace:
[1] top-level scope
@ REPL[3]:1
julia> result = solve(prob, 7, GL())
ERROR: UndefVarError: prob
not defined
Stacktrace:
[1] top-level scope
Hi and thanks for this package!
Looks really useful.
Will this eventually work w/ @ChrisRackauckas's DifferentialEquations.jl?
Hi,
Kindly remark that the forth argument is missed in bagleytorvik example
result = bagleytorvik(1, 1, 1, rightside, T, h)
Hi there!!
I think the right usage should be:
solve(prob, h, NonLinearAlg())
For the system of fractional ordinary differential equations, there are many solvers available, for example, Grunwald Letnikov difference method GL
, fractional linear multiple-step method FLMMBDF
, FLMMTrap
and FLMMNewtonGregory
. Also, there are solvers for Caputo-Fabrizio fractional operators such as NewtonPolynomial
.
Originally posted by @ErikQQY in #35 (comment)
When I running to the following code, I got an error "UndefVarError: FODESystem not defined"
import Pkg
Pkg.add("FractionalDiffEq")
using FractionalDiffEq, Plots
α = [0.9; 0.9; 0.9];
alpha = [0.9, 0.8, 1]
u0 = [1-0.001; 0.001; 0];
tspan = (0, 100);
h = 0.01;
function SIR!(du, u, p, t)
β, γ = 0.4, 0.04
du[1] = -βu[1]u[2]
du[2] = βu[1]u[2]-γu[2]
du[3] = γu[2]
end
prob = FODESystem(SIR!, alpha, u0, tspan)
sol1 = solve(prob, h, FLMMBDF())
sol2 = solve(prob, h, FLMMNewtonGregory())
sol3 = solve(prob, h, FLMMTrap())
sol4 = solve(prob, h, PECE())
sol5 = solve(prob, h, PIEX())
sol6 = solve(prob, h, NonLinearAlg())
sol7 = solve(prob, h, GL())
Updating registry at C:\Users\gvmur\.julia\registries\General.toml
Resolving package versions...
No Changes to C:\Users\gvmur\.julia\environments\v1.8\Project.toml
No Changes to C:\Users\gvmur\.julia\environments\v1.8\Manifest.toml
UndefVarError: FODESystem not defined
Stacktrace:
[1] top-level scope
@ In[2]:16
Hi. First, thanks for developing FractionalDiffEq. It is awesome. I'm trying to use it for a research project.
Issue: When I try to run the Lyapunov exponent example https://scifracx.org/FractionalDiffEq.jl/dev/flyapunovexp/ , I get an error: "MethodError: no method matching" for FOLyapunov()
Initially, I was running it in JuliaHub with Julia 1.8.5, then I tried it locally on my mac with Julia 1.9.1.
Maybe related:
I noticed when I installed the FractionalDiffEq package locally, that it gave warnings about FOLyapunov() and a number of other functions: "** incremental compilation may be fatally broken for this module **"
Did some google searches and found that this has popped up variously for others:
https://discourse.julialang.org/t/random-warning-messages-with-catalyst/66289/3
https://stackoverflow.com/questions/70437015/cant-add-differentialequation-jl-to-julia-1-7-0
Maybe the new manifest features from 1.7 are causing probems. Would an older version of Julia solve this? Like 1.6 or something?
Wondering if you've seen this and what you might suggest.
Gratefully,
Tom
Trying t run the series of examples of Chaos,
result = solve(prob, h, GL())
generates BoundsError in every example.
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
Hi
When I want to solve a problem in example chua or Brusselator:
result = solve(prob, h, NonLinearAlg())
result = solve(prob, h, GL())
there is a BoundsError. It happens because
tspan
in lines 15-16 in Nonlinear.jl and lines 19-20 in GL.jl is only a number (100) rather than a time span.
@unpack f, α, u0, tspan = prob
t0 = tspan[1]; T = tspan[2]
I couldn't track the bug why it is not a time span!
julia> result = solve(prob, h, tf, NonLinearAlg(1))
ERROR: MethodError: no method matching NonLinearAlg(::Int64)
can some one put me through this
Since Fox Wright function has an important role in fractional differential equations, we need to build in Fox Wright function. See Prof Luchko's paper: https://www.researchgate.net/publication/236221356_The_Wright_function_and_its_numerical_evaluation
Hi @ErikQQY, quick question. I am interested in exploring the possibility of using your package together with DiffEqFlux. In particular, I would like to setup neural differential equation problem using fractional calculus on the stochastic differential equation definition in order to model non-Gaussian stats of the process.
Is this already implemented somewhere? If not, I would be willing to consider implementing it, with some guidance from your side.
Thanks,
Matteo
Right now, the Wolf's Lyapunov exponents algorithms can only be used for the computing of commensurate fractional order systems, we need to add the non-commensurate case:
When trying to solve an FODE system with parameters an error occurs
`using FractionalDiffEq, Plots
plotlyjs()
function ChenSystem(du,u,p,t)
α, b, γ = p
x = u[1]
y = u[2]
z = u[3]
dx = α*(y - x)
dy = (γ - α)*x - x*z + γ*y
dz = x*y - b*z
du[1] = dx
du[2] = dy
du[3] = dz
end
prob = FODESystem(ChenSystem,qrow,y0,tspan,pars)
Ys = solve(prob, stepsize, PECE())
`
I think this is because PIPECE wasn't changed to allow for systems with separate parameters. Also noticed that PIPECE wasn't returning an FODESolution. I have a fix and will submit a pull request.
This could be cool to implement, https://ieeexplore.ieee.org/document/9666533, https://www.mdpi.com/2504-3110/6/10/550
I noticed that when solving FODESystem it doesn't return a FDESolution object, but when solving a single term project it does use a solution object.
Is there a particular reason for this, and what would be needed to have every type of FDE problem return an object solution?
For now, all of the solvers are just working. To solve an FDE? OK! But the maintenance threshold is high.
We use this issue to track the overhaul of all solvers, the aim of the overhaul is simple: Making the solvers simple, easy-to-read, and efficient.
I'm facing following list of issues in example folder
1; chua_short_memory.jl tn not define
2:Bagleytorvik.jl Bagleytorvik. not define
3;Brusselator.jl not evaluating
4 classical.jl FODESystem no method matching
5; complicated_example.jl PIIMRect not define
6; delay_Pi_example.jl DelayPI not define
7;delaychen.jl invalid redefinition of constant psi
8diffusion.jl FPDEMatrixDiscrete not define
9;example.jl ERROR: MethodError: no method matching fun(::Float64, ::Nothing,::Float64)
10;fdde_matrix.jl ERROR: invalid redefinition of constant f
11;
Hi, I am trying to run some examples based on the instruction in your documents. But, the solvers are not defined! For example, FODESystem and SingleTermFODEProblem can't be recognized from the package.
I would like to benchmark (speed and accuracy) some of your solvers that are compatible with our package: FdeSolver.jl.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.