Its good practice to solve some problems that are a little bit different from the norm. It’s good to be forced to think in different ways and remember some math that one may have long forgotten about from years ago. Again, this is a continuation of the first set of Lagrangian based problems. That is, these problems are a stepping stone for something slightly more complicated that may or may not eventually happen. The job market for solving differential equations on paper by hand and then coding them up is so tremendous. So this is good preparation if that was true. When I initially took a classical mechanics course a while ago, the professor would solve some problems to the point of having a set of differential equations. He would never proceeded onwards with those equations; the thought of using a computer and simulating them was completely foreign to him (I guess he did not know anything about computers). So simulating these simple problems is satisfying a curiosity I had a lot time ago. Finally, I like classical mechanics. Sometimes I think it would be great to be stuck on an island somewhere with a pad of paper, a pen, and one of the more famous classical mechanics books out there (like this one ). Other days I think it might not be the best idea.
So in this project, three more problems were solved: 1) a simple pendulum on a wheel; 2) spring-cart-pendulum system; and 3) the triple pendulum.
Simple Pendulum on a Wheel
This problem is what the title says, a simple pendulum that is attached to a rotating wheel (that is rotating at a constant velocity). Note, to keep things easy, inertia is not considered in the wheels motion.
The math is pretty easy since it’s just a single degree of freedom problem. First, the angle (ϕ \phi ϕ ) of where the pendulum’s pivot is on the wheel is at time t is: \phi = \phi_0 + \omega t
Where ϕ 0 \phi_0 ϕ 0 is the initial angle and ω \omega ω is the angular speed of the rotating wheel.
The position of the pendulum’s pivot is then:x_{\mathsf{pivot}} = r \cos \omega t \qquad\qquad y_{\mathsf{pivot}} = r \sin \omega t
The pendulum’s mass position is:x_{\mathsf{pend}} = \ell \sin \theta \qquad\qquad y_{\mathsf{pend}} = -\ell \cos \theta
Therefore the final/total position of the pendulum is:
x = x p i v o t + x p e n d = r cos ω t + ℓ sin θ y = y p i v o t + y p e n d = r sin ω t – ℓ cos θ \begin{aligned} x &= x_{\mathsf{pivot}} + x_{\mathsf{pend}} = r \cos \omega t + \ell \sin \theta \\ y &= y_{\mathsf{pivot}} + y_{\mathsf{pend}} = r \sin \omega t – \ell \cos \theta \end{aligned} x y = x p i v o t + x p e n d = r cos ω t + ℓ sin θ = y p i v o t + y p e n d = r sin ω t – ℓ cos θ
Now the velocities will be found to make the kinetic energy calculations a little bit easier to determine.
x ˙ = − r ω sin ω t + ℓ cos θ θ ˙ y ˙ = r ω cos ω t + ℓ sin θ θ ˙ \begin{aligned} \dot{x} &= -r\omega \sin\omega t + \ell \cos \theta \dot{\theta} \\ \dot{y} &= r\omega \cos \omega t + \ell \sin \theta \dot{\theta} \end{aligned} x ˙ y ˙ = − r ω sin ω t + ℓ cos θ θ ˙ = r ω cos ω t + ℓ sin θ θ ˙
Now computing the kinetic energy :
T = 1 2 m v 2 = 1 2 m [ 1 2 x ˙ 2 + y ˙ 2 ] = 1 2 m [ 1 2 ( − r ω sin ω t + ℓ cos θ θ ˙ ) 2 + ( r ω cos ω t + ℓ sin θ θ ˙ ) 2 ] = 1 2 m [ 1 2 r 2 ω 2 sin 2 ω t − 2 r ℓ ω cos θ sin ω t θ ˙ + ℓ 2 cos 2 θ θ ˙ 2 + r 2 ω 2 cos 2 ω t + 2 r ℓ ω sin θ cos ω t θ ˙ + ℓ 2 sin 2 θ θ ˙ 2 1 2 ] = 1 2 m r 2 ω 2 + 1 2 m ℓ 2 θ ˙ 2 + m r ℓ ω sin ( θ – ω t ) θ ˙ \begin{aligned} T &= \frac{1}{2} mv^2 = \frac{1}{2} m \left[ \vphantom{\frac{1}{2}} \dot{x}^2 + \dot{y}^2 \right] \\ &= \frac{1}{2} m \left[ \vphantom{\frac{1}{2}} (-r\omega \sin\omega t + \ell \cos \theta \dot{\theta})^2 + (r\omega \cos \omega t + \ell \sin \theta \dot{\theta})^2 \right] \\ &= \frac{1}{2} m \left[ \vphantom{\frac{1}{2}} r^2 \omega^2 \sin^2 \omega t \ -\ 2r\ell \omega \cos\theta\sin\omega t \dot{\theta}\ +\ \ell^2\cos^2\theta \dot{\theta}^2 \right.\\ & \qquad\quad \left. + r^2\omega^2 \cos^2\omega t\ +\ 2r\ell\omega\sin\theta\cos\omega t\dot{\theta} + \ell^2\sin^2\theta \dot{\theta}^2 \vphantom{\frac{1}{2}}\right]\\ &= \frac{1}{2} m r^2\omega^2 + \frac{1}{2} m\ell^2 \dot{\theta}^2 + mr\ell\omega \sin(\theta – \omega t)\dot{\theta} \end{aligned} T = 2 1 m v 2 = 2 1 m [ 2 1 x ˙ 2 + y ˙ 2 ] = 2 1 m [ 2 1 ( − r ω sin ω t + ℓ cos θ θ ˙ ) 2 + ( r ω cos ω t + ℓ sin θ θ ˙ ) 2 ] = 2 1 m [ 2 1 r 2 ω 2 sin 2 ω t − 2 r ℓ ω cos θ sin ω t θ ˙ + ℓ 2 cos 2 θ θ ˙ 2 + r 2 ω 2 cos 2 ω t + 2 r ℓ ω sin θ cos ω t θ ˙ + ℓ 2 sin 2 θ θ ˙ 2 2 1 ] = 2 1 m r 2 ω 2 + 2 1 m ℓ 2 θ ˙ 2 + m r ℓ ω sin ( θ – ω t ) θ ˙
Next, the potential energy :
V = m g h = m g r sin ω t – m g ℓ cos θ V = mgh = mgr \sin \omega t – mg \ell \cos \theta V = m g h = m g r sin ω t – m g ℓ cos θ
So the Lagrangian becomes:
L = T − V = 1 2 m r 2 ω 2 + 1 2 m ℓ 2 θ ˙ 2 + m r ℓ ω sin ( θ – ω t ) θ ˙ – m g r sin ω t + m g ℓ cos θ \begin{aligned} \mathcal{L} &= T\ -\ V\\ &= \frac{1}{2} m r^2\omega^2 + \frac{1}{2} m\ell^2 \dot{\theta}^2 + mr\ell\omega \sin(\theta – \omega t)\dot{\theta} – mgr \sin \omega t + mg \ell \cos \theta \end{aligned} L = T − V = 2 1 m r 2 ω 2 + 2 1 m ℓ 2 θ ˙ 2 + m r ℓ ω sin ( θ – ω t ) θ ˙ – m g r sin ω t + m g ℓ cos θ
Now taking some derivatives so that the equation of motion can be found:
∂ L ∂ θ ˙ = m ℓ 2 θ ˙ + m r ℓ ω sin ( θ – ω t ) d d t ( ∂ L ∂ θ ˙ ) = m ℓ 2 θ ¨ + m r ℓ ω cos ( θ – ω t ) ⋅ ( θ ˙ – ω ) = m ℓ 2 θ ¨ + m r ℓ ω cos ( θ – ω t ) θ ˙ − m r ℓ ω 2 cos ( θ – ω t ) ∂ L ∂ θ = m r ℓ ω cos ( θ – ω t ) θ ˙ − m g ℓ sin θ d d t ( ∂ L ∂ θ ˙ ) − ∂ L ∂ θ = m ℓ 2 θ ¨ − m r ℓ ω 2 cos ( θ – ω t ) + m g ℓ sin θ \begin{aligned} \frac{\partial \mathcal{L}}{\partial \dot{\theta}} &= m\ell^2 \dot{\theta}\ +\ mr\ell\omega \sin (\theta – \omega t) \\ \frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial \dot{\theta}} \right) &= m\ell^2 \ddot{\theta}\ +\ mr\ell\omega \cos (\theta – \omega t)\cdot(\dot{\theta} – \omega) \\ &= m\ell^2 \ddot{\theta}\ +\ mr\ell\omega \cos (\theta – \omega t)\dot{\theta}\ -\ mr\ell\omega^2 \cos (\theta – \omega t) \\ \frac{\partial \mathcal{L}}{\partial \theta} &= mr\ell\omega \cos (\theta – \omega t)\dot{\theta}\ -\ mg\ell\sin\theta \\ \frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial \dot{\theta}} \right)\ -\ \frac{\partial \mathcal{L}}{\partial \theta} &= m\ell^2 \ddot{\theta}\ -\ mr\ell\omega^2 \cos(\theta – \omega t) + mg\ell\sin\theta \end{aligned} ∂ θ ˙ ∂ L d t d ( ∂ θ ˙ ∂ L ) ∂ θ ∂ L d t d ( ∂ θ ˙ ∂ L ) − ∂ θ ∂ L = m ℓ 2 θ ˙ + m r ℓ ω sin ( θ – ω t ) = m ℓ 2 θ ¨ + m r ℓ ω cos ( θ – ω t ) ⋅ ( θ ˙ – ω ) = m ℓ 2 θ ¨ + m r ℓ ω cos ( θ – ω t ) θ ˙ − m r ℓ ω 2 cos ( θ – ω t ) = m r ℓ ω cos ( θ – ω t ) θ ˙ − m g ℓ sin θ = m ℓ 2 θ ¨ − m r ℓ ω 2 cos ( θ – ω t ) + m g ℓ sin θ
Then after dividing everything by m ℓ 2 m\ell^2 m ℓ 2 , the final equation of motion becomes:
θ ¨ − r ω 2 ℓ cos ( θ – ω t ) + g ℓ sin θ = 0 \ddot{\theta}\ -\ \frac{r\omega^2}{\ell} \cos(\theta – \omega t)\ +\ \frac{g}{\ell}\sin \theta\ =\ 0 θ ¨ − ℓ r ω 2 cos ( θ – ω t ) + ℓ g sin θ = 0
From the final equation of motion, there are two things to note: 1) the mass does not matter; 2) if r or ω \omega ω are 0, then the system reduces to a simple pendulum. Below is a small simulation of the system.
Click here to view in a separate tab.
Spring-Cart-Pendulum System
Classic problem involving a spring, pendulum, and horizontal motion. It is popular in the classroom , but I haven’t seen too many demos of it so I decided to make one here.
There are two things that are moving: the cart and the pendulum.
C a r t P o s i t i o n = x C a r t V e l o c i t y = x ˙ \mathsf{Cart\ Position} = x
\qquad\qquad
\mathsf{Cart\ Velocity} = \dot{x} C a r t P o s i t i o n = x C a r t V e l o c i t y = x ˙
For the pendulum we have:
P e n d u l u m P o s i t i o n : x = ℓ sin θ y = − ℓ cos θ P e n d u l u m V e l o c i t y : x ˙ = ℓ cos θ ⋅ θ ˙ y ˙ = ℓ sin θ ⋅ θ ˙ \begin{aligned}
\mathsf{Pendulum\ Position:}\ x &= \ell \sin \theta \\
y &= -\ell \cos \theta \\
\mathsf{Pendulum\ Velocity:}\ \dot{x} &= \ell \cos \theta \cdot \dot{\theta} \\
\dot{y} &= \ell \sin \theta \cdot \dot{\theta}
\end{aligned} P e n d u l u m P o s i t i o n : x y P e n d u l u m V e l o c i t y : x ˙ y ˙ = ℓ sin θ = − ℓ cos θ = ℓ cos θ ⋅ θ ˙ = ℓ sin θ ⋅ θ ˙
Note that since the pendulum is attached to the cart it can move horizontally. Therefore, the total pendulum x x x velocity becomes:
x ˙ t o t a l = x ˙ c a r t + x ˙ p e n d u l u m = x ˙ + ℓ cos θ ⋅ θ ˙ \begin{aligned}
\dot{x}_{\mathsf{total}} &= \dot{x}_{\mathsf{cart}} + \dot{x}_{\mathsf{pendulum}} \\
&= \dot{x} + \ell \cos \theta \cdot \dot{\theta}
\end{aligned} x ˙ t o t a l = x ˙ c a r t + x ˙ p e n d u l u m = x ˙ + ℓ cos θ ⋅ θ ˙
The kinetic energy is then:
T = 1 2 m v 2 = ( 1 2 m v 2 ) c a r t + ( 1 2 m v 2 ) p e n d u l u m = 1 2 m 1 x ˙ 2 + 1 2 m 2 [ ( x ˙ + ℓ cos θ ⋅ θ ˙ ) 2 + ( ℓ sin θ ⋅ θ ˙ ) 2 ] = 1 2 m 1 x ˙ 2 + 1 2 m 2 [ x ˙ 2 + 2 ℓ cos θ x ˙ θ ˙ + ℓ 2 cos 2 θ θ ˙ 2 + ℓ 2 sin 2 θ θ ˙ 2 ] = 1 2 ( m 1 + m 2 ) x ˙ 2 + m 2 ℓ cos θ x ˙ θ ˙ + 1 2 m 2 ℓ 2 θ ˙ 2 \begin{aligned}
T &= \frac{1}{2} mv^2 \\
&= \left(\frac{1}{2} mv^2\right)_{\mathsf{cart}} + \left(\frac{1}{2} mv^2\right)_{\mathsf{pendulum}} \\
&= \frac{1}{2} m_1 \dot{x}^2
+\ \frac{1}{2} m_2 \left[ \left( \dot{x} + \ell\cos\theta\cdot\dot{\theta} \right)^2 + \left(\ell\sin\theta\cdot\dot{\theta}\right)^2\right] \\
&= \frac{1}{2} m_1 \dot{x}^2
+ \frac{1}{2} m_2 \left[ \dot{x}^2 + 2\ell\cos\theta\dot{x}\dot{\theta} + \ell^2\cos^2\theta\dot{\theta}^2 + \ell^2\sin^2\theta\dot{\theta}^2 \right] \\
&= \frac{1}{2} (m_1 + m_2) \dot{x}^2\ +\ m_2\ell\cos\theta\dot{x}\dot{\theta}\ +\ \frac{1}{2}m_2\ell^2\dot{\theta}^2
\end{aligned} T = 2 1 m v 2 = ( 2 1 m v 2 ) c a r t + ( 2 1 m v 2 ) p e n d u l u m = 2 1 m 1 x ˙ 2 + 2 1 m 2 [ ( x ˙ + ℓ cos θ ⋅ θ ˙ ) 2 + ( ℓ sin θ ⋅ θ ˙ ) 2 ] = 2 1 m 1 x ˙ 2 + 2 1 m 2 [ x ˙ 2 + 2 ℓ cos θ x ˙ θ ˙ + ℓ 2 cos 2 θ θ ˙ 2 + ℓ 2 sin 2 θ θ ˙ 2 ] = 2 1 ( m 1 + m 2 ) x ˙ 2 + m 2 ℓ cos θ x ˙ θ ˙ + 2 1 m 2 ℓ 2 θ ˙ 2
V = V c a r t + V p e n d u l u m = 1 2 k ( C a r t P o s i t i o n ) 2 + m g ( P e n d u l u m y P o s i t i o n ) = 1 2 k x 2 + m g ( − ℓ cos θ ) = 1 2 k x 2 − m 2 g ℓ cos θ \begin{aligned}
V &= V_{\mathsf{cart}} + V_{\mathsf{pendulum}} \\
&= \frac{1}{2}k(\mathsf{Cart\ Position})^2\ +\ mg (\mathsf{Pendulum}\ y\ \mathsf{Position}) \\
&= \frac{1}{2}kx^2\ +\ mg (-\ell \cos \theta) \\
&= \frac{1}{2}kx^2\ -\ m_2 g \ell \cos \theta
\end{aligned} V = V c a r t + V p e n d u l u m = 2 1 k ( C a r t P o s i t i o n ) 2 + m g ( P e n d u l u m y P o s i t i o n ) = 2 1 k x 2 + m g ( − ℓ cos θ ) = 2 1 k x 2 − m 2 g ℓ cos θ
L = T − V = 1 2 ( m 1 + m 2 ) x ˙ 2 + m 2 ℓ cos θ x ˙ θ ˙ + 1 2 m 2 ℓ 2 θ ˙ 2 − 1 2 k x 2 + m 2 g ℓ cos θ \begin{aligned}
L &= T\ -\ V \\
&= \frac{1}{2} (m_1 + m_2) \dot{x}^2\ +\ m_2\ell\cos\theta\dot{x}\dot{\theta}\ +\ \frac{1}{2}m_2\ell^2\dot{\theta}^2
-\ \frac{1}{2}kx^2\ +\ m_2 g \ell \cos \theta
\end{aligned} L = T − V = 2 1 ( m 1 + m 2 ) x ˙ 2 + m 2 ℓ cos θ x ˙ θ ˙ + 2 1 m 2 ℓ 2 θ ˙ 2 − 2 1 k x 2 + m 2 g ℓ cos θ
Since we have two variables (x and θ x\ \text{and}\ \theta x and θ ), we will have two equations of motion. Solving for x x x first:
∂ L ∂ x ˙ = ( m 1 + m 2 ) x ˙ + m 2 ℓ cos θ θ ˙ d d t ( ∂ L ∂ x ˙ ) = ( m 1 + m 2 ) x ¨ + m 2 ℓ cos θ θ ¨ − m 2 ℓ sin θ θ ˙ 2 ∂ L ∂ x = – k x d d t ( ∂ L ∂ x ˙ ) − ∂ L ∂ x = ( m 1 + m 2 ) x ¨ + m 2 ℓ cos θ θ ¨ − m 2 ℓ sin θ θ ˙ 2 + k x \begin{aligned}
\frac{\partial \mathcal{L}}{\partial \dot{x}} &= (m_1 + m_2)\dot{x}\ +\ m_2\ell\cos\theta\dot{\theta} \\
\frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial \dot{x}} \right) &= (m_1 + m_2)\ddot{x}\ +\ m_2\ell\cos\theta\ddot{\theta} \ -\ m_2\ell\sin\theta\dot{\theta}^2 \\
\frac{\partial \mathcal{L}}{\partial x} &= – kx \\
\frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial \dot{x}} \right)\ -\ \frac{\partial \mathcal{L}}{\partial x} &=
(m_1 + m_2)\ddot{x}\ +\ m_2\ell\cos\theta\ddot{\theta}\ -\ m_2\ell\sin\theta\dot{\theta}^2\ +\ kx
\end{aligned} ∂ x ˙ ∂ L d t d ( ∂ x ˙ ∂ L ) ∂ x ∂ L d t d ( ∂ x ˙ ∂ L ) − ∂ x ∂ L = ( m 1 + m 2 ) x ˙ + m 2 ℓ cos θ θ ˙ = ( m 1 + m 2 ) x ¨ + m 2 ℓ cos θ θ ¨ − m 2 ℓ sin θ θ ˙ 2 = – k x = ( m 1 + m 2 ) x ¨ + m 2 ℓ cos θ θ ¨ − m 2 ℓ sin θ θ ˙ 2 + k x
Now dealing with θ \theta θ :
∂ L ∂ θ ˙ = m 2 ℓ cos θ x ˙ + m 2 ℓ 2 θ ˙ d d t ( ∂ L ∂ θ ˙ ) = m 2 ℓ cos θ x ¨ – m 2 ℓ sin θ x ˙ θ ˙ + m 2 ℓ 2 θ ¨ ∂ L ∂ θ = − m 2 ℓ sin θ x ˙ θ ˙ – m 2 g ℓ sin θ = – [ m 2 ℓ sin θ x ˙ θ ˙ + m 2 g ℓ sin θ ] d d t ( ∂ L ∂ θ ˙ ) − ∂ L ∂ θ = m 2 ℓ cos θ x ¨ − m 2 ℓ sin θ x ˙ θ ˙ + m 2 ℓ 2 θ ¨ + m 2 ℓ sin θ x ˙ θ ˙ + m 2 g ℓ sin θ = m 2 ℓ cos θ x ¨ + m 2 ℓ 2 θ ¨ + m 2 g ℓ sin θ \begin{aligned}
\frac{\partial \mathcal{L}}{\partial \dot{\theta}} &= m_2\ell\cos\theta\dot{x} + m_2\ell^2\dot{\theta} \\
\frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial \dot{\theta}} \right) &= m_2\ell\cos\theta\ddot{x} – m_2\ell\sin\theta\dot{x}\dot{\theta}
+ m_2\ell^2\ddot{\theta} \\
\frac{\partial \mathcal{L}}{\partial \theta} &= -m_2\ell\sin\theta\dot{x}\dot{\theta} – m_2g\ell\sin\theta \\
&= – \left[ m_2\ell\sin\theta\dot{x}\dot{\theta} + m_2g\ell\sin\theta \right] \\
\frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial \dot{\theta}} \right)\ -\ \frac{\partial \mathcal{L}}{\partial \theta} &=
m_2\ell\cos\theta\ddot{x}\ -\ m_2\ell\sin\theta\dot{x}\dot{\theta}\ +\ m_2\ell^2\ddot{\theta} \\
&\qquad +\ m_2\ell\sin\theta\dot{x}\dot{\theta}\ +\ m_2g\ell\sin\theta \\
&= m_2\ell\cos\theta\ddot{x}\ +\ m_2\ell^2\ddot{\theta}\ +\ m_2g\ell\sin\theta \\
\end{aligned} ∂ θ ˙ ∂ L d t d ( ∂ θ ˙ ∂ L ) ∂ θ ∂ L d t d ( ∂ θ ˙ ∂ L ) − ∂ θ ∂ L = m 2 ℓ cos θ x ˙ + m 2 ℓ 2 θ ˙ = m 2 ℓ cos θ x ¨ – m 2 ℓ sin θ x ˙ θ ˙ + m 2 ℓ 2 θ ¨ = − m 2 ℓ sin θ x ˙ θ ˙ – m 2 g ℓ sin θ = – [ m 2 ℓ sin θ x ˙ θ ˙ + m 2 g ℓ sin θ ] = m 2 ℓ cos θ x ¨ − m 2 ℓ sin θ x ˙ θ ˙ + m 2 ℓ 2 θ ¨ + m 2 ℓ sin θ x ˙ θ ˙ + m 2 g ℓ sin θ = m 2 ℓ cos θ x ¨ + m 2 ℓ 2 θ ¨ + m 2 g ℓ sin θ
Therefore, the final equations of motion are:
( m 1 + m 2 ) x ¨ + m 2 ℓ cos θ θ ¨ − m 2 ℓ sin θ θ ˙ 2 + k x = 0 m 2 ℓ cos θ x ¨ + m 2 ℓ 2 θ ¨ + m 2 g ℓ sin θ = 0 \begin{aligned}
(m_1 + m_2)\ddot{x}\ +\ m_2\ell\cos\theta\ddot{\theta}\ -\ m_2\ell\sin\theta\dot{\theta}^2\ +\ kx &= 0 \\
m_2\ell\cos\theta\ddot{x}\ +\ m_2\ell^2\ddot{\theta}\ +\ m_2g\ell\sin\theta &= 0
\end{aligned} ( m 1 + m 2 ) x ¨ + m 2 ℓ cos θ θ ¨ − m 2 ℓ sin θ θ ˙ 2 + k x m 2 ℓ cos θ x ¨ + m 2 ℓ 2 θ ¨ + m 2 g ℓ sin θ = 0 = 0
Solving using some matrix magic:
[ m 1 + m 2 m 2 ℓ cos θ m 2 ℓ cos θ m 2 ℓ 2 ] [ x ¨ θ ¨ ] = [ m 2 ℓ sin θ θ ˙ 2 − k x − m 2 g ℓ sin θ ] [ x ¨ θ ¨ ] = [ m 1 + m 2 m 2 ℓ cos θ m 2 ℓ cos θ m 2 ℓ 2 ] − 1 [ m 2 ℓ sin θ θ ˙ 2 − k x − m 2 g ℓ sin θ ] \begin{aligned}
\left[
\begin{array}{cc} m_1 + m_2 & m_2\ell\cos\theta \\
m_2\ell\cos\theta & m_2\ell^2
\end{array}
\right]
\left[
\begin{array}{c} \ddot{x} \\ \ddot{\theta}
\end{array}
\right]
&=
\left[
\begin{array}{c}
m_2\ell\sin\theta\dot{\theta}^2\ -\ kx \\ -m_2g\ell\sin\theta
\end{array}
\right] \\
\left[
\begin{array}{c} \ddot{x} \\ \ddot{\theta}
\end{array}
\right]
&=
\left[
\begin{array}{cc} m_1 + m_2 & m_2\ell\cos\theta \\
m_2\ell\cos\theta & m_2\ell^2
\end{array}
\right]^{-1}
\left[
\begin{array}{c}
m_2\ell\sin\theta\dot{\theta}^2\ -\ kx \\ -m_2g\ell\sin\theta
\end{array}
\right]
\end{aligned} [ m 1 + m 2 m 2 ℓ cos θ m 2 ℓ cos θ m 2 ℓ 2 ] [ x ¨ θ ¨ ] [ x ¨ θ ¨ ] = [ m 2 ℓ sin θ θ ˙ 2 − k x − m 2 g ℓ sin θ ] = [ m 1 + m 2 m 2 ℓ cos θ m 2 ℓ cos θ m 2 ℓ 2 ] − 1 [ m 2 ℓ sin θ θ ˙ 2 − k x − m 2 g ℓ sin θ ]
The final equations are then used when numerically solving the system. Below is a simple simulation of the using the above equations.
Click here to view in a separate tab.
Triple Pendulum
Here the triple pendulum is solved, since I have already solved the simple and double pendulum problems. Perhaps in the future, I will tackle the n -link pendulum problem (oh to dare to dream).
The geometry of the pendulum in this video is slightly different than the one in my solution, however the video is ridiculous (I can’t believe that I search youtube for such things).
The math is not hard, just lengthy. So first looking at the positions of the masses:
x 1 = ℓ 1 sin θ 1 y 1 = − ℓ 1 cos θ 1 x 2 = ℓ 1 sin θ 1 + ℓ 2 sin θ 2 = x 1 + ℓ 2 sin θ 2 y 2 = − ℓ 1 cos θ 1 – ℓ 2 cos θ 2 = y 2 – ℓ 2 cos θ 2 x 3 = ℓ 1 sin θ 1 + ℓ 2 sin θ 2 + ℓ 3 sin θ 3 = x 2 + ℓ 3 sin θ 3 y 3 = − ℓ 1 cos θ 1 – ℓ 2 cos θ 2 – ℓ 3 cos θ 3 = y 2 – ℓ 3 cos θ 3 \begin{aligned}
x_1 &= \ell_1 \sin \theta_1 \\
y_1 &= -\ell_1 \cos \theta_1 \\
x_2 &= \ell_1 \sin \theta_1 + \ell_2 \sin \theta_2
= x_1 + \ell_2 \sin \theta_2 \\
y_2 &= -\ell_1 \cos \theta_1 – \ell_2 \cos \theta_2
= y_2 – \ell_2 \cos \theta_2 \\
x_3 &= \ell_1 \sin \theta_1 + \ell_2 \sin \theta_2 + \ell_3 \sin \theta_3
= x_2 + \ell_3 \sin \theta_3 \\
y_3 &= -\ell_1 \cos \theta_1 – \ell_2 \cos \theta_2 – \ell_3 \cos \theta_3
= y_2 – \ell_3 \cos \theta_3
\end{aligned} x 1 y 1 x 2 y 2 x 3 y 3 = ℓ 1 sin θ 1 = − ℓ 1 cos θ 1 = ℓ 1 sin θ 1 + ℓ 2 sin θ 2 = x 1 + ℓ 2 sin θ 2 = − ℓ 1 cos θ 1 – ℓ 2 cos θ 2 = y 2 – ℓ 2 cos θ 2 = ℓ 1 sin θ 1 + ℓ 2 sin θ 2 + ℓ 3 sin θ 3 = x 2 + ℓ 3 sin θ 3 = − ℓ 1 cos θ 1 – ℓ 2 cos θ 2 – ℓ 3 cos θ 3 = y 2 – ℓ 3 cos θ 3
Note that succeeding positions can be found using the previous position; this makes writing the code a bit easier. Then the speeds of the masses can be found by taking the derivatives:
x ˙ 1 = ℓ 1 cos θ 1 ⋅ θ ˙ 1 y ˙ 1 = ℓ 1 sin θ 1 ⋅ θ ˙ 1 x ˙ 2 = ℓ 1 cos θ 1 ⋅ θ ˙ 1 + ℓ 2 cos θ 2 ⋅ θ ˙ 2 y ˙ 2 = ℓ 1 sin θ 1 ⋅ θ ˙ 1 + ℓ 2 sin θ 2 ⋅ θ ˙ 2 x ˙ 3 = ℓ 1 cos θ 1 ⋅ θ ˙ 1 + ℓ 2 cos θ 2 ⋅ θ ˙ 2 + ℓ 3 cos θ 3 ⋅ θ ˙ 3 y ˙ 3 = ℓ 1 sin θ 1 ⋅ θ ˙ 1 + ℓ 2 sin θ 2 ⋅ θ ˙ 2 + ℓ 3 sin θ 3 ⋅ θ ˙ 3 \begin{aligned}
\dot{x}_1 &= \ell_1 \cos \theta_1 \cdot \dot{\theta}_1 \\
\dot{y}_1 &= \ell_1 \sin \theta_1 \cdot \dot{\theta}_1 \\
\dot{x}_2 &= \ell_1 \cos \theta_1 \cdot \dot{\theta}_1 + \ell_2 \cos \theta_2 \cdot \dot{\theta}_2 \\
\dot{y}_2 &= \ell_1 \sin \theta_1 \cdot \dot{\theta}_1 + \ell_2 \sin \theta_2 \cdot \dot{\theta}_2 \\
\dot{x}_3 &= \ell_1 \cos \theta_1 \cdot \dot{\theta}_1 + \ell_2 \cos \theta_2 \cdot \dot{\theta}_2 + \ell_3 \cos \theta_3 \cdot \dot{\theta}_3 \\
\dot{y}_3 &= \ell_1 \sin \theta_1 \cdot \dot{\theta}_1 + \ell_2 \sin \theta_2 \cdot \dot{\theta}_2 + \ell_3 \sin \theta_3 \cdot \dot{\theta}_3
\end{aligned} x ˙ 1 y ˙ 1 x ˙ 2 y ˙ 2 x ˙ 3 y ˙ 3 = ℓ 1 cos θ 1 ⋅ θ ˙ 1 = ℓ 1 sin θ 1 ⋅ θ ˙ 1 = ℓ 1 cos θ 1 ⋅ θ ˙ 1 + ℓ 2 cos θ 2 ⋅ θ ˙ 2 = ℓ 1 sin θ 1 ⋅ θ ˙ 1 + ℓ 2 sin θ 2 ⋅ θ ˙ 2 = ℓ 1 cos θ 1 ⋅ θ ˙ 1 + ℓ 2 cos θ 2 ⋅ θ ˙ 2 + ℓ 3 cos θ 3 ⋅ θ ˙ 3 = ℓ 1 sin θ 1 ⋅ θ ˙ 1 + ℓ 2 sin θ 2 ⋅ θ ˙ 2 + ℓ 3 sin θ 3 ⋅ θ ˙ 3
Now solving for the kinetic energy :
T = 1 2 m v 2 = 1 2 m ( x ˙ 2 + y ˙ 2 ) 2 = 1 2 m 1 ( x ˙ 1 2 + y ˙ 1 2 ) + 1 2 m 2 ( x ˙ 2 2 + y ˙ 2 2 ) + 1 2 m 3 ( x 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θ ˙ 3 ( cos θ 1 cos θ 3 + sin θ 1 sin θ 3 ) + m 3 ℓ 2 ℓ 3 θ ˙ 2 θ ˙ 3 ( cos θ 2 cos θ 3 + sin θ 2 sin θ 3 ) = 1 2 ( m 1 + m 2 + m 3 ) ℓ 1 2 θ ˙ 1 2 + 1 2 ( m 2 + m 3 ) ℓ 2 2 θ ˙ 2 2 + 1 2 m 3 ℓ 3 2 θ ˙ 3 2 + ( m 2 + m 3 ) ℓ 1 ℓ 2 θ ˙ 1 θ ˙ 2 cos ( θ 1 – θ 2 ) + m 3 ℓ 1 ℓ 3 θ ˙ 1 θ ˙ 3 cos ( θ 1 – θ 3 ) + m 3 ℓ 2 ℓ 3 θ ˙ 2 θ ˙ 3 cos ( θ 2 – θ 3 ) \begin{aligned}
T &= \frac{1}{2} mv^2 = \frac{1}{2} m \left( \sqrt{\dot{x}^2 + \dot{y}^2 }\right)^2 \\
&= \frac{1}{2} m_1 \left( \dot{x}_1^2 + \dot{y}_1^2 \right) + \frac{1}{2} m_2 \left( \dot{x}_2^2 + \dot{y}_2^2 \right) + \frac{1}{2} m_3 \left( \dot{x}_3^2 + \dot{y}_3^2 \right) \\
&= \frac{1}{2} m_1 \left[ \left( \ell_1 \cos \theta_1 \cdot \dot{\theta}_1 \right)^2
+ \left( \ell_1 \sin \theta_1 \cdot \dot{\theta}_1 \right)^2 \right] \\
& \qquad + \frac{1}{2} m_2 \left[ \left( \ell_1 \cos \theta_1 \cdot \dot{\theta}_1 + \ell_2 \cos \theta_2 \cdot \dot{\theta}_2 \right)^2
+ \left( \ell_1 \sin \theta_1 \cdot \dot{\theta}_1 + \ell_2 \sin \theta_2 \cdot \dot{\theta}_2 \right)^2 \right] \\
& \qquad + \frac{1}{2} m_3 \left[ \left ( \ell_1 \cos \theta_1 \cdot \dot{\theta}_1 + \ell_2 \cos \theta_2 \cdot \dot{\theta}_2 + \ell_3 \cos \theta_3 \cdot \dot{\theta}_3 \right)^2
+ \left( \ell_1 \sin \theta_1 \cdot \dot{\theta}_1 + \ell_2 \sin \theta_2 \cdot \dot{\theta}_2 + \ell_3 \sin \theta_3 \cdot \dot{\theta}_3 \right)^2 \right] \\
&= \frac{1}{2} m_1 \left[ \ell_1^2 \cos^2 \theta_1 \cdot \dot{\theta}_1^2 + \ell_1^2 \sin^2 \theta_1 \cdot \dot{\theta}_1^2 \right] \\
& \qquad + \frac{1}{2} m_2 \left[ \ell_1^2 \cos^2 \theta_1 \cdot \dot{\theta}_1^2
+ 2\ell_1\ell_2 \cos \theta_1 \cos \theta_2 \cdot \dot{\theta}_1 \dot{\theta}_2
+ \ell_2^2 \cos^2 \theta_2 \cdot \dot{\theta}_2^2 \right. \\
& \qquad \qquad \qquad \left. + \ell_1^2 \sin^2 \theta_1 \cdot \dot{\theta}_1^2
+ 2\ell_1\ell_2 \sin \theta_1 \sin \theta_2 \cdot \dot{\theta}_1 \dot{\theta}_2
+ \ell_2^2 \sin^2 \theta_2 \cdot \dot{\theta}_2^2 \right] \\
& \qquad + \frac{1}{2} m_3 \left[ \ell_1^2 \cos^2 \theta_1 \cdot \dot{\theta}_1^2
+ \ell_2^2 \cos^2 \theta_2 \cdot \dot{\theta}_2^2 + \ell_3^2 \cos^2 \theta_3 \cdot \dot{\theta}_3^2
+ \ell_1^2 \sin^2 \theta_1 \cdot \dot{\theta}_1^2
+ \ell_2^2 \sin^2 \theta_2 \cdot \dot{\theta}_2^2 + \ell_3^2 \sin^2 \theta_3 \cdot \dot{\theta}_3^2 \right. \\
& \qquad \qquad \qquad + 2 \ell_1\ell_2 \cos\theta_1\cos \theta_2 \cdot \dot{\theta}_1 \dot{\theta}_2
+ 2 \ell_1\ell_3 \cos\theta_1\cos \theta_3 \cdot \dot{\theta}_1 \dot{\theta}_3
+ 2 \ell_2\ell_3 \cos\theta_2\cos \theta_3 \cdot \dot{\theta}_2 \dot{\theta}_3 \\
& \qquad \qquad \qquad \left. + 2 \ell_1\ell_2 \sin\theta_1\sin \theta_2 \cdot \dot{\theta}_1 \dot{\theta}_2
+ 2 \ell_1\ell_3 \sin\theta_1\sin \theta_3 \cdot \dot{\theta}_1 \dot{\theta}_3
+ 2 \ell_2\ell_3 \sin\theta_2\sin \theta_3 \cdot \dot{\theta}_2 \dot{\theta}_3 \vphantom{\ell_2^2} \right] \\
&= \frac{1}{2} m_1 \left( \ell_1^2 \dot{\theta}_1^2 \right) \\
& \qquad + \frac{1}{2} m_2 \left( \ell_1^2 \dot{\theta}_1^2 + \ell_2^2\dot{\theta}_2^2 \right. \\
& \qquad \qquad \qquad \left. + 2\ell_1\ell_2\dot{\theta}_1\dot{\theta}_2\left(\cos\theta_1\cos \theta_2 + \sin\theta_1\sin \theta_2\right) \vphantom{\ell_2^2} \right) \\
& \qquad + \frac{1}{2} m_3 \left( \ell_1^2 \dot{\theta}_1^2 + \ell_2^2 \dot{\theta}_2^2 + \ell_3^2 \dot{\theta}_3^2 \right. \\
& \qquad \qquad \qquad + 2\ell_1\ell_2\dot{\theta}_1\dot{\theta}_2\left(\cos\theta_1\cos \theta_2 + \sin\theta_1\sin \theta_2\right) \\
& \qquad \qquad \qquad + 2\ell_1\ell_3\dot{\theta}_1\dot{\theta}_3\left(\cos\theta_1\cos \theta_3 + \sin\theta_1\sin \theta_3\right) \\
& \qquad \qquad \qquad \left. + 2\ell_2\ell_3\dot{\theta}_2\dot{\theta}_3\left(\cos\theta_2\cos \theta_3 + \sin\theta_2\sin \theta_3\right) \vphantom{\ell_2^2} \right) \\
&= \frac{1}{2} \left( m_1 + m_2 + m_3 \right) \ell_1^2 \dot{\theta}_1^2
+ \frac{1}{2} \left( m_2 + m_3 \right) \ell_2^2 \dot{\theta}_2^2
+ \frac{1}{2} m_3 \ell_3^2 \dot{\theta}_3^2 \\
& \qquad + \left( m_2 + m_3 \right) \ell_1\ell_2\dot{\theta}_1\dot{\theta}_2\left(\cos\theta_1\cos \theta_2 + \sin\theta_1\sin \theta_2\right) \\
& \qquad + m_3 \ell_1\ell_3\dot{\theta}_1\dot{\theta}_3\left(\cos\theta_1\cos \theta_3 + \sin\theta_1\sin \theta_3\right)
+ m_3 \ell_2\ell_3\dot{\theta}_2\dot{\theta}_3\left(\cos\theta_2\cos \theta_3 + \sin\theta_2\sin \theta_3\right) \\
&= \frac{1}{2} \left( m_1 + m_2 + m_3 \right) \ell_1^2 \dot{\theta}_1^2
+ \frac{1}{2} \left( m_2 + m_3 \right) \ell_2^2 \dot{\theta}_2^2
+ \frac{1}{2} m_3 \ell_3^2 \dot{\theta}_3^2 \\
& \qquad + \left( m_2 + m_3 \right) \ell_1\ell_2\dot{\theta}_1\dot{\theta}_2 \cos (\theta_1 – \theta_2)
+ m_3 \ell_1\ell_3\dot{\theta}_1\dot{\theta}_3 \cos(\theta_1 – \theta_3)
+ m_3 \ell_2\ell_3\dot{\theta}_2\dot{\theta}_3 \cos(\theta_2 – \theta_3) \\
\end{aligned} T = 2 1 m v 2 = 2 1 m ( x ˙ 2 + y ˙ 2 ) 2 = 2 1 m 1 ( x ˙ 1 2 + y ˙ 1 2 ) + 2 1 m 2 ( x ˙ 2 2 + y ˙ 2 2 ) + 2 1 m 3 ( x ˙ 3 2 + y ˙ 3 2 ) = 2 1 m 1 [ ( ℓ 1 cos θ 1 ⋅ θ ˙ 1 ) 2 + ( ℓ 1 sin θ 1 ⋅ θ ˙ 1 ) 2 ] + 2 1 m 2 [ ( ℓ 1 cos θ 1 ⋅ θ ˙ 1 + ℓ 2 cos θ 2 ⋅ θ ˙ 2 ) 2 + ( ℓ 1 sin θ 1 ⋅ θ ˙ 1 + ℓ 2 sin θ 2 ⋅ θ ˙ 2 ) 2 ] + 2 1 m 3 [ ( ℓ 1 cos θ 1 ⋅ θ ˙ 1 + ℓ 2 cos θ 2 ⋅ θ ˙ 2 + ℓ 3 cos θ 3 ⋅ θ ˙ 3 ) 2 + ( ℓ 1 sin θ 1 ⋅ θ ˙ 1 + ℓ 2 sin θ 2 ⋅ θ ˙ 2 + ℓ 3 sin θ 3 ⋅ θ ˙ 3 ) 2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 cos θ 1 ) + m 2 g ( − ℓ 1 cos θ 1 – ℓ 2 cos θ 2 ) + m 3 g ( − ℓ 1 cos θ 1 – ℓ 2 cos θ 2 – ℓ 3 cos θ 3 ) = − 1 [ 1 1 ( m 1 + m 2 + m 3 ) g ℓ 1 cos θ 1 + ( m 2 + m 3 ) g ℓ 2 cos θ 2 + m 3 g ℓ 3 cos θ 3 ] \begin{aligned}
V = mgh &= m_1 g y_1 + m_2 g y_2 + m_3 g y_3 \\
&= m_1 g \left( -\ell_1 \cos \theta_1 \right)
+ m_2 g \left( -\ell_1 \cos \theta_1 – \ell_2 \cos \theta_2 \right)
+ m_3 g \left( -\ell_1 \cos \theta_1 – \ell_2 \cos \theta_2 – \ell_3 \cos \theta_3 \right) \\
&= -1 \left[ \vphantom{\frac{1}{1}} (m_1 + m_2 + m_3)g \ell_1 \cos \theta_1 + (m_2 + m_3) g \ell_2 \cos \theta_2 + m_3 g \ell_3 \cos \theta_3 \right] \\
\end{aligned} V = m g h = m 1 g y 1 + m 2 g y 2 + m 3 g y 3 = m 1 g ( − ℓ 1 cos θ 1 ) + m 2 g ( − ℓ 1 cos θ 1 – ℓ 2 cos θ 2 ) + m 3 g ( − ℓ 1 cos θ 1 – ℓ 2 cos θ 2 – ℓ 3 cos θ 3 ) = − 1 [ 1 1 ( m 1 + m 2 + m 3 ) g ℓ 1 cos θ 1 + ( m 2 + m 3 ) g ℓ 2 cos θ 2 + m 3 g ℓ 3 cos θ 3 ]
Now computing the Lagrangian :
L = T – V = [ 1 2 ( m 1 + m 2 + m 3 ) ℓ 1 2 θ ˙ 1 2 + 1 2 ( m 2 + m 3 ) ℓ 2 2 θ ˙ 2 2 + 1 2 m 3 ℓ 3 2 θ ˙ 3 2 + ( m 2 + m 3 ) ℓ 1 ℓ 2 θ ˙ 1 θ ˙ 2 cos ( θ 1 – θ 2 ) + m 3 ℓ 1 ℓ 3 θ ˙ 1 θ ˙ 3 cos ( θ 1 – θ 3 ) + m 3 ℓ 2 ℓ 3 θ ˙ 2 θ ˙ 3 cos ( θ 2 – θ 3 ) 1 1 ] – ( − 1 ) [ 1 1 ( m 1 + m 2 + m 3 ) g ℓ 1 cos θ 1 + ( m 2 + m 3 ) g ℓ 2 cos θ 2 + m 3 g ℓ 3 cos θ 3 ] = 1 2 ( m 1 + m 2 + m 3 ) ℓ 1 2 θ ˙ 1 2 + 1 2 ( m 2 + m 3 ) ℓ 2 2 θ ˙ 2 2 + 1 2 m 3 ℓ 3 2 θ ˙ 3 2 + ( m 2 + m 3 ) ℓ 1 ℓ 2 θ ˙ 1 θ ˙ 2 cos ( θ 1 – θ 2 ) + m 3 ℓ 1 ℓ 3 θ ˙ 1 θ ˙ 3 cos ( θ 1 – θ 3 ) + m 3 ℓ 2 ℓ 3 θ ˙ 2 θ ˙ 3 cos ( θ 2 – θ 3 ) + ( m 1 + m 2 + m 3 ) g ℓ 1 cos θ 1 + ( m 2 + m 3 ) g ℓ 2 cos θ 2 + m 3 g ℓ 3 cos θ 3 \begin{aligned}
\mathcal{L} &= T – V \\
&= \left[ \frac{1}{2} \left( m_1 + m_2 + m_3 \right) \ell_1^2 \dot{\theta}_1^2
+ \frac{1}{2} \left( m_2 + m_3 \right) \ell_2^2 \dot{\theta}_2^2
+ \frac{1}{2} m_3 \ell_3^2 \dot{\theta}_3^2 \right. \\
& \qquad \left. + \left( m_2 + m_3 \right) \ell_1\ell_2\dot{\theta}_1\dot{\theta}_2 \cos (\theta_1 – \theta_2)
+ m_3 \ell_1\ell_3\dot{\theta}_1\dot{\theta}_3 \cos(\theta_1 – \theta_3)
+ m_3 \ell_2\ell_3\dot{\theta}_2\dot{\theta}_3 \cos(\theta_2 – \theta_3) \vphantom{\frac{1}{1}} \right] \\
& \qquad – (-1) \left[ \vphantom{\frac{1}{1}} (m_1 + m_2 + m_3)g \ell_1 \cos \theta_1 + (m_2 + m_3) g \ell_2 \cos \theta_2 + m_3 g \ell_3 \cos \theta_3 \right] \\
&= \frac{1}{2} \left( m_1 + m_2 + m_3 \right) \ell_1^2 \dot{\theta}_1^2
+ \frac{1}{2} \left( m_2 + m_3 \right) \ell_2^2 \dot{\theta}_2^2
+ \frac{1}{2} m_3 \ell_3^2 \dot{\theta}_3^2 \\
& \qquad + \left( m_2 + m_3 \right) \ell_1\ell_2\dot{\theta}_1\dot{\theta}_2 \cos (\theta_1 – \theta_2)
+ m_3 \ell_1\ell_3\dot{\theta}_1\dot{\theta}_3 \cos(\theta_1 – \theta_3)
+ m_3 \ell_2\ell_3\dot{\theta}_2\dot{\theta}_3 \cos(\theta_2 – \theta_3) \\
& \qquad + (m_1 + m_2 + m_3)g \ell_1 \cos \theta_1 + (m_2 + m_3) g \ell_2 \cos \theta_2 + m_3 g \ell_3 \cos \theta_3 \\
\end{aligned} L = T – V = [ 2 1 ( m 1 + m 2 + m 3 ) ℓ 1 2 θ ˙ 1 2 + 2 1 ( m 2 + m 3 ) ℓ 2 2 θ ˙ 2 2 + 2 1 m 3 ℓ 3 2 θ ˙ 3 2 + ( m 2 + m 3 ) ℓ 1 ℓ 2 θ ˙ 1 θ ˙ 2 cos ( θ 1 – θ 2 ) + m 3 ℓ 1 ℓ 3 θ ˙ 1 θ ˙ 3 cos ( θ 1 – θ 3 ) + m 3 ℓ 2 ℓ 3 θ ˙ 2 θ ˙ 3 cos ( θ 2 – θ 3 ) 1 1 ] – ( − 1 ) [ 1 1 ( m 1 + m 2 + m 3 ) g ℓ 1 cos θ 1 + ( m 2 + m 3 ) g ℓ 2 cos θ 2 + m 3 g ℓ 3 cos θ 3 ] = 2 1 ( m 1 + m 2 + m 3 ) ℓ 1 2 θ ˙ 1 2 + 2 1 ( m 2 + m 3 ) ℓ 2 2 θ ˙ 2 2 + 2 1 m 3 ℓ 3 2 θ ˙ 3 2 + ( m 2 + m 3 ) ℓ 1 ℓ 2 θ ˙ 1 θ ˙ 2 cos ( θ 1 – θ 2 ) + m 3 ℓ 1 ℓ 3 θ ˙ 1 θ ˙ 3 cos ( θ 1 – θ 3 ) + m 3 ℓ 2 ℓ 3 θ ˙ 2 θ ˙ 3 cos ( θ 2 – θ 3 ) + ( m 1 + m 2 + m 3 ) g ℓ 1 cos θ 1 + ( m 2 + m 3 ) g ℓ 2 cos θ 2 + m 3 g ℓ 3 cos θ 3
There are a three degrees of freedom, that is θ 1 , θ 2 , and θ 3 \theta_1, \theta_2,\ \text{and}\ \theta_3 θ 1 , θ 2 , and θ 3 . So to determine the equations of motions, we need to compute:
d d t ( ∂ L ∂ θ ˙ 1 ) – ∂ L ∂ θ 1 = 0 d d t ( ∂ L ∂ θ ˙ 2 ) – ∂ L ∂ θ 2 = 0 d d t ( ∂ L ∂ θ ˙ 3 ) – ∂ L ∂ θ 3 = 0 \frac{d}{dt}\left( \frac{\partial\mathcal{L}}{\partial \dot{\theta}_1} \right) –
\frac{\partial\mathcal{L}}{\partial \theta_1} = 0
\quad\quad
\frac{d}{dt}\left( \frac{\partial\mathcal{L}}{\partial \dot{\theta}_2} \right) –
\frac{\partial\mathcal{L}}{\partial \theta_2} = 0
\quad\quad
\frac{d}{dt}\left( \frac{\partial\mathcal{L}}{\partial \dot{\theta}_3} \right) –
\frac{\partial\mathcal{L}}{\partial \theta_3} = 0 d t d ( ∂ θ ˙ 1 ∂ L ) – ∂ θ 1 ∂ L = 0 d t d ( ∂ θ ˙ 2 ∂ L ) – ∂ θ 2 ∂ L = 0 d t d ( ∂ θ ˙ 3 ∂ L ) – ∂ θ 3 ∂ L = 0
Solving for θ 1 \theta_1 θ 1 :
∂ L ∂ θ ˙ 1 = ( m 1 + m 2 + m 3 ) ℓ 1 2 θ ˙ 1 + ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ˙ 2 + m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ˙ 3 d d t ( ∂ L ∂ θ ˙ 1 ) = ( m 1 + m 2 + m 3 ) ℓ 1 2 θ ¨ 1 + ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 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ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ¨ 3 – ( m 1 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 1 θ ˙ 2 + ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 2 2 – m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 θ ˙ 3 + m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 3 2 – ( − 1 ) [ 1 2 ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 1 θ ˙ 2 + m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 θ ˙ 3 + ( m 1 + m 2 + m 3 ) g ℓ 1 sin θ 1 ] = ( m 1 + m 2 + m 3 ) ℓ 1 2 θ ¨ 1 + ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ¨ 2 + m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ¨ 3 + ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 2 2 + m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 3 2 + ( m 1 + m 2 + m 3 ) g ℓ 1 sin θ 1 \begin{aligned}
\frac{\partial \mathcal{L}}{\partial \dot{\theta}_1} &= (m_1 + m_2 + m_3)\ell_1^2 \dot{\theta}_1
+ (m_2 + m_3)\ell_1\ell_2 \cos(\theta_1 – \theta_2)\dot{\theta}_2
+ m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3)\dot{\theta}_3 \\
\frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial \dot{\theta}_1} \right) &= (m_1 + m_2 + m_3)\ell_1^2 \ddot{\theta}_1 \\
& \qquad + (m_2 + m_3)\ell_1\ell_2 \cos(\theta_1 – \theta_2)\ddot{\theta}_2
– (m_2 + m_3)\ell_1\ell_2 \sin(\theta_1 – \theta_2)\dot{\theta}_2\left(\dot{\theta}_1 – \dot{\theta}_2 \right) \\
& \qquad + m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3)\ddot{\theta}_3
– m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3)\dot{\theta}_3 \left( \dot{\theta}_1 – \dot{\theta}_3 \right) \\
&= (m_1 + m_2 + m_3)\ell_1^2 \ddot{\theta}_1
+ (m_2 + m_3)\ell_1\ell_2 \cos(\theta_1 – \theta_2)\ddot{\theta}_2
+ m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3)\ddot{\theta}_3 \\
& \qquad – (m_2 + m_3)\ell_1\ell_2 \sin(\theta_1 – \theta_2)\dot{\theta}_1\dot{\theta}_2
+ (m_1 + m_3)\ell_1\ell_2 \sin(\theta_1 – \theta_2)\dot{\theta}_2^2 \\
& \qquad – m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3)\dot{\theta}_1\dot{\theta}_3
+ m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3)\dot{\theta}_3^2 \\
\frac{\partial \mathcal{L}}{\partial \theta_1} &= – (m_2 + m_3)\ell_1 \ell_2 \sin (\theta_1 – \theta_2) \dot{\theta}_1 \dot{\theta}_2
– m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3) \dot{\theta}_1\dot{\theta}_3
– (m_1 + m_2 + m_3) g \ell_1 \sin \theta_1 \\
&= -1 \left[ \vphantom{\frac{1}{2}} (m_2 + m_3)\ell_1 \ell_2 \sin (\theta_1 – \theta_2) \dot{\theta}_1 \dot{\theta}_2
+ m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3) \dot{\theta}_1\dot{\theta}_3
+ (m_1 + m_2 + m_3) g \ell_1 \sin \theta_1 \right] \\
\frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial \dot{\theta}_1} \right) – \frac{\partial \mathcal{L}}{\partial \theta_1}
&= (m_1 + m_2 + m_3)\ell_1^2 \ddot{\theta}_1
+ (m_2 + m_3)\ell_1\ell_2 \cos(\theta_1 – \theta_2)\ddot{\theta}_2
+ m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3)\ddot{\theta}_3 \\
& \qquad – (m_1 + m_3)\ell_1\ell_2 \sin(\theta_1 – \theta_2)\dot{\theta}_1\dot{\theta}_2
+ (m_2 + m_3)\ell_1\ell_2 \sin(\theta_1 – \theta_2)\dot{\theta}_2^2 \\
& \qquad – m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3)\dot{\theta}_1\dot{\theta}_3
+ m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3)\dot{\theta}_3^2 \\
& \qquad – (-1) \left[ \vphantom{\frac{1}{2}} (m_2 + m_3)\ell_1 \ell_2 \sin (\theta_1 – \theta_2) \dot{\theta}_1 \dot{\theta}_2
+ m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3) \dot{\theta}_1\dot{\theta}_3
+ (m_1 + m_2 + m_3) g \ell_1 \sin \theta_1 \right] \\
&= (m_1 + m_2 + m_3)\ell_1^2 \ddot{\theta}_1
+ (m_2 + m_3)\ell_1\ell_2 \cos(\theta_1 – \theta_2)\ddot{\theta}_2
+ m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3)\ddot{\theta}_3 \\
& \qquad + (m_2 + m_3)\ell_1\ell_2 \sin(\theta_1 – \theta_2)\dot{\theta}_2^2
+ m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3)\dot{\theta}_3^2
+ (m_1 + m_2 + m_3) g \ell_1 \sin \theta_1 \\
\end{aligned} ∂ θ ˙ 1 ∂ L d t d ( ∂ θ ˙ 1 ∂ L ) ∂ θ 1 ∂ L d t d ( ∂ θ ˙ 1 ∂ L ) – ∂ θ 1 ∂ L = ( m 1 + m 2 + m 3 ) ℓ 1 2 θ ˙ 1 + ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ˙ 2 + m 3 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 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ¨ 1 + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 3 – ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 1 2 + ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 1 θ 2 ˙ – m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 θ ˙ 3 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 3 2 – ( − 1 ) [ 1 2 − ( m 2 + m 3 ) ℓ 1 ℓ 2 θ ˙ 1 θ ˙ 2 sin ( θ 1 – θ 2 ) + m 3 ℓ 2 ℓ 3 θ ˙ 2 θ ˙ 3 sin ( θ 2 – θ 3 ) + ( m 2 + m 3 ) g ℓ 2 sin θ 2 ] = ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ¨ 1 + ( m 2 + m 3 ) ℓ 2 2 θ ¨ 2 + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 3 – ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 1 2 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 3 2 + ( m 2 + m 3 ) g ℓ 2 sin θ 2 \begin{aligned}
\frac{\partial \mathcal{L}}{\partial \dot{\theta}_2} &= (m_2 + m_3) \ell_2^2 \dot{\theta}_2
+ (m_2 + m_3) \ell_1 \ell_2 \cos (\theta_1 – \theta_2) \dot{\theta}_1
+ m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) \dot{\theta}_3 \\
\frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial \dot{\theta}_2} \right) &= (m_2 + m_3) \ell_2^2 \ddot{\theta}_2 \\
& \qquad + (m_2 + m_3) \ell_1 \ell_2 \cos (\theta_1 – \theta_2) \ddot{\theta}_1
+ (m_2 + m_3) \ell_1 \ell_2 (-1)\sin (\theta_1 – \theta_2) \dot{\theta}_1 (\dot{\theta_1} – \dot{\theta_2}) \\
& \qquad + m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) \ddot{\theta}_3
+ m_3 \ell_2 \ell_3 (-1)\sin (\theta_2 – \theta_3) \dot{\theta}_3 (\dot{\theta_2} – \dot{\theta_3}) \\
&= (m_2 + m_3) \ell_2^2 \ddot{\theta}_2 + (m_2 + m_3) \ell_1 \ell_2 \cos (\theta_1 – \theta_2) \ddot{\theta}_1 + m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) \ddot{\theta}_3 \\
& \qquad – (m_2 + m_3) \ell_1 \ell_2 \sin (\theta_1 – \theta_2) \dot{\theta}_1^2 + (m_2 + m_3) \ell_1 \ell_2 \sin (\theta_1 – \theta_2) \dot{\theta}_1\dot{\theta_2} \\
& \qquad – m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_2\dot{\theta}_3 + m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_3^2 \\
\frac{\partial \mathcal{L}}{\partial \theta_2} &= \left( m_2 + m_3 \right) \ell_1\ell_2\dot{\theta}_1\dot{\theta}_2(-1)\sin (\theta_1 – \theta_2)(-1)
+ m_3 \ell_2\ell_3\dot{\theta}_2\dot{\theta}_3 (-1)\sin(\theta_2 – \theta_3)
+ (m_2 + m_3) g \ell_2 (-1)\sin \theta_2 \\
&= -1 \left[ \vphantom{\frac{1}{2}} -\left( m_2 + m_3 \right) \ell_1\ell_2\dot{\theta}_1\dot{\theta}_2\sin (\theta_1 – \theta_2)
+ m_3 \ell_2\ell_3\dot{\theta}_2\dot{\theta}_3 \sin(\theta_2 – \theta_3)
+ (m_2 + m_3) g \ell_2 \sin \theta_2 \right] \\
\frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial \dot{\theta}_2} \right) – \frac{\partial \mathcal{L}}{\partial \theta_2} &=
(m_2 + m_3) \ell_2^2 \ddot{\theta}_2 + (m_2 + m_3) \ell_1 \ell_2 \cos (\theta_1 – \theta_2) \ddot{\theta}_1 + m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) \ddot{\theta}_3 \\
& \qquad – (m_2 + m_3) \ell_1 \ell_2 \sin (\theta_1 – \theta_2) \dot{\theta}_1^2 + (m_2 + m_3) \ell_1 \ell_2 \sin (\theta_1 – \theta_2) \dot{\theta}_1\dot{\theta_2} \\
& \qquad – m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_2\dot{\theta}_3 + m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_3^2 \\
& \qquad – (-1) \left[ \vphantom{\frac{1}{2}} -\left( m_2 + m_3 \right) \ell_1\ell_2\dot{\theta}_1\dot{\theta}_2\sin (\theta_1 – \theta_2)
+ m_3 \ell_2\ell_3\dot{\theta}_2\dot{\theta}_3 \sin(\theta_2 – \theta_3)
+ (m_2 + m_3) g \ell_2 \sin \theta_2 \right] \\
&= (m_2 + m_3) \ell_1 \ell_2 \cos (\theta_1 – \theta_2) \ddot{\theta}_1 + (m_2 + m_3) \ell_2^2 \ddot{\theta}_2 + m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) \ddot{\theta}_3 \\
& \qquad – (m_2 + m_3) \ell_1 \ell_2 \sin (\theta_1 – \theta_2) \dot{\theta}_1^2 + m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_3^2 + (m_2 + m_3) g \ell_2 \sin \theta_2
\end{aligned} ∂ θ ˙ 2 ∂ L d t d ( ∂ θ ˙ 2 ∂ L ) ∂ θ 2 ∂ L d t d ( ∂ θ ˙ 2 ∂ L ) – ∂ θ 2 ∂ L = ( m 2 + m 3 ) ℓ 2 2 θ ˙ 2 + ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ˙ 1 + m 3 ℓ 2 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ℓ 3 θ ˙ 1 ( − 1 ) sin ( θ 1 – θ 3 ) ( θ ˙ 1 – θ ˙ 3 ) + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 2 + m 3 ℓ 2 ℓ 3 θ ˙ 2 ( − 1 ) sin ( θ 2 – θ 3 ) ( θ ˙ 2 – θ ˙ 3 ) = m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ¨ 1 + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 2 + m 3 ℓ 3 2 θ ¨ 3 – m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 2 + m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 θ ˙ 3 – m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 2 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 θ ˙ 3 ∂ L ∂ θ 3 = m 3 ℓ 1 ℓ 3 θ ˙ 1 θ ˙ 3 ( − 1 ) sin ( θ 1 – θ 3 ) ( − 1 ) + m 3 ℓ 2 ℓ 3 θ ˙ 2 θ ˙ 3 ( − 1 ) sin ( θ 2 – θ 3 ) ( − 1 ) + m 3 g ℓ 3 ( − 1 ) sin θ 3 = m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 θ ˙ 3 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 θ ˙ 3 – m 3 g ℓ 3 sin θ 3 d d t ( ∂ L ∂ θ ˙ 3 ) – ∂ L ∂ θ 3 = m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ¨ 1 + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 2 + m 3 ℓ 3 2 θ ¨ 3 – m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 2 + m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 θ ˙ 3 – m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 2 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 θ ˙ 3 – [ 1 2 m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 θ ˙ 3 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 θ ˙ 3 – m 3 g ℓ 3 sin θ 3 ] = m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ¨ 1 + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 2 + m 3 ℓ 3 2 θ ¨ 3 – m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 2 – m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 2 + m 3 g ℓ 3 sin θ 3 \begin{aligned}
\frac{\partial \mathcal{L}}{\partial \dot{\theta}_3} &= m_3 \ell_3^2 \dot{\theta}_3
+ m_3 \ell_1 \ell_3 \dot{\theta}_1 \cos (\theta_1 – \theta_3) + m_3 \ell_2 \ell_3 \dot{\theta}_2 \cos (\theta_2 – \theta_3) \\
\frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial \dot{\theta}_3} \right) &= m_3 \ell_3^2 \ddot{\theta}_3 \\
& \qquad + m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3) \ddot{\theta}_1 + m_3 \ell_1 \ell_3 \dot{\theta}_1 (-1) \sin (\theta_1 – \theta_3) (\dot{\theta}_1 – \dot{\theta}_3) \\
& \qquad + m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) \ddot{\theta}_2 + m_3 \ell_2 \ell_3 \dot{\theta}_2 (-1) \sin (\theta_2 – \theta_3) (\dot{\theta}_2 – \dot{\theta}_3) \\
&= m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3) \ddot{\theta}_1 + m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) \ddot{\theta}_2 + m_3 \ell_3^2 \ddot{\theta}_3 \\
& \qquad – m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3) \dot{\theta}_1^2 + m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3) \dot{\theta}_1 \dot{\theta}_3 \\
& \qquad – m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_2^2 + m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_2 \dot{\theta}_3 \\
\frac{\partial \mathcal{L}}{\partial \theta_3} &= m_3 \ell_1 \ell_3 \dot{\theta}_1 \dot{\theta}_3 (-1) \sin ( \theta_1 – \theta_3) (-1)
+ m_3 \ell_2 \ell_3 \dot{\theta}_2 \dot{\theta}_3 (-1) \sin (\theta_2 – \theta_3) (-1)
+ m_3 g \ell_3 (-1) \sin \theta_3 \\
&= m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3) \dot{\theta}_1 \dot{\theta}_3
+ m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_2 \dot{\theta}_3
– m_3 g \ell_3 \sin \theta_3 \\
\frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial \dot{\theta}_3} \right) – \frac{\partial \mathcal{L}}{\partial \theta_3} &=
m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3) \ddot{\theta}_1 + m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) \ddot{\theta}_2 + m_3 \ell_3^2 \ddot{\theta}_3 \\
& \qquad – m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3) \dot{\theta}_1^2 + m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3) \dot{\theta}_1 \dot{\theta}_3 \\
& \qquad – m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_2^2 + m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_2 \dot{\theta}_3 \\
& \qquad – \left[ \vphantom{\frac{1}{2}}
m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3) \dot{\theta}_1 \dot{\theta}_3
+ m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_2 \dot{\theta}_3
– m_3 g \ell_3 \sin \theta_3 \right] \\
&= m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3) \ddot{\theta}_1 + m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) \ddot{\theta}_2 + m_3 \ell_3^2 \ddot{\theta}_3 \\
& \qquad – m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3) \dot{\theta}_1^2 – m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_2^2 \\
& \qquad + m_3 g \ell_3 \sin \theta_3 \\
\end{aligned} ∂ θ ˙ 3 ∂ L d t d ( ∂ θ ˙ 3 ∂ L ) ∂ θ 3 ∂ L d t d ( ∂ θ ˙ 3 ∂ L ) – ∂ θ 3 ∂ L = m 3 ℓ 3 2 θ ˙ 3 + m 3 ℓ 1 ℓ 3 θ ˙ 1 cos ( θ 1 – θ 3 ) + m 3 ℓ 2 ℓ 3 θ ˙ 2 cos ( θ 2 – θ 3 ) = m 3 ℓ 3 2 θ ¨ 3 + m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ¨ 1 + m 3 ℓ 1 ℓ 3 θ ˙ 1 ( − 1 ) sin ( θ 1 – θ 3 ) ( θ ˙ 1 – θ ˙ 3 ) + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 2 + m 3 ℓ 2 ℓ 3 θ ˙ 2 ( − 1 ) sin ( θ 2 – θ 3 ) ( θ ˙ 2 – θ ˙ 3 ) = m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ¨ 1 + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 2 + m 3 ℓ 3 2 θ ¨ 3 – m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 2 + m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 θ ˙ 3 – m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 2 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 θ ˙ 3 = m 3 ℓ 1 ℓ 3 θ ˙ 1 θ ˙ 3 ( − 1 ) sin ( θ 1 – θ 3 ) ( − 1 ) + m 3 ℓ 2 ℓ 3 θ ˙ 2 θ ˙ 3 ( − 1 ) sin ( θ 2 – θ 3 ) ( − 1 ) + m 3 g ℓ 3 ( − 1 ) sin θ 3 = m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 θ ˙ 3 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 θ ˙ 3 – m 3 g ℓ 3 sin θ 3 = m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ¨ 1 + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 2 + m 3 ℓ 3 2 θ ¨ 3 – m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 2 + m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 θ ˙ 3 – m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 2 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 θ ˙ 3 – [ 2 1 m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 θ ˙ 3 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 θ ˙ 3 – m 3 g ℓ 3 sin θ 3 ] = m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ¨ 1 + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 2 + m 3 ℓ 3 2 θ ¨ 3 – m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 2 – m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 2 + m 3 g ℓ 3 sin θ 3
Therefore, the equations of motion (or governing equations) are:
( m 1 + m 2 + m 3 ) ℓ 1 2 θ ¨ 1 + ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ¨ 2 + m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ¨ 3 + ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 2 2 + m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 3 2 + ( m 1 + m 2 + m 3 ) g ℓ 1 sin θ 1 = 0 ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ¨ 1 + ( m 2 + m 3 ) ℓ 2 2 θ ¨ 2 + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 3 − ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 1 2 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 3 2 + ( m 2 + m 3 ) g ℓ 2 sin θ 2 = 0 m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ¨ 1 + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 2 + m 3 ℓ 3 2 θ ¨ 3 − m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 2 – m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 2 + m 3 g ℓ 3 sin θ 3 = 0 \begin{aligned}
(m_1 + m_2 + m_3)\ell_1^2 \ddot{\theta}_1 &+ (m_2 + m_3)\ell_1\ell_2 \cos(\theta_1 – \theta_2)\ddot{\theta}_2 + m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3)\ddot{\theta}_3 \\
&+ (m_2 + m_3)\ell_1\ell_2 \sin(\theta_1 – \theta_2)\dot{\theta}_2^2 + m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3)\dot{\theta}_3^2 \\
&+ (m_1 + m_2 + m_3) g \ell_1 \sin \theta_1 = 0 \\
(m_2 + m_3) \ell_1 \ell_2 \cos (\theta_1 – \theta_2) \ddot{\theta}_1 &+ (m_2 + m_3) \ell_2^2 \ddot{\theta}_2 + m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) \ddot{\theta}_3 \\
&- (m_2 + m_3) \ell_1 \ell_2 \sin (\theta_1 – \theta_2) \dot{\theta}_1^2 + m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_3^2 \\
&+ (m_2 + m_3) g \ell_2 \sin \theta_2 = 0 \\
m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3) \ddot{\theta}_1 &+ m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) \ddot{\theta}_2 + m_3 \ell_3^2 \ddot{\theta}_3 \\
&- m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3) \dot{\theta}_1^2 – m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_2^2 \\
&+ m_3 g \ell_3 \sin \theta_3 = 0
\end{aligned} ( m 1 + m 2 + m 3 ) ℓ 1 2 θ ¨ 1 ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ¨ 1 m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ¨ 1 + ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ¨ 2 + m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) θ ¨ 3 + ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 2 2 + m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 3 2 + ( m 1 + m 2 + m 3 ) g ℓ 1 sin θ 1 = 0 + ( m 2 + m 3 ) ℓ 2 2 θ ¨ 2 + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 3 − ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 1 2 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 3 2 + ( m 2 + m 3 ) g ℓ 2 sin θ 2 = 0 + m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) θ ¨ 2 + m 3 ℓ 3 2 θ ¨ 3 − m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 2 – m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 2 + m 3 g ℓ 3 sin θ 3 = 0
Two quick checks, if m 2 , m 3 , ℓ 1 , and ℓ 3 m_2, m_3, \ell_1, \text{and}\ \ell_3 m 2 , m 3 , ℓ 1 , and ℓ 3 are all 0, then the equations should reduce to a single pendulum; and if m 3 and ℓ 3 m_3 \text{and}\ \ell_3 m 3 and ℓ 3 are 0 then the system should reduce to a double pendulum.
Check 1, if m 2 , m 3 , ℓ 1 , and ℓ 3 m_2, m_3, \ell_1, \text{and}\ \ell_3 m 2 , m 3 , ℓ 1 , and ℓ 3 are 0, then we only have one equation:
m 1 ℓ 1 2 θ ¨ 1 + m 1 g ℓ 1 sin θ 1 = 0 ⇒ θ ¨ 1 + g ℓ 1 sin θ 1 = 0 m_1\ell_1^2 \ddot{\theta}_1\ +\ m_1 g \ell_1 \sin\theta_1 = 0
\quad \Rightarrow \quad
\ddot{\theta}_1\ +\ \frac{g}{\ell_1}\sin \theta_1 = 0 m 1 ℓ 1 2 θ ¨ 1 + m 1 g ℓ 1 sin θ 1 = 0 ⇒ θ ¨ 1 + ℓ 1 g sin θ 1 = 0
And this describes a simple pendulum.
Check 2, if m 3 and ℓ 3 m_3\ \text{and} \ell_3 m 3 and ℓ 3 are 0 then, we have two equations:
( m 1 + m 2 ) ℓ 1 2 θ ¨ 1 + m 2 ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ¨ 2 + m 2 ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 2 2 + ( m 1 + m 2 ) g ℓ 1 sin θ 1 = 0 m 2 ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ¨ 1 + m 2 ℓ 2 2 θ ¨ 2 – m 2 ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 1 2 + m 2 g ℓ 2 sin θ 2 = 0 \begin{aligned}
(m_1 + m_2)\ell_1^2 \ddot{\theta}_1 + m_2\ell_1\ell_2 \cos(\theta_1 – \theta_2)\ddot{\theta}_2 + m_2\ell_1\ell_2 \sin(\theta_1 – \theta_2)\dot{\theta}_2^2 + (m_1 + m_2)g \ell_1 \sin \theta_1 &= 0 \\
m_2 \ell_1 \ell_2 \cos (\theta_1 – \theta_2) \ddot{\theta}_1 + m_2 \ell_2^2 \ddot{\theta}_2 – m_2 \ell_1 \ell_2 \sin (\theta_1 – \theta_2) \dot{\theta}_1^2 + m_2 g \ell_2 \sin \theta_2 &= 0 \\
\end{aligned} ( m 1 + m 2 ) ℓ 1 2 θ ¨ 1 + m 2 ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ¨ 2 + m 2 ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 2 2 + ( m 1 + m 2 ) g ℓ 1 sin θ 1 m 2 ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) θ ¨ 1 + m 2 ℓ 2 2 θ ¨ 2 – m 2 ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 1 2 + m 2 g ℓ 2 sin θ 2 = 0 = 0
Divide equation 1 by ℓ 1 \ell_1 ℓ 1 and equation 2 by m 2 and ℓ 2 m_2\ \text{and}\ \ell_2 m 2 and ℓ 2 and we have the equations for a double pendulum:
( m 1 + m 2 ) ℓ 1 θ ¨ 1 + m 2 ℓ 2 cos ( θ 1 – θ 2 ) θ ¨ 2 + m 2 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 2 2 + ( m 1 + m 2 ) g sin θ 1 = 0 ℓ 1 cos ( θ 1 – θ 2 ) θ ¨ 1 + ℓ 2 θ ¨ 2 – ℓ 1 sin ( θ 1 – θ 2 ) θ ˙ 1 2 + g sin θ 2 = 0 \begin{aligned}
(m_1 + m_2)\ell_1 \ddot{\theta}_1 + m_2\ell_2 \cos(\theta_1 – \theta_2)\ddot{\theta}_2 + m_2\ell_2 \sin(\theta_1 – \theta_2)\dot{\theta}_2^2
+ (m_1 + m_2)g \sin \theta_1 &= 0 \\
\ell_1 \cos (\theta_1 – \theta_2) \ddot{\theta}_1 + \ell_2 \ddot{\theta}_2 – \ell_1 \sin (\theta_1 – \theta_2) \dot{\theta}_1^2
+ g \sin \theta_2 &= 0 \\
\end{aligned}
( m 1 + m 2 ) ℓ 1 θ ¨ 1 + m 2 ℓ 2 cos ( θ 1 – θ 2 ) θ ¨ 2 + m 2 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 2 2 + ( m 1 + m 2 ) g sin θ 1 ℓ 1 cos ( θ 1 – θ 2 ) θ ¨ 1 + ℓ 2 θ ¨ 2 – ℓ 1 sin ( θ 1 – θ 2 ) θ ˙ 1 2 + g sin θ 2 = 0 = 0
Looking back at the equations of motion for the triple pendulum, a little linear algebra can be used to obtain an ‘easy’ solution.
[ A ] [ θ ¨ i ] = [ B ] ⇒ [ θ ¨ i ] = [ A ] − 1 [ B ] \left[ A \right] \left[ \ddot{\theta}_i \right] = \left[ B \right]
\quad \Rightarrow \quad
\left[ \ddot{\theta}_i \right] = \left[ A \right]^{-1} \left[ B \right] [ A ] [ θ ¨ i ] = [ B ] ⇒ [ θ ¨ i ] = [ A ] − 1 [ B ]
So arranging the solution equations into matrices we have:
[ ( m 1 + m 2 + m 3 ) ℓ 1 2 ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) ( m 2 + m 3 ) ℓ 2 2 m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) m 3 ℓ 3 2 ] [ θ ¨ 1 θ ¨ 2 θ ¨ 3 ] = [ − ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 2 2 – m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 3 2 – ( m 1 + m 2 + m 3 ) g ℓ 1 sin θ 1 ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 1 2 – m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 3 2 – ( m 2 + m 3 ) g ℓ 2 sin θ 2 m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 2 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 2 – m 3 g ℓ 3 sin θ 3 ] \begin{aligned}
\left[ \begin{array}{ccc}
(m_1 + m_2 + m_3)\ell_1^2 & (m_2 + m_3)\ell_1\ell_2 \cos(\theta_1 – \theta_2) & m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3) \\
(m_2 + m_3) \ell_1 \ell_2 \cos (\theta_1 – \theta_2) & (m_2 + m_3) \ell_2^2 & m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) \\
m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3) & m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) & m_3 \ell_3^2
\end{array}\right]
\left[ \begin{array}{ccc}
\ddot{\theta}_1 \\ \ddot{\theta}_2 \\ \ddot{\theta}_3
\end{array}\right]
=
\\
\left[ \begin{array}{ccc}
-(m_2 + m_3)\ell_1\ell_2 \sin(\theta_1 – \theta_2)\dot{\theta}_2^2 – m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3)\dot{\theta}_3^2 – (m_1 + m_2 + m_3) g \ell_1 \sin \theta_1 \\
(m_2 + m_3) \ell_1 \ell_2 \sin (\theta_1 – \theta_2) \dot{\theta}_1^2 – m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_3^2 – (m_2 + m_3) g \ell_2 \sin \theta_2 \\
m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3) \dot{\theta}_1^2 + m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_2^2 – m_3 g \ell_3 \sin \theta_3
\end{array}\right]
\end{aligned} ⎣ ⎢ ⎡ ( m 1 + m 2 + m 3 ) ℓ 1 2 ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) ( m 2 + m 3 ) ℓ 2 2 m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) m 3 ℓ 3 2 ⎦ ⎥ ⎤ ⎣ ⎢ ⎡ θ ¨ 1 θ ¨ 2 θ ¨ 3 ⎦ ⎥ ⎤ = ⎣ ⎢ ⎡ − ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 2 2 – m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 3 2 – ( m 1 + m 2 + m 3 ) g ℓ 1 sin θ 1 ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 1 2 – m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 3 2 – ( m 2 + m 3 ) g ℓ 2 sin θ 2 m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 2 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 2 – m 3 g ℓ 3 sin θ 3 ⎦ ⎥ ⎤
[ θ ¨ 1 θ ¨ 2 θ ¨ 3 ] = [ ( m 1 + m 2 + m 3 ) ℓ 1 2 ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) ( m 2 + m 3 ) ℓ 2 2 m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) m 3 ℓ 3 2 ] − 1 × [ − ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 2 2 – m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 3 2 – ( m 1 + m 2 + m 3 ) g ℓ 1 sin θ 1 ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 1 2 – m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 3 2 – ( m 2 + m 3 ) g ℓ 2 sin θ 2 m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 2 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 2 – m 3 g ℓ 3 sin θ 3 ] \begin{aligned}
\left[ \begin{array}{ccc}
\ddot{\theta}_1 \\ \ddot{\theta}_2 \\ \ddot{\theta}_3
\end{array}\right]
=
\left[ \begin{array}{ccc}
(m_1 + m_2 + m_3)\ell_1^2 & (m_2 + m_3)\ell_1\ell_2 \cos(\theta_1 – \theta_2) & m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3) \\
(m_2 + m_3) \ell_1 \ell_2 \cos (\theta_1 – \theta_2) & (m_2 + m_3) \ell_2^2 & m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) \\
m_3 \ell_1 \ell_3 \cos (\theta_1 – \theta_3) & m_3 \ell_2 \ell_3 \cos (\theta_2 – \theta_3) & m_3 \ell_3^2
\end{array}\right]^{-1} \\
\times
\left[ \begin{array}{ccc}
-(m_2 + m_3)\ell_1\ell_2 \sin(\theta_1 – \theta_2)\dot{\theta}_2^2 – m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3)\dot{\theta}_3^2 – (m_1 + m_2 + m_3) g \ell_1 \sin \theta_1 \\
(m_2 + m_3) \ell_1 \ell_2 \sin (\theta_1 – \theta_2) \dot{\theta}_1^2 – m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_3^2 – (m_2 + m_3) g \ell_2 \sin \theta_2 \\
m_3 \ell_1 \ell_3 \sin (\theta_1 – \theta_3) \dot{\theta}_1^2 + m_3 \ell_2 \ell_3 \sin (\theta_2 – \theta_3) \dot{\theta}_2^2 – m_3 g \ell_3 \sin \theta_3
\end{array}\right]
\end{aligned} ⎣ ⎢ ⎡ θ ¨ 1 θ ¨ 2 θ ¨ 3 ⎦ ⎥ ⎤ = ⎣ ⎢ ⎡ ( m 1 + m 2 + m 3 ) ℓ 1 2 ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) ( m 2 + m 3 ) ℓ 1 ℓ 2 cos ( θ 1 – θ 2 ) ( m 2 + m 3 ) ℓ 2 2 m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) m 3 ℓ 1 ℓ 3 cos ( θ 1 – θ 3 ) m 3 ℓ 2 ℓ 3 cos ( θ 2 – θ 3 ) m 3 ℓ 3 2 ⎦ ⎥ ⎤ − 1 × ⎣ ⎢ ⎡ − ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 2 2 – m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 3 2 – ( m 1 + m 2 + m 3 ) g ℓ 1 sin θ 1 ( m 2 + m 3 ) ℓ 1 ℓ 2 sin ( θ 1 – θ 2 ) θ ˙ 1 2 – m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 3 2 – ( m 2 + m 3 ) g ℓ 2 sin θ 2 m 3 ℓ 1 ℓ 3 sin ( θ 1 – θ 3 ) θ ˙ 1 2 + m 3 ℓ 2 ℓ 3 sin ( θ 2 – θ 3 ) θ ˙ 2 2 – m 3 g ℓ 3 sin θ 3 ⎦ ⎥ ⎤
Finally, simulating the results…
Click here to view in a separate tab.
Code
All the code was written in Javascript and the visual components were done using the Html Canvas element and is available here . The math was originally done with just pen and paper, and the code written using vi (or more precisely vim). A Latex version of the math (with not too many errors) has also been made available.
Future
Maybe in the future more Lagrangian problems will be looked at including spherical pendulums (and the Foucault pendulum ) and possibly n -link pendulums.
DifferentialEquations Javascript Lagrangian Math Physics Simulation
No Comments