Method `recursivecopy!(::Matrix{Float64}, ::Vector{SVector{2, Float64}})` does not exist
oameye opened this issue · comments
Orjan Ameye commented
Describe the bug
When computing the local_growth_rates
of the continuous Mathieu differential equation, I get the error that no method exists for recursivecopy!(::Matrix{Float64}, ::Vector{SVector{2, Float64}})
.
ERROR: MethodError: no method matching recursivecopy!(::Matrix{Float64}, ::Vector{SVector{2, Float64}})
Closest candidates are:
recursivecopy!(::AbstractArray{T, N}, ::AbstractArray{T2, N}) where {T<:StaticArraysCore.StaticArray, T2<:StaticArraysCore.StaticArray, N} at C:\Users\orjan\.julia\packages\RecursiveArrayTools\qUkp8\src\utils.jl:37
recursivecopy!(::AbstractArray{T, N}, ::AbstractArray{T2, N}) where {T<:Number, T2<:Number, N} at C:\Users\orjan\.julia\packages\RecursiveArrayTools\qUkp8\src\utils.jl:48
recursivecopy!(::AbstractArray{T, N}, ::AbstractArray{T2, N}) where {T<:AbstractArray, T2<:AbstractArray, N} at C:\Users\orjan\.julia\packages\RecursiveArrayTools\qUkp8\src\utils.jl:52
Stacktrace:
[1] reinit!(integrator::SimpleDiffEq.SimpleATsit5Integrator{true, Matrix{Float64}, Float64, Dict{Symbol, Float64}, SciMLBase.ODEFunction{true, SciMLBase.AutoSpecialize, DynamicalSystemsBase.var"#53#54"{ContinuousDynamicalSystem{true, Vector{Float64}, 2, typeof(mathieu!), Dict{Symbol, Float64}, DynamicalSystemsBase.var"#6#12"{ForwardDiff.JacobianConfig{ForwardDiff.Tag{DynamicalSystemsBase.var"#5#11"{typeof(mathieu!), Dict{Symbol, Float64}, Float64}, Float64}, Float64, 2, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#5#11"{typeof(mathieu!), Dict{Symbol, Float64}, Float64}, Float64}, Float64, 2}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#5#11"{typeof(mathieu!), Dict{Symbol, Float64}, Float64}, Float64}, Float64, 2}}}}, DynamicalSystemsBase.var"#5#11"{typeof(mathieu!), Dict{Symbol, Float64}, Float64}, Vector{Float64}}, Matrix{Float64}, true}, Int64}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, typeof(DynamicalSystemsBase._tannorm)}, u0::Vector{SVector{2, Float64}}; t0::Float64, dt::Float64)
@ SimpleDiffEq C:\Users\orjan\.julia\packages\SimpleDiffEq\72VGn\src\tsit5\atsit5.jl:665
[2] reinit!
@ C:\Users\orjan\.julia\packages\SimpleDiffEq\72VGn\src\tsit5\atsit5.jl:660 [inlined]
[3] local_growth_rates(ds::ContinuousDynamicalSystem{true, Vector{Float64}, 2, typeof(mathieu!), Dict{Symbol, Float64}, DynamicalSystemsBase.var"#6#12"{ForwardDiff.JacobianConfig{ForwardDiff.Tag{DynamicalSystemsBase.var"#5#11"{typeof(mathieu!), Dict{Symbol, Float64}, Float64}, Float64}, Float64, 2, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#5#11"{typeof(mathieu!), Dict{Symbol, Float64}, Float64}, Float64}, Float64, 2}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#5#11"{typeof(mathieu!), Dict{Symbol, Float64}, Float64}, Float64}, Float64, 2}}}}, DynamicalSystemsBase.var"#5#11"{typeof(mathieu!), Dict{Symbol, Float64}, Float64}, Vector{Float64}}, Matrix{Float64}, true}, points::Dataset{2, Float64}; S::Int64, Δt::Int64, e::Float64, perturbation::ChaosTools.var"#224#226"{Float64}, diffeq::NamedTuple{(), Tuple{}}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ChaosTools C:\Users\orjan\.julia\packages\ChaosTools\PHPDF\src\chaosdetection\lyapunovs.jl:487
[4] local_growth_rates(ds::ContinuousDynamicalSystem{true, Vector{Float64}, 2, typeof(mathieu!), Dict{Symbol, Float64}, DynamicalSystemsBase.var"#6#12"{ForwardDiff.JacobianConfig{ForwardDiff.Tag{DynamicalSystemsBase.var"#5#11"{typeof(mathieu!), Dict{Symbol, Float64}, Float64}, Float64}, Float64, 2, Tuple{Vector{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#5#11"{typeof(mathieu!), Dict{Symbol, Float64}, Float64}, Float64}, Float64, 2}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{DynamicalSystemsBase.var"#5#11"{typeof(mathieu!), Dict{Symbol, Float64}, Float64}, Float64}, Float64, 2}}}}, DynamicalSystemsBase.var"#5#11"{typeof(mathieu!), Dict{Symbol, Float64}, Float64}, Vector{Float64}}, Matrix{Float64}, true}, points::Dataset{2, Float64})
@ ChaosTools C:\Users\orjan\.julia\packages\ChaosTools\PHPDF\src\chaosdetection\lyapunovs.jl:465
Minimal Working Example
using DynamicalSystems
function mathieu!(dx,x,p,t)
dx[1] = x[2]
dx[2] = -p[:ω₀]^2*(1-p[:λ]*cos(2*p[:ω]*t))*x[1] - p[:γ]*x[2]
end
fixed = Dict(:ω₀ => 1.0, :γ => 0.005, :ω => 1.0, :λ => 0.03)
ds = ContinuousDynamicalSystem(mathieu!, [1.0, 0], fixed)
tr = trajectory(ds, 10.0)
local_growth_rates(ds, tr)
Package versions
When running:
using Pkg
Pkg.status([
"DynamicalSystems",
"DelayEmbeddings", "RecurrenceAnalysis",
"DynamicalSystemsBase", "ChaosTools",
"Entropies",];
mode = PKGMODE_MANIFEST
)
I get:
[608a59af] ChaosTools v2.9.0
⌅ [5732040d] DelayEmbeddings v2.4.1
[61744808] DynamicalSystems v2.3.2
⌅ [6e36e845] DynamicalSystemsBase v2.8.0
⌅ [ed8fcbec] Entropies v1.1.2
[639c3291] RecurrenceAnalysis v1.8.1
Orjan Ameye commented
The problem is solved when one defines the Mathieu function out-of-place.
using DynamicalSystems
function mathieu(x,p,t)
dx1 = x[2]
dx2 = -p[:ω₀]^2*(1-p[:λ]*cos(2*p[:ω]*t))*x[1] - p[:γ]*x[2]
return SA[dx1, dx2]
end
fixed = Dict(:ω₀ => 1.0, :γ => 0.005, :ω => 1.0, :λ => 0.03)
ds = ContinuousDynamicalSystem(mathieu, [1.0, 0], fixed)
tr = trajectory(ds, 10.0)
local_growth_rates(ds, tr)
George Datseris commented
problem will be solved in DynamicalSystems.jl v3.0, coming out by the end of the month