2
$\begingroup$

Does anyone know (simple) Mathematica code for computing the Lyuponov exponent for the Duffing system?

x''[t] + 0.15 x'[t] - x[t] + x[t]^3== 7*Cos[t]
{x[0] == 0, x'[0] == 0}
$\endgroup$
5
  • $\begingroup$ The system is in chaotic state but I got negative values for Lyapunov Exponents by using the suggested methods I am not sure what is wrong $\endgroup$
    – Kaleed Ad
    Commented Nov 5, 2018 at 17:48
  • $\begingroup$ Do you know what the right answer is? $\endgroup$
    – Chris K
    Commented Nov 5, 2018 at 18:08
  • $\begingroup$ No but at least one of them must be positive $\endgroup$
    – Kaleed Ad
    Commented Nov 5, 2018 at 18:15
  • $\begingroup$ P.S., welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Chris K
    Commented Nov 5, 2018 at 18:21
  • $\begingroup$ Thank you very much for the advice and your time. $\endgroup$
    – Kaleed Ad
    Commented Nov 5, 2018 at 18:44

1 Answer 1

5
$\begingroup$

My previous code for LyapunovExponents from this answer did not handle non-autonomous systems like this properly. Thanks for pointing that out! I've updated it to fix this mistake and it seems to work now.

Putting your system in first-order form:

eqns = {x'[t] == y[t], y'[t] == -0.15 y[t] + x[t] - x[t]^3 + 7 Cos[t]};

Then calculating Lyapunov exponents:

LyapunovExponents[eqns, {x -> 0, y -> 0}, ShowPlot -> True]

Mathematica graphics

(* {0.10542, -0.25542} *)
$\endgroup$
2
  • 1
    $\begingroup$ I used your code after your modification and I was able to get very close results for this work arxiv.org/pdf/physics/0303077.pdf for this eq: eqns = {x'[t] == y[t], y'[t] == 2.5*Sin[t] - 0.1 y[t] - Sin[x[t]]}; This is what I got {0.160632, -0.260632} And this what they got {0.160 , −0.262} That is very good By the way, should I always use the initial conditions for LyapunovExponents[eqns, {x -> 0, y -> 0}, ShowPlot -> True] or the value for x and y at any time is fine? Thanks you $\endgroup$
    – Kaleed Ad
    Commented Nov 6, 2018 at 19:27
  • $\begingroup$ Great, thanks for the link. You can use whatever initial conditions (t=0) you want. $\endgroup$
    – Chris K
    Commented Nov 6, 2018 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.