Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am in trouble on finding a numerical technique to solve the following system of equations

$$\ddot q_1(t)=f_1(q_1(t),q_2(t))$$

$$\ddot q_2(t)=f_2(q_1(t),q_2(t))$$

with a constrain of the kind:


with $Q$ a constant and a nonholonomic constraint:

$$q_1(t)>0 \qquad q_2(t)>0.$$

I would appreciate also good references and whether such kind of question could be more suitable for MathOverflow.

Thanks a lot.

share|cite|improve this question
If you introduce new variables $u_1$ and $u_2$ such that $q_1 = \exp(u_1)$ and $q_2 = \exp(u_2)$, then the non-holonomic constraint will be automatically satisfied. Mathematica's NDSolve has "Projection" method for projecting on the manifold, which you can use to solve the rest. Once the solution is obtained, postprocess it to recover $q$-s. – Sasha Jan 31 '12 at 14:48
@Sasha: Thanks a lot! Please, could you expand more on this putting it as answer? – Jon Jan 31 '12 at 15:50
up vote 3 down vote accepted

I'm not sure about the problem you want to solve. The system of ODEs has a unique solution, given the initial conditions. So, do you want to find the initial conditions such that all constraints are satisfied? In that case, you can probably make some headway analytically. The first constraint implies that $\dot{q}_1 = \dot{q}_2$ and $\ddot{q}_1 = \ddot{q}_2$ so $f_1(q_1,q_2) = f_2(q_1,q_2)$; that should simplify your problem.

Or, perhaps you already know that the constraints are satisfied, because they are a consequence of the differential equation (and initial conditions), and you want to make sure that the numerical solution also satisfies the constraint. That is studied in "Geometric Integration", and a good book is Hairer, Lubich & Wanner, Geometric Numerical Integration, Springer. The projection method that Sasha mentioned is one possibility, but in fact many methods (like Runge-Kutta) follow linear constraints automatically.

Or, perhaps your description is not complete, and you have for instance three unknown functions, described by two differential equations and one algebraic constraint. Such problems are called differential-algebraic equations (DAEs). One book on their numerical solution that I can recommend is: Ascher & Petzold, Computer methods for ordinary differential equations and differential-algebraic equations, SIAM, 1998.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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