Lyapunov Spectrum of Linear Systems
Theorem
For the matrix , let’s assume the following vector field is given as a linear differential equation.
If is a symmetric matrix, the Lyapunov spectrum of this system is equal to the eigenvalues of .
- Here, is the transpose matrix of matrix .
Explanation
julia> A = [-.2 -.3; -.3 -.7]
2×2 Matrix{Float64}:
-0.2 -0.3
-0.3 -0.7
julia> @showprogress for t in 0:h:tend
# v, _ = RK4(T_A, v_[end])
# push!(v_, v)
U, V = gram_schmidt(U)
λ += V |> eachcol .|> norm .|> log
isinteger(t) && push!(λ_, λ / t)
U = RK4(A, U, h)
end
Progress: 100%|█████████████████████| Time: 0:00:05
As a concrete example, let’s calculate the Lyapunov spectrum for a linear system given by a matrix like mentioned above.
julia> λ / (tend)
2-element Vector{Float64}:
-0.05958668545713238
-0.8404133145577668
julia> eigen((A + A')/2).values
2-element Vector{Float64}:
-0.8405124837953326
-0.0594875162046673
Comparing the results of numerical calculations, we can confirm that they are quite similar to the theoretical predictions.
The point of calculating the Lyapunov spectrum for a simple system like this lies in the validation of the code. Unlike complex systems, linear systems allow for theoretical calculation of the Lyapunov spectrum, making it an example for verifying the accuracy of methods like RK4 and Gram-Schmidt orthogonalization or QR decomposition and their order.
Proof 1
Definition of Lyapunov Spectrum:
Variational Equation: Let the following be the variational equation for the Jacobian matrix of . Here, the initial condition of the matrix function is set to be the identity matrix . … Geometrically, you can think of as showing how the tangent vector itself acts while transforming the original system slightly from to .
The defined as above is called the Lyapunov spectrum or, The eigenvalues of the matrix defined as above, when taking the logarithm of , is called the Lyapunov spectrum.
is a linear differential equation, so the Jacobian also becomes and the variational equation of the original system, for the initial value which is the identity matrix, is and its exact solution is . According to the definition of the Lyapunov spectrum, the following is obtained.
Exponentials and Logarithms of Matrices: If two matrices satisfy , the following holds. Especially, for the eigenvalues of and those of , the following corollary can be obtained.
Since has only real entries, it is an Hermitian matrix, and its eigenvalues are real, the eigenvalues of both and are real. Having real eigenvalues means their arguments are , ensuring the matrix logarithm is valid, leading to the following.
■
Code
The following is a result of calculating the Lyapunov spectrum using Julia.
using ProgressMeter, LinearAlgebra
function gram_schmidt(J)
N = size(J, 1)
U, V = deepcopy(J), deepcopy(J)
U[:,1] = V[:,1] / norm(V[:,1])
for j in 2:N
for jp in 1:(j-1)
V[:,j] -= (J[:,j]'U[:,jp])*U[:,jp]
end
U[:,j] = V[:,j] / norm(V[:,j])
end
return U, V
end
function RK4(J::AbstractMatrix, U::AbstractMatrix, dt=1e-2)
V1 = J*U
V2 = J*(U + (dt/2)*V1)
V3 = J*(U + (dt/2)*V2)
V4 = J*(U + dt*V3)
return U + (dt/6)*(V1 + 2V2 + 2V3 + V4)
end
A = [-.2 -.3; -.3 -.7]
# T_A(v) = A*v
U = I(2)
λ = zeros(2); λ_ = [λ]
# v = [10, 10.0]; v_ = [v]
h = 1e-3; tend = 1000
@showprogress for t in 0:h:tend
# v, _ = RK4(T_A, v_[end])
# push!(v_, v)
U, V = gram_schmidt(U)
λ += V |> eachcol .|> norm .|> log
isinteger(t) && push!(λ_, λ / t)
U = RK4(A, U, h)
end
λ / (tend)
eigen((A + A')/2).values
using Plots
plot(xlims = [1, 100], xlabel = "t", legend = :right)
scatter!(0:10:1001, first.(λ_[1:10:end]), label = "λ1", msw = 0)
scatter!(0:10:1001, last.(λ_[1:10:end]), label = "λ2", msw = 0)
hline!(eigen((A + A')/2).values, color = :black, label = "Theoretical")