Skip to content

JuliaDynamics/LagrangianDescriptors.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lagrangian Descriptors

Dev Main Tests Workflow Status codecov License: MIT GitHub repo size

Social preview

Implementation of the method of Lagrangian Descriptors to highlight singular features (e.g. stable or unstable invariant manifolds) of the dynamics of an evolutionary system (such as ordinary or partial differential equations, random equations, or stochastic differential equations).

Examples

Periodically forced Duffing oscillator

Here in an example on a periodically forced Duffing system.

using OrdinaryDiffEq, Plots
using LinearAlgebra: norm
using LagrangianDescriptors

function f!(du, u, p, t)
    x, y = u
    A, ω = p
    du[1] = y
    du[2] = x - x^3 + A * sin* t)
end

u0 = [0.5, 2.2]
tspan = (0.0, 13.0)
A = 0.3; ω = π

p = (A, ω)
prob = ODEProblem(f!, u0, tspan, p)

M(du, u, p, t) = norm(du)

uu0 = [[x, y] for y in range(-1.0, 1.0, length=301), x in range(-1.8, 1.8, length=301)]

lagprob = LagrangianDescriptorProblem(prob, M, uu0)

With all setup, we may solve it as follows:

julia> @time lagsol = solve(lagprob, Tsit5())
  4.241800 seconds (204.88 M allocations: 9.173 GiB, 23.40% gc time, 24.99% compilation time)

Then we use the built-in plot recipe to get the heatmap of the Lagrangian descriptors:

plot(lagsol)

Duffing Lagrangian descriptor

Random Duffing oscillator

And here is a painting of a random Duffing oscillator, detailed in the Tutorials part of the documentation:

Random Duffing Lagrangian descriptor

References