I'm staring down a system of equations that look like (taken from http://scienceworld.wolfram.com/physics/DoublePendulum.html)
$ \begin{align} \ddot \theta_1 &= - \frac{m_2 l_2 \ddot{\theta_2}}{l_1(m_1 + m_2)}\cos(\theta_1-\theta_2) + \frac{m_2 l_2 \dot{\theta_2}^2 \sin (\theta_1 - \theta_2)}{l_1 (m_1 + m_2)} - \frac{g}{l} \sin (\theta_1)\\ \ddot \theta_2 &= -\frac{l_1}{l_2} \cos(\theta_1 - \theta_2) + \frac{l_1}{l_2}\ddot{\theta_1}\sin (\theta_1 - \theta_2) - g\sin \theta_2 \end{align} $
where I'd like to solve for $\theta_1$ and $\theta_2$. I'm looking to use MATLAB's ODE45 to do it, and I'm running into problems because the two second derivatives depend on each other. That is, I can't express $\ddot \theta_2$ without using $\ddot \theta_1$. And I'm not sure how to do that. Essentially the problem is that I have to begin by defining one before the other, and by that time I need the other to be defined as well. How do I get around this?
Thank you for your time.