# Lyapunov exponents using ChaosTools and fortran radau solver

**URL:** <https://discourse.julialang.org/t/lyapunov-exponents-using-chaostools-and-fortran-radau-solver/26007>\
**Category:** General Usage\
**Created:** [July 4, 2019, 11:03am UTC](https://discourse.julialang.org/t/lyapunov-exponents-using-chaostools-and-fortran-radau-solver/26007 "2019-07-04T11:03:34Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamblejoe](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Post date:** [July 4, 2019, 11:03am UTC](https://discourse.julialang.org/t/lyapunov-exponents-using-chaostools-and-fortran-radau-solver/26007/1 "2019-07-04T11:03:34Z")

</div>

Hi,  
I am not sure if this is the right place to ask my question but I will try anyways.

I want to calculate Lyapunov exponents of a very stiff ODE using the fortran radau solver from `ODEInterfaceDiffEq`. My setup looks like the following for creating the tangent integrator:

```julia
using DifferentialEquations
using ODEInterfaceDiffEq

cds = ContinuousDynamicalSystem(f, x_start, params, jac)
integ = tangent_integrator(cds;alg=radau())

```

This errors with the following:

> MethodError: no method matching \_\_init(::ODEProblem{Array{Float64,2},Tuple{Float64,Float64},true,Array{Float64,1},ODEFunction{true,getfield(DynamicalSystemsBase, Symbol(“##21#22”)){6,typeof(f),typeof(jac)},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Nothing,DiffEqBase.StandardODEProblem}, ::radau{Nothing}; abstol=1.0e-6, reltol=1.0e-6, internalnorm=DynamicalSystemsBase.\_tannorm, save\_everystep=false, alg=radau{Nothing}(nothing, nothing))  
> Closest candidates are:  
> \_\_init(::ODEProblem, !Matched::SimpleDiffEq.SimpleTsit5; dt) at /home/goran/.julia/packages/SimpleDiffEq/sWpbw/src/tsit5/tsit5.jl:29 got unsupported keyword arguments “abstol”, “reltol”, “internalnorm”, “save\_everystep”, “alg”  
> \_\_init(::ODEProblem, !Matched::SimpleDiffEq.SimpleATsit5; dt, abstol, reltol, internalnorm, kwargs…) at /home/goran/.julia/packages/SimpleDiffEq/sWpbw/src/tsit5/atsit5.jl:49  
> \_\_init(::DiffEqBase.AbstractODEProblem, !Matched::algType\<:OrdinaryDiffEqAlgorithm) where algType\<:OrdinaryDiffEqAlgorithm at /home/goran/.julia/packages/OrdinaryDiffEq/tat1c/src/solve.jl:62 got unsupported keyword arguments “abstol”, “reltol”, “internalnorm”, “save\_everystep”, “alg”  
> …

What is the right way to set up the tangent integrator?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [July 4, 2019, 11:21am UTC](https://discourse.julialang.org/t/lyapunov-exponents-using-chaostools-and-fortran-radau-solver/26007/2 "2019-07-04T11:21:18Z")

</div>

You cannot setup the tangent integrator with this method.

---

<div class="post-metadata">

**Author:** ![jamblejoe](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Post date:** [July 4, 2019, 11:23am UTC](https://discourse.julialang.org/t/lyapunov-exponents-using-chaostools-and-fortran-radau-solver/26007/3 "2019-07-04T11:23:51Z")

</div>

So I use `create_tangent` from `DynamicalSystemsBase` instead and define my own `ODEProblem` ?

Or what is the way to go?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [July 4, 2019, 11:26am UTC](https://discourse.julialang.org/t/lyapunov-exponents-using-chaostools-and-fortran-radau-solver/26007/4 "2019-07-04T11:26:28Z")

</div>

the Fortran `radau` doesn’t have the right hooks to create the integrator type the way that this method needs it. It just won’t work and I’m not sure it ever will. If you want something similar, you can try OrdinaryDiffEq.RadauIIA instead.

---

<div class="post-metadata">

**Author:** ![jamblejoe](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Post date:** [July 4, 2019, 11:29am UTC](https://discourse.julialang.org/t/lyapunov-exponents-using-chaostools-and-fortran-radau-solver/26007/5 "2019-07-04T11:29:06Z")

</div>

OK! I assume that `OrdinaryDiffEq.RadauIIA` is calling purely Julia code?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [July 4, 2019, 11:32am UTC](https://discourse.julialang.org/t/lyapunov-exponents-using-chaostools-and-fortran-radau-solver/26007/6 "2019-07-04T11:32:16Z")

</div>

Yes it’s a pure Julia recreation of the RadauIIA method which conforms to the interface like the rest of OrdinaryDiffEq. There are a few things it’s still missing in terms of Jacobian handling, and it requires that the problem is defined on the reals (because it uses Hairer’s same complexification trick), but that’s about it.

---

<div class="post-metadata">

**Author:** ![jamblejoe](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Post date:** [July 4, 2019, 11:40am UTC](https://discourse.julialang.org/t/lyapunov-exponents-using-chaostools-and-fortran-radau-solver/26007/7 "2019-07-04T11:40:31Z")

</div>

> it requires that the problem is defined on the reals

This is no problem in my case.

As far as I can see, RadauIIA5 is implemented in OrdinaryDiffEq - so 5. order, right?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [July 4, 2019, 11:41am UTC](https://discourse.julialang.org/t/lyapunov-exponents-using-chaostools-and-fortran-radau-solver/26007/8 "2019-07-04T11:41:14Z")

</div>

Yes, the 5th order one is implemented but not the adaptive order one yet.

---

<div class="post-metadata">

**Author:** ![jamblejoe](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Post date:** [July 4, 2019, 12:03pm UTC](https://discourse.julialang.org/t/lyapunov-exponents-using-chaostools-and-fortran-radau-solver/26007/9 "2019-07-04T12:03:05Z")

</div>

OK. So how would I use the ChaosTools package to setup a tangent integrator and calculate Lyapunov exponents with a specific solver algorithm? I can not figure that out right now - I am still new to Julia and the DiffEq/DynSystems enviromnent 🙂

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [July 4, 2019, 12:09pm UTC](https://discourse.julialang.org/t/lyapunov-exponents-using-chaostools-and-fortran-radau-solver/26007/10 "2019-07-04T12:09:43Z")

</div>

> [@jamblejoe](#):
>
> integ = tangent\_integrator(cds;alg=radau())

It should just be `integ = tangent_integrator(cds;alg=RadauIIA())`

---

<div class="post-metadata">

**Author:** ![jamblejoe](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Post date:** [July 5, 2019, 3:35pm UTC](https://discourse.julialang.org/t/lyapunov-exponents-using-chaostools-and-fortran-radau-solver/26007/11 "2019-07-05T15:35:33Z")

</div>

@ChrisRackauckas Sorry for the late response! Your last answer worked - thank you 🙂
