Hi everyone,
I’m very new to Julia and trying to wrap my head around the following error. This is a stripped-down version of the ODE I am trying to wrap as a Continuous Dynamical System.
using DifferentialEquations
using ChaosTools
@inline @inbounds function ODE(dy, y, p, t)
alpha = p
gamma = alpha * t
dy[1] = -1im * (-y[2] +gamma*y[1] )
dy[2] = -1im * (-(y[1]+y[3]) )
dy[3] = -1im * (-y[2] - gamma*y[3] )
return SVector{3}(dy[1],dy[2],dy[3])
end
p = [0]
y0=[ -0.9950737714883371,
-0.09901475429766803,
-0.004926228511662883]
ds=ContinuousDynamicalSystem(ODE,y0,p)
However, this produces the following error message
LoadError: MethodError: no method matching +(::ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#13#20"{Array{Float64,1},Float64,typeof(ODE)},Float64},Float64,3}, ::Array{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#13#20"{Array{Float64,1},Float64,typeof(ODE)},Float64},Float64,3},1})
For element-wise addition, use broadcasting with dot syntax: scalar .+ array
Closest candidates are:
+(::Any, ::Any, !Matched::Any, !Matched::Any...) at operators.jl:538
+(!Matched::ChainRulesCore.DoesNotExist, ::Any) at /Users/garymccormack/.julia/packages/ChainRulesCore/cpHLu/src/differential_arithmetic.jl:23
+(!Matched::ChainRulesCore.One, ::Any) at /Users/garymccormack/.julia/packages/ChainRulesCore/cpHLu/src/differential_arithmetic.jl:94
...
in expression starting at /Users/garymccormack/OneDrive - The University of Nottingham/ExtendedBoseHubbard/TripleWell/longrange/LyapunovExp/Lyap_RydDress.jl:45
ODE at Lyap_RydDress.jl:19 [inlined]
(::DynamicalSystemsBase.var"#13#20"{Array{Float64,1},Float64,typeof(ODE)})(::StaticArrays.SArray{Tuple{3},ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#13#20"{Array{Float64,1},Float64,typeof(ODE)},Float64},Float64,3},1,3}) at dynamicalsystem.jl:313
static_dual_eval at apiutils.jl:32 [inlined]
vector_mode_jacobian at jacobian.jl:178 [inlined]
jacobian at jacobian.jl:85 [inlined]
(::DynamicalSystemsBase.var"#12#19"{typeof(ODE)})(::StaticArrays.SArray{Tuple{3},Float64,1,3}, ::Array{Float64,1}, ::Float64) at dynamicalsystem.jl:312
get_J(::DynamicalSystemsBase.var"#12#19"{typeof(ODE)}, ::StaticArrays.SArray{Tuple{3},Float64,1,3}, ::Array{Float64,1}, ::Float64, ::Bool) at dynamicalsystem.jl:324
ContinuousDynamicalSystem(::Function, ::Array{Float64,1}, ::Array{Float64,1}; t0::Float64) at dynamicalsystem.jl:243
ContinuousDynamicalSystem(::Function, ::Array{Float64,1}, ::Array{Float64,1}) at dynamicalsystem.jl:231
top-level scope at Lyap_RydDress.jl:45
include_string(::Function, ::Module, ::String, ::String) at loading.jl:1088
I’m still learning how to read error messages from Julia and I’m struggling big time with this!
I think it may have something to do with the ODE being a complex ODE, but I’m not sure…
Would anyone be able to help me out?
Thanks in advance