logo

Lyapunov Spectrum of Linear Systems 📂Dynamics

Lyapunov Spectrum of Linear Systems

Theorem

For the matrix ARn×nA \in \mathbb{R}^{n \times n}, let’s assume the following vector field is given as a linear differential equation. x˙=Ax,xRn \dot{\mathbf{x}} = A \mathbf{x} \qquad , \mathbf{x} \in \mathbb{R}^{n}

If AA is a symmetric matrix, the Lyapunov spectrum of this system is equal to the eigenvalues of 12(A+AT){\frac{ 1 }{ 2 }} \left( A + A^{T} \right).


Explanation

A=[0.20.30.20.7] A = \begin{bmatrix} -0.2 & -0.3 \\ -0.2 & -0.7 \end{bmatrix}

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 A=ATA = A^{T} 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.

lyapunov.png

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 JJ of ff. Y˙=JY \dot{Y} = J Y Here, the initial condition of the matrix function Y=Y(t)Rn×nY = Y(t) \in \mathbb{R}^{n \times n} is set to be the identity matrix Y(0)=IY(0) = I. … Geometrically, you can think of YY as showing how the tangent vector itself acts while transforming the original system slightly from x(t)x(t) to x(0)x(0).

λk:=limtlog[(Y(t,v)vv)1/t] \lambda_{k} := \lim_{t \to \infty} \log \left[ \left( {\frac{ \left\| Y(t, v) v \right\| }{ \left\| v \right\| }} \right)^{1/t} \right] The {λ1,,λn}\left\{ \lambda_{1} , \cdots , \lambda_{n} \right\} defined as above is called the Lyapunov spectrum or, Λv:=limt[Y(t)Y(t)]1/2t \Lambda_{v} := \lim_{t \to \infty} \left[ Y(t)^{\ast} Y(t) \right]^{1/2t} The eigenvalues μ1,,μn\mu_{1} , \cdots , \mu_{n} of the matrix Λv\Lambda_{v} defined as above, when taking the logarithm of λk:=logμk\lambda_{k} := \log \mu_{k}, is called the Lyapunov spectrum.

x˙=Ax\dot{\mathbf{x}} = A \mathbf{x} is a linear differential equation, so the Jacobian JJ also becomes J=AJ = A and the variational equation of the original system, for the initial value Y=InY = I_{n} which is the identity matrix, is Y˙=AY\dot{Y} = A Y and its exact solution is Y(t)=eAtY(t) = e^{A t}. According to the definition of the Lyapunov spectrum, the following is obtained. loglimt[Y(t)TY(t)]1/2t=limtlog[Y(t)TY(t)]1/2t=limt12tlog[Y(t)TY(t)]=limt12tlog[eATteAt] \begin{align*} & \log \lim_{t \to \infty} \left[ Y(t)^{T} Y(t) \right]^{1/2t} \\ =& \lim_{t \to \infty} \log \left[ Y(t)^{T} Y(t) \right]^{1/2t} \\ =& \lim_{t \to \infty} {\frac{ 1 }{ 2t }} \log \left[ Y(t)^{T} Y(t) \right] \\ =& \lim_{t \to \infty} {\frac{ 1 }{ 2t }} \log \left[ e^{A^{T} t} e^{A t} \right] \end{align*}

Exponentials and Logarithms of Matrices: If two matrices A,BCn×nA, B \in \mathbb{C}^{n \times n} satisfy AB=BAAB = BA, the following holds. logAB=logA+logB2πiU(logA+logB) \log AB = \log A + \log B - 2 \pi i \mathcal{U} \left( \log A + \log B \right) Especially, for the eigenvalues of AA μk\mu_{k} and those of BB νk\nu_{k}, the following corollary can be obtained. logAB=logA+logB    k=1,,n:argμk+argνk(π,π] \log AB = \log A + \log B \iff \forall k = 1 , \cdots , n : \arg \mu_{k} + \arg \nu_{k} \in ( - \pi , \pi ]

Since ARn×nA \in \mathbb{R}^{n \times n} has only real entries, it is an Hermitian matrix, and its eigenvalues are real, the eigenvalues of both eATte^{A^{T} t} and eAte^{A t} are real. Having real eigenvalues means their arguments are 00, ensuring the matrix logarithm logAB=logA+logB\log A B = \log A + \log B is valid, leading to the following. limt12tlog[eATteAt]=limt12t[logeATt+logeAt]=limt12t[ATt+At]=12[AT+A] \begin{align*} & \lim_{t \to \infty} {\frac{ 1 }{ 2t }} \log \left[ e^{A^{T} t} e^{A t} \right] \\ =& \lim_{t \to \infty} {\frac{ 1 }{ 2t }} \left[ \log e^{A^{T} t} + \log e^{A t} \right] \\ =& \lim_{t \to \infty} {\frac{ 1 }{ 2t }} \left[ A^{T} t + A t \right] \\ =& {\frac{ 1 }{ 2 }} \left[ A^{T} + A \right] \end{align*}

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")