JuliaDynamics / DynamicalSystems.jl

Award winning software library for nonlinear dynamics and nonlinear timeseries analysis

Home Page:https://juliadynamics.github.io/DynamicalSystemsDocs.jl/dynamicalsystems/dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Function erred "dt<dtmin" with default solver. And adjustment failed.maybe other solvers?

HaoLi111 opened this issue · comments

commented

Issue description OR description of requested feature

Function erred "dt<dtmin" with default solver. And adjustment failed

Expected behavior OR description of possible implementation

Expected a trajectory matrix or dataframe output

MWE (only for issue reports)

julia> function fxy!(du,u,p,t)
           x,y  = u
           du[1]=x^4 -y^3
           du[2]=x^2*y^3
           return nothing
       end
fxy! (generic function with 1 method)

julia> fxy_sys=ContinuousDynamicalSystem(fxy!,[1.0,1.0],nothing)
2-dimensional continuous dynamical system
 state:       [1.0, 1.0]
 e.o.m.:      fxy!
 in-place?    true
 jacobian:    ForwardDiff
 parameters:  nothing

julia> tr = trajectory(fxy_sys,4.0,Δt = .5,dtmin = .1)
ERROR: dt<dtmin
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] step!(::SimpleDiffEq.SimpleATsit5Integrator{true,Array{Float64,1},Float64,Nothing,DiffEqBase.ODEFunction{true,typeof(fxy!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},typeof(DiffEqBase.ODE_DEFAULT_NORM)}) at C:\Users\Dell2\.julia\packages\SimpleDiffEq\7kwxE\src\tsit5\atsit5.jl:164
 [3] #trajectory#53(::Float64, ::Float64, ::Base.Iterators.Pairs{Symbol,Float64,Tuple{Symbol,Symbol},NamedTuple{(:Δt, :dtmin),Tuple{Float64,Float64}}}, ::typeof(trajectory), ::ContinuousDynamicalSystem{true,Array{Float64,1},2,typeof(fxy!),Nothing,DynamicalSystemsBase.var"#8#15"{typeof(fxy!),Array{Float64,1},ForwardDiff.JacobianConfig{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2,Tuple{Array{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2},1},Array{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2},1}}}},Array{Float64,2},true}, ::Float64, ::Array{Float64,1}) at C:\Users\Dell2\.julia\packages\DynamicalSystemsBase\BT13p\src\continuous.jl:155
 [4] (::DynamicalSystemsBase.var"#kw##trajectory")(::NamedTuple{(:Δt, :dtmin),Tuple{Float64,Float64}}, ::typeof(trajectory), ::ContinuousDynamicalSystem{true,Array{Float64,1},2,typeof(fxy!),Nothing,DynamicalSystemsBase.var"#8#15"{typeof(fxy!),Array{Float64,1},ForwardDiff.JacobianConfig{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2,Tuple{Array{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2},1},Array{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2},1}}}},Array{Float64,2},true}, ::Float64) at .\none:0
 [5] top-level scope at REPL[320]:1

julia> tr = trajectory(fxy_sys,4.0,Δt = 3.0)
ERROR: dt<dtmin
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] step!(::SimpleDiffEq.SimpleATsit5Integrator{true,Array{Float64,1},Float64,Nothing,DiffEqBase.ODEFunction{true,typeof(fxy!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},typeof(DiffEqBase.ODE_DEFAULT_NORM)}) at C:\Users\Dell2\.julia\packages\SimpleDiffEq\7kwxE\src\tsit5\atsit5.jl:164
 [3] #trajectory#53(::Float64, ::Float64, ::Base.Iterators.Pairs{Symbol,Float64,Tuple{Symbol},NamedTuple{(:Δt,),Tuple{Float64}}}, ::typeof(trajectory), ::ContinuousDynamicalSystem{true,Array{Float64,1},2,typeof(fxy!),Nothing,DynamicalSystemsBase.var"#8#15"{typeof(fxy!),Array{Float64,1},ForwardDiff.JacobianConfig{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2,Tuple{Array{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2},1},Array{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2},1}}}},Array{Float64,2},true}, ::Float64, ::Array{Float64,1}) at C:\Users\Dell2\.julia\packages\DynamicalSystemsBase\BT13p\src\continuous.jl:155
 [4] (::DynamicalSystemsBase.var"#kw##trajectory")(::NamedTuple{(:Δt,),Tuple{Float64}}, ::typeof(trajectory), ::ContinuousDynamicalSystem{true,Array{Float64,1},2,typeof(fxy!),Nothing,DynamicalSystemsBase.var"#8#15"{typeof(fxy!),Array{Float64,1},ForwardDiff.JacobianConfig{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2,Tuple{Array{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2},1},Array{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2},1}}}},Array{Float64,2},true}, ::Float64) at .\none:0
 [5] top-level scope at REPL[321]:1


julia> tr = trajectory(fxy_sys,10.0)
ERROR: dt<dtmin
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] step!(::SimpleDiffEq.SimpleATsit5Integrator{true,Array{Float64,1},Float64,Nothing,DiffEqBase.ODEFunction{true,typeof(fxy!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},typeof(DiffEqBase.ODE_DEFAULT_NORM)}) at C:\Users\Dell2\.julia\packages\SimpleDiffEq\7kwxE\src\tsit5\atsit5.jl:164
 [3] #trajectory#53(::Float64, ::Float64, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(trajectory), ::ContinuousDynamicalSystem{true,Array{Float64,1},2,typeof(fxy!),Nothing,DynamicalSystemsBase.var"#8#15"{typeof(fxy!),Array{Float64,1},ForwardDiff.JacobianConfig{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2,Tuple{Array{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2},1},Array{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#7#14"{typeof(fxy!),Nothing,Float64},Float64},Float64,2},1}}}},Array{Float64,2},true}, ::Float64, ::Array{Float64,1}) at C:\Users\Dell2\.julia\packages\DynamicalSystemsBase\BT13p\src\continuous.jl:155
 [4] trajectory at C:\Users\Dell2\.julia\packages\DynamicalSystemsBase\BT13p\src\continuous.jl:148 [inlined] (repeats 2 times)
 [5] top-level scope at REPL[337]:1

The function failed to pick a feasible default solver for this 2 var ODE.

julia> versioninfo()
Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = "C:\Users\Dell2\AppData\Local\Programs\Microsoft VS Code\Code.exe"
  JULIA_NUM_THREADS =

Hi,

tr = trajectory(fxy_sys,4.0,Δt = .5,dtmin = .1)

What does Δt do? It is not an argument from DynamicalSystems.jl, so it has to be one from DifferentialEquations.jl.

tr = trajectory(fxy_sys,4.0,Δt = .5,dtmin = .1)

The default dt for the function trajectory is 0.01, and here you give dtmin=0.1 > 0.01, isn't it obvious that you would get an error "dt<dtmin" ...?

The function failed to pick a feasible default solver for this 2 var ODE.

DynamicalSystems.jl does not have DifferentialEquations.jl as a dependency. We never pick a different default solver according to your problem. You have to do it yourself via e.g.

using OrdinaryDiffEq
tr = trajectory(fxy_sys,10.0; alg = Vern9())

where Vern9 comes from OrdinaryDiffEq.

Can you try again with Vern9?