Coder Social home page Coder Social logo

scifracx / fractionaldiffeq.jl Goto Github PK

View Code? Open in Web Editor NEW
72.0 2.0 11.0 11.51 MB

Solve Fractional Differential Equations using high performance numerical methods

Home Page: https://scifracx.github.io/FractionalDiffEq.jl/dev/

License: MIT License

Julia 100.00%
fractional-differential-equations julia numerical caputo riemann-liouville fractional-calculus fractional-differencing matrix-discrete fde ode

fractionaldiffeq.jl's People

Contributors

erikqqy avatar github-actions[bot] avatar jclugstor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fractionaldiffeq.jl's Issues

Cannot `convert` an object of type

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

Support for FODEFunction

Like the ODEFunction in DifferentialEquations.jl, we can provide FODEFunction to pass the jacobian and reduce the jacobian generating cost by ForwardDiff.jl

FODESystem not defined. FractionalDiffEq v0.3.5

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] = -b
x[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.

suggestions for mutliterm problems

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.

FDDESystem with multiple lags

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)

image

Remove unused dependences

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.

Example on system of fractional difference equations returned fractionalDiscreteSystem not defined

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.05
u[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

Package not running

I have been using this package for a couple of months. And for the last few weeks I keep getting this error:

image

These are the only packages in my installation:
image

I tried adding LinearAlgebra to my installation but that did not change the error.

Thank you for your help,
Mariana

bagelytorvik.jl

Hi,
Kindly remark that the forth argument is missed in bagleytorvik example
result = bagleytorvik(1, 1, 1, rightside, T, h)

Hi there!! to be clear

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)

FODESystem not defiend

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

Lyapunov example won't run, incremental compile problem during package installation?

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

BoundsError in FOChaos.jl

Trying t run the series of examples of Chaos,

result = solve(prob, h, GL()) generates BoundsError in every example.

TagBot trigger issue

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!

BoundsError

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!

NonLinearAlg in julia

julia> result = solve(prob, h, tf, NonLinearAlg(1))
ERROR: MethodError: no method matching NonLinearAlg(::Int64)
can some one put me through this

Feat: Neural Fractional Diffeq

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

Error using PECE with system with parameters

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.

Solution objects for FODESystem, etc. ?

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?

Solvers overhaul

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.

example folder issues

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;

UndefVarError: FODESystem not defined

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.