# Computing the Lyapunov exponent of the Hénon map with DynamicalSystems.jl

**URL:** <https://discourse.julialang.org/t/computing-the-lyapunov-exponent-of-the-henon-map-with-dynamicalsystems-jl/70810>\
**Category:** Modelling & Simulations\
**Tags:** question, differentialequation\
**Created:** [November 2, 2021, 3:00pm UTC](https://discourse.julialang.org/t/computing-the-lyapunov-exponent-of-the-henon-map-with-dynamicalsystems-jl/70810 "2021-11-02T15:00:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoFishLikeIan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nofishlikeian/32/20917_2.png) [@NoFishLikeIan](https://discourse.julialang.org/u/NoFishLikeIan)\
**Post date:** [November 2, 2021, 3:00pm UTC](https://discourse.julialang.org/t/computing-the-lyapunov-exponent-of-the-henon-map-with-dynamicalsystems-jl/70810/1 "2021-11-02T15:00:20Z")

</div>

## Issue

I am trying to compute the Lyapunov exponent of the Hénon map with `b = 0.3` and `a = 1.8` but the `lyapunov` function from `DynamicalSystems.jl` seems to not converge. Is there something I am doing wrong or is this expected?

## Minimal working example

This does not converge:

```julia-auto
using DynamicalSystems

henon = Systems.henon(a = 1.75)
λ = lyapunov(henon, 10000, d0 = 1e-7, upper_threshold = 1e-4, Ttr = 100)

```

This converges very quickly:

```julia-auto
henon = Systems.henon(a = 1.)
λ = lyapunov(henon, 10000, d0 = 1e-7, upper_threshold = 1e-4, Ttr = 100)

```

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [November 2, 2021, 3:11pm UTC](https://discourse.julialang.org/t/computing-the-lyapunov-exponent-of-the-henon-map-with-dynamicalsystems-jl/70810/2 "2021-11-02T15:11:09Z")

</div>

Hi,

1. What does “converge” mean?
2. `upper_threshold = 1e-4`. Lyapunov exponents are in theory defined for infinitesimal perturbations. You want `Δt` and `threshold` to be such that perturbation growth is limited to linearized dynamics. Is this true here?
3. What is the trajectory of the dynamical system doing for these parameters?

I see:

```julia
julia> tr = trajectory(henon, 100; Ttr = 1000)
2-dimensional Dataset{Float64} with 101 points
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
   ⋮
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf
 -Inf -Inf

```

the system goes to infinity for `a=1.75`…

---

<div class="post-metadata">

**Author:** ![NoFishLikeIan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nofishlikeian/32/20917_2.png) [@NoFishLikeIan](https://discourse.julialang.org/u/NoFishLikeIan)\
**Post date:** [November 2, 2021, 3:25pm UTC](https://discourse.julialang.org/t/computing-the-lyapunov-exponent-of-the-henon-map-with-dynamicalsystems-jl/70810/3 "2021-11-02T15:25:56Z")

</div>

> [@Datseris](#):
>
> ```julia
> 2-dimensional Dataset{Float64} with 101 points
> 
> ```

Thank you for the quick reply! You are indeed correct, I did not realise the trajectory was diverging for `a = 1.75`.
