SciFracX / FractionalDiffEq.jl

Solve Fractional Differential Equations using high performance numerical methods
https://scifracx.github.io/FractionalDiffEq.jl/dev/
MIT License
81 stars 11 forks source link

Hi there!! to be clear #36

Closed beloved321 closed 2 years ago

beloved321 commented 2 years ago

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 https://github.com/SciFracX/FractionalDiffEq.jl/issues/35#issuecomment-1148029299

beloved321 commented 2 years ago

to be clear, it is a pkg, cos i have tried exactly that an i get an error

ErikQQY commented 2 years ago

Sorry, I can't get what you mean.

Can you describe your usage, and post your code and the error message here, that would be nice to explore the bugs😃

beloved321 commented 2 years ago

julia> using FractionalDiffEq, Plots (process:9076): GLib-GIO-WARNING *: 14:30:09 https://www.youtube.com/watch?v=ti16lYst-Bc&t=43200s.828: Unexpectedly, UWP app 6760NGPDFLab.PDFX_1.3.15.0_x64__sbe4t8mqwq93a' (AUMId6760NGPDFLab.PDFX_sbe4t8mqwq93a!App') supports 32 extensions but has no verbs julia> function chua!(du, x, p, t) a = 10.725; b = 10.593; c = 0.268; m0 = -1.1726; m1 = -0.7872; du[1] = a(x[2]-x[1]-(m1x[1]+0.5(m0-m1)(abs(x[1]+1)-abs(x[1]-1)))) du[2] = u[1]-u[2]+u[3] du[3] = -bu[2]-c*u[3] end chua! (generic function with 1 method) julia> α = [0.93, 0.99, 0.92]; julia> x0 = [0.2; -0.1; 0.1]; julia> h = 0.001 0.001 julia> prob = FODESystem(chua!, α, x0) FODESystem(chua!, [0.93, 0.99, 0.92], [0.2, -0.1, 0.1]) julia> tn = 200; julia> result = solve(prob, h, tn, NonLinearAlg()) ERROR: MethodError: no method matching chua!(::Float64, ::Vector{Float64}, ::Int64) Closest candidates are: chua!(::Any, ::Any, ::Any, ::Any) at REPL[2]:1 Stacktrace: [1] macro expansion @ C:\Users\BELOVED.julia\packages\FractionalDiffEq\uk4Ug\src\NonLinear\NonLinear.jl:38 [inlined] [2] macro expansion @ .\simdloop.jl:77 [inlined] [3] macro expansion @ C:\Users\BELOVED.julia\packages\FractionalDiffEq\uk4Ug\src\NonLinear\NonLinear.jl:37 [inlined] [4] macro expansion @ .\simdloop.jl:77 [inlined] [5] solve(prob::FODESystem, h::Float64, tn::Int64, ::NonLinearAlg, L0::Float64) @ FractionalDiffEq C:\Users\BELOVED.julia\packages\FractionalDiffEq\uk4Ug\src\NonLinear\NonLinear.jl:34 [6] solve(prob::FODESystem, h::Float64, tn::Int64, ::NonLinearAlg) @ FractionalDiffEq C:\Users\BELOVED.julia\packages\FractionalDiffEq\uk4Ug\src\NonLinear\NonLinear.jl:15 [7] top-level scope @ REPL[8]:1 I want to understand where I missed it

On Tue, Jun 7, 2022 at 3:45 PM Qingyu Qu @.***> wrote:

Sorry, I can't get what you mean.

Can you describe your usage, and post your code and the error message here, that would be nice to explore the bugs😃

— Reply to this email directly, view it on GitHub https://github.com/SciFracX/FractionalDiffEq.jl/issues/36#issuecomment-1148773688, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZQI4XUNOWYSB6KQDEFHNZ3VN5N65ANCNFSM5YC36QLQ . You are receiving this because you authored the thread.Message ID: @.***>

ErikQQY commented 2 years ago

May I ask for the version of FractionalDiffEq.jl?

You can get this by:

julia>]
pkg>st FractionalDiffEq
beloved321 commented 2 years ago

pkg> st FractionalDiffEq Status C:\Users\BELOVED\.julia\environments\v1.7\Project.toml [c7492dd8] FractionalDiffEq v0.2.0

ErikQQY commented 2 years ago

Oops, I think that is a very old version, please update FractionalDiffEq.jl to the latest version:

julia> using Pkg
julia> Pkg.update("FractionalDiffEq")

Then the Chua system example in README would be working: https://github.com/SciFracX/FractionalDiffEq.jl#system-of-fractional-differential-equations

beloved321 commented 2 years ago

julia> using FractionalDiffEq, Plots

(process:8496): GLib-GIO-WARNING **: 16:38:52.722: Unexpectedly, UWP app 6760NGPDFLab.PDFX_1.3.15.0_x64__sbe4t8mqwq93a' (AUMId 6760NGPDFLab.PDFX_sbe4t8mqwq93a!App') supports 32 extensions but has no verbs

julia> function chua!(du, x, p, t) a = 10.723; b = 10.593; c = 0.268 m0 = -1.1726 m1 = -0.7872 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]-cx[3] end chua! (generic function with 1 method)

julia> α = [0.93, 0.99, 0.92];

julia> x0 = [0.2; -0.1; 0.1];

julia> h = 0.01; tspan = (0, 100);

julia> prob = FODESystem(chua!, α, x0, tspan) ERROR: MethodError: no method matching FODESystem(::typeof(chua!), ::Vector{Float64}, ::Vector{Float64}, ::Tuple{Int64, Int64}) Closest candidates are: FODESystem(::Function, ::AbstractArray, ::AbstractArray) at C:\Users\BELOVED.julia\packages\FractionalDiffEq\uk4Ug\src\PECE.jl:112 FODESystem(::Any, ::Any, ::Any) at C:\Users\BELOVED.julia\packages\FractionalDiffEq\uk4Ug\src\PECE.jl:112 Stacktrace: [1] top-level scope @ REPL[9]:1

julia> prob = FODESystem(chua!, α, x0) FODESystem(chua!, [0.93, 0.99, 0.92], [0.2, -0.1, 0.1])

julia> result = solve(prob, h, tspan, NonLinearAlg()) ERROR: MethodError: no method matching /(::Tuple{Int64, Int64}, ::Float64) Closest candidates are: /(::Any, ::ChainRulesCore.AbstractThunk) at C:\Users\BELOVED.julia\packages\ChainRulesCore\GUvJT\src\tangent_types\thunks.jl:33 /(::StridedArray{P}, ::Real) where P<:Dates.Period at C:\Users\BELOVED\AppData\Local\Programs\Julia-1.7.3\share\julia\stdlib\v1.7\Dates\src\deprecated.jl:44 /(::Union{SparseArrays.SparseVector{Tv, Ti}, SubArray{Tv, 1, <:SparseArrays.AbstractSparseVector{Tv, Ti}, Tuple{Base.Slice{Base.OneTo{Int64}}}, false}, SubArray{Tv, 1, <:SparseArrays.AbstractSparseMatrixCSC{Tv, Ti}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, false}} where {Tv, Ti}, ::Number) at C:\Users\BELOVED\AppData\Local\Programs\Julia-1.7.3\share\julia\stdlib\v1.7\SparseArrays\src\sparsevector.jl:1476 ... Stacktrace: [1] solve(prob::FODESystem, h::Float64, tn::Tuple{Int64, Int64}, ::NonLinearAlg, L0::Float64) @ FractionalDiffEq C:\Users\BELOVED.julia\packages\FractionalDiffEq\uk4Ug\src\NonLinear\NonLinear.jl:17 [2] solve(prob::FODESystem, h::Float64, tn::Tuple{Int64, Int64}, ::NonLinearAlg) @ FractionalDiffEq C:\Users\BELOVED.julia\packages\FractionalDiffEq\uk4Ug\src\NonLinear\NonLinear.jl:15 [3] top-level scope @ REPL[11]:1

I guess I am still missing something even after the update. I am very grateful for your responses. I will be grateful if you still take a look at it

On Tue, Jun 7, 2022 at 4:03 PM Qingyu Qu @.***> wrote:

Oops, I think that is a very old version, please update FractionalDiffEq.jl to the latest version:

julia> using Pkg julia> Pkg.update("FractionalDiffEq")

Then the Chua system example in README would be working: https://github.com/SciFracX/FractionalDiffEq.jl#system-of-fractional-differential-equations

— Reply to this email directly, view it on GitHub https://github.com/SciFracX/FractionalDiffEq.jl/issues/36#issuecomment-1148795881, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZQI4XT65NGYMSYIRZR6C6DVN5QCZANCNFSM5YC36QLQ . You are receiving this because you authored the thread.Message ID: @.***>

ErikQQY commented 2 years ago

Very sorry for the inconvenience, I think the latest version 0.2.6 should work, there are a lot of changes compared to the old versions.

beloved321 commented 2 years ago

Julia or FractionalDiffEq

On Tue, Jun 7, 2022, 5:16 PM Qingyu Qu @.***> wrote:

Very sorry for the inconvenience, I think the latest version 0.2.6 should work, there are a lot of changes compared to the old versions.

— Reply to this email directly, view it on GitHub https://github.com/SciFracX/FractionalDiffEq.jl/issues/36#issuecomment-1148882567, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZQI4XWQMB2MVZDL45SB3GTVN5YV5ANCNFSM5YC36QLQ . You are receiving this because you authored the thread.Message ID: @.***>

ErikQQY commented 2 years ago

I think you are using FractionalDiffEq.jl 0.2.5, that is a very old version( I have not released for a long time, my apologies🥲), I think updating to 0.2.6 would solve all of the problems.😃

beloved321 commented 2 years ago

How do i do so julia> using Pkg julia> Pkg.update("FractionalDiffEq")???

ErikQQY commented 2 years ago

Yes, update FractionalDiffEq.jl to version 0.2.6, there should be no problems.😄

beloved321 commented 2 years ago

Yea, Thanks a lot. so this is what I did, I download the v1.8.0 of julia and it worked perfectly. Now I will try to build a fractional order lorenz system. I want to do so in the caputo sense, I believe there is provision for it. I am so grateful for your responses all the while.

ErikQQY commented 2 years ago

It is great to see that FractionalDiffEq.jl is helping! So I will close this issue for now. If you have any other questions about this package, don't hesitate to ping me.😄