这是球摆或二维摆的模拟,其拉格朗日由下式给出

$$ \mathcal{L} = \dfrac{1}{2}mL^2\dot{\theta}^2 + \dfrac{1}{2}mL^2\dot{\phi}^2\sin^2\西塔PP999 $$ $$ + mgL\cos\theta, $$

其中 $\theta$ 和 $\phi$ 是传统的球面坐标。 使用四阶 Runge-Kutta 方法对运动方程进行积分,时间步长为 $h$。 对于大初始角度(大于 120°), 有必要减少$h$以保证解的收敛性。 重力加速度定义为 $g = 9.8$ m/s²。

阅读更多: