Chaotic Double Pendulum

Correct Lagrangian equations of motion, RK4 integration, and a fading rainbow tip trail.

θ₁ 0.0° · θ₂ 0.0°

θ̈₁ = [-g(2m₁+m₂)sinθ₁ - m₂g sin(θ₁-2θ₂) - 2sinΔ·m₂(θ̇₂²l₂ + θ̇₁²l₁cosΔ)] / [l₁(2m₁+m₂ - m₂cos2Δ)]
θ̈₂ = [2sinΔ(θ̇₁²l₁(m₁+m₂) + g(m₁+m₂)cosθ₁ + θ̇₂²l₂m₂cosΔ)] / [l₂(2m₁+m₂ - m₂cos2Δ)]

Tip: click or tap the canvas to kick the pendulum.