Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BoundsError #39

Closed
moeinkh88 opened this issue Jun 8, 2022 · 4 comments
Closed

BoundsError #39

moeinkh88 opened this issue Jun 8, 2022 · 4 comments

Comments

@moeinkh88
Copy link

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!

@ErikQQY
Copy link
Member

ErikQQY commented Jun 8, 2022

That is very weird, can you provide the program and the version of FractionalDiffEq.jl you are using?

@moeinkh88
Copy link
Author

If I want to install the package because of some compatibility issues the usable version is v0.2.0. So I have cloned the package to have the last version, v0.2.6.

Then, for example, I have tested the Brusselator.jl from the examples folder:

using FractionalDiffEq, Plots

α = [0.8, 0.8]
u0 = [0.2, 0.03]
h = 0.001

function Brusselator!(du, u, p, t)
    a, μ = 1, 4
    du[1] = a-(μ+1)*u[1]+(u[1])^2*u[2]
    du[2] = μ*u[1]-(u[1])^2*u[1]
end

prob = FODESystem(Brusselator!, α, u0, 100)
result = solve(prob, h, GL())

# Phase plane
plot(result[:, 1], result[:, 2])

# Time plane
plot(collect(0:h:100), result[:, 1])
plot!(collect(0:h:100), result[:, 2])

I got this error:

BoundsError
in eval at [base/boot.jl:360](https://github.com/SciFracX/FractionalDiffEq.jl/issues/39#) 
in top-level scope at [Brusselator.jl:14](https://github.com/SciFracX/FractionalDiffEq.jl/issues/39#)
in solve at [2.6/FractionalDiffEq.jl/src/fodesystem/GLWithMemory.jl:27](https://github.com/SciFracX/FractionalDiffEq.jl/issues/39#)
in getindex at [base/number.jl:96](https://github.com/SciFracX/FractionalDiffEq.jl/issues/39#)

BTW, when I run prob = FODESystem(Brusselator!, α, u0, 100) I get the following weird outcomes in REPL:

[0.8, 0.8]
timespan: 100
u0: [0.2, 0.03]
FODESystem with order [0.8, 0.8]
timespan: 100
u0: [0.2, 0.03]
FODESystem with order [0.8, 0.8]
timespan: 100
u0: [0.2, 0.03]

@ErikQQY
Copy link
Member

ErikQQY commented Jun 9, 2022

Sorry for the problems, there are a lot of refactoring recently, we should pass the time span as a Tuple to the problem definition: https://github.com/SciFracX/FractionalDiffEq.jl#system-of-fractional-differential-equations

prob = FODESystem(Brusselator!, α, u0, (0, 100))

the Brusselator example file has not been updated

@ErikQQY
Copy link
Member

ErikQQY commented Jun 1, 2024

All the FODE solvers have been refactored, everything is fine now, so I am closing this issue, if there are still some problems, please let me know

@ErikQQY ErikQQY closed this as completed Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants