# Numerical solving a constrained system of differential equation

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:

$$q_1(t)+q_2(t)=Q$$

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.

-
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

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.