Assumed the following example of double pendulum by Thison (Answered by Jens):

Animation of double pendulum

Imagine that in the given animation(i.e. http://i.stack.imgur.com/p4TgL.gif ), the second pendulum (Second Linkage) can not rotate 360 degree. In other words, I want to somehow put a constraint on this system with these given equations and initial conditions and limit their motions. For instance, Second pendulum can have a rotation like 0<phi2[t]<180.

I wonder how it is possible to apply this constraint in NDSolve[] or any possible solution for this problem.

Thank you in advance.

  • $\begingroup$ You have to put constraint not in NDSolve, but on formulation of the problem, i.e. equations, itself. If your do not want to deals with physics here, one idea is to redefine angle function that it always return 180, for higher values. $\endgroup$ – user18792 Nov 28 '14 at 10:53
  • $\begingroup$ @user18792: Could you please elaborate it more?! How is it possible to redefine and add a function that always return 180 for higher values?! $\endgroup$ – Shellp Nov 28 '14 at 14:30
  • $\begingroup$ I absolutely aggree with the first sentence of user18792: you should reformulate the problem. If you just ad hoc enforce a constraint with a programming trick the solution will violate physical laws (energy conservation, momentum conservation,...) in an arbitrary and basically uncontrolled way... $\endgroup$ – Albert Retey Nov 28 '14 at 15:09
  • $\begingroup$ @Albert Retey: I would be thankful if you could help me with this problem and tell me how to apply the constraints and consider them in the formulation. $\endgroup$ – Shellp Nov 28 '14 at 21:49

By restriction I had in mind clipping: something like this.

    x1[t_] := Evaluate[Sin[Clip[phi1[t] /. sol, {-Pi/4, Pi/4}]]]
    y1[t_] := Evaluate[-Cos[Clip[phi1[t] /. sol, {-Pi/4, Pi/4}]]]
    x2[t_] := 
     Evaluate[Sin[Clip[phi1[t] /. sol, {-Pi/4, Pi/4}]] + 
       Sin[Clip[phi2[t] /. sol, {-Pi/4, Pi/4}]]]
    y2[t_] := 
     Evaluate[-(Cos[Clip[phi1[t] /. sol, {-Pi/4, Pi/4}]] + 
     Cos[Clip[phi2[t] /. sol, {-Pi/4, Pi/4}]])]

Then you will see as @Albert Retey pointed unphysical movie of pendulum. So, I would suggest you to start from the Lagrangian formulation


From which you can easily derive equations you solve


This problem by the way is listed in Landau (I volume, Mechanics, p11 as exercise).

Then your have to think how to add restrictions into the Lagrangian (may be using Lagrangian multipliers method). I never did these things. May be somebody else have some ideas.

  • $\begingroup$ Thank you so much for you help. Unfortunately, in this exercise you mentioned, no constraints are considered.However, that's a great help to me. $\endgroup$ – Shellp Nov 28 '14 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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