Hello! I calculate the equilibrium points for a continuous dynamical system and then calculate it eigenvalues.
I don’t need to sort these eigenvalues, otherwise I’ll have to literally search through all the phase variables to find out which one/corresponds to a stable/unstable manifold.
As far as I understand, the function from the linear algebra package always sorts them. Are there any analogues or maybe I can disable sorting?
Jacobian my system:
using StaticArrays
@inbounds function jacob_TM_(u, p, t)
U(y, p, exp50) = p[8] + p[9] / ( 1.0 + exp50 )
U_y(y, p, exp50) = (50.0 * p[9] * exp50) / (1.0 + exp50)^2
g(E, x, y, p, U_) = exp((p[5] * U_ * x * E + p[11]) / p[1])
σ_der(x, p) = exp( (-20.0) * (x - p[6]) )
exp50 = exp(-50.0 * (u[3] - p[7]))
U_ = U(u[3], p, exp50)
Uy = U_y(u[3], p, exp50)
g_ = g(u[1], u[2], u[3], p, U_)
σ_deri = σ_der(u[2], p)
g_plus = 1.0 + g_
g_mult = g_ * U_
g_plus_mult = p[2] * (g_plus)
u1p5 = p[5] * u[1]
Uyu2 = Uy * u[2]
E_E = (-1.0 + ((J * u[2] * g_mult)) / (g_plus) ) / p[2]
E_x = (u1p5 * g_mult) / (g_plus_mult)
E_y = (u1p5 * Uyu2 * g_) / (g_plus_mult)
x_E = -U_ * u[2]
x_x = -1.0 / p[3] - U_ * u[1]
x_y = -Uyu2 * u[1]
y_x = 20.0 * p[10] * σ_deri / (1.0 + σ_deri)^2
y_y = -1.0/p[4]
SMatrix{3,3}(E_E, x_E, 0.0,
E_x, x_x, y_x,
E_y, x_y, y_y)
end
I have next error
MethodError: no method matching eigen(::SMatrix{3, 3, Float64, 9}; sortby=nothing)
Closest candidates are:
eigen(::StaticArray{Tuple{N, M}, T, 2} where {N, M, T}; permute, scale) at C:\Users\Alex\.julia\packages\StaticArrays\a4r2v\src\eigen.jl:421 got unsupported keyword argument "sortby"
eigen(::AbstractMatrix{TA}, !Matched::AbstractMatrix{TB}; kws...) where {TA, TB} at C:\Users\Alex\AppData\Local\Programs\Julia-1.8.5\share\julia\stdlib\v1.8\LinearAlgebra\src\eigen.jl:509
eigen(::AbstractMatrix{T}; permute, scale, sortby) where T at C:\Users\Alex\AppData\Local\Programs\Julia-1.8.5\share\julia\stdlib\v1.8\LinearAlgebra\src\eigen.jl:235
Code:
const τ = 0.013; const τD = 0.080; const τy = 3.3; const J = 3.07; const β = 0.300
const xthr = 0.75; const ythr = 0.4
const α = 1.58; const ΔU0 = 0.305; const U0 = 0.265;
I0 = -1.706
p = [α, τ, τD, τy, J, xthr, ythr, U0, ΔU0, β, I0]
fp_ = [8.337037568242414, 0.7385031015931967, 0.4383397756224628]
jac = jacob_TM_(fp_, p, 0)
eigen(jac, sortby = nothing)
This is perhaps an issue with the StaticArrays
method:
@inline function eigen(A::StaticMatrix; permute::Bool=true, scale::Bool=true)
_eig(Size(A), A, permute, scale)
end
where they don’t include sortby
as a keyword argument. Meanwhile, you may convert it to a matrix:
julia> eigen(Matrix(SMatrix{3,3,Float64}(1:9)), sortby = nothing)
Eigen{Float64, Float64, Matrix{Float64}, Vector{Float64}}
values:
3-element Vector{Float64}:
16.116843969807064
-1.1168439698070436
-5.70069118970987e-16
vectors:
3×3 Matrix{Float64}:
-0.464547 -0.882906 0.408248
-0.570796 -0.23952 -0.816497
-0.677044 0.403865 0.408248
Thank you!
How do I split this data? I want to get values
You may use eigvals
instead:
julia> eigvals(Matrix(SMatrix{3,3,Float64}(1:9)), sortby = nothing)
3-element Vector{Float64}:
16.116843969807064
-1.1168439698070436
-5.70069118970987e-16
1 Like