Manipulate[
sol =
NDSolve[{2 Dt[r[t], t] Dt[\[Theta][t], t] +
r[t] Dt[\[Theta][t], t, t] + Sin[\[Theta][t]] == 0,
r[t] Dt[\[Theta][t], t]^2 + Cos[\[Theta][t]] - k*r[t] + k -
Dt[r[t], t, t] == 0, r[0] == l, \[Theta][0] == Pi/2,
r'[0] == \[Theta]'[0] == 0}, {r, \[Theta]}, {t, 0, 100}],
{l, 0, 5}, {k, 0, 5}]
这个是解微分方程
Manipulate[
Show[
If[T == 0,
ParametricPlot[{2, 0}, {t, 0, 100},
PlotRange -> {{-5, 5}, {-5, 5}}],
ParametricPlot[{r[t] Sin[\[Theta][t]], -r[t] Cos[\[Theta][t]]} /.
sol, {t, 0, T}, PlotRange -> {{-5, 5}, {-5, 5}}]],
Graphics[{Red, PointSize[0.02],
Point[{r[T] Sin[\[Theta][T]], -r[T] Cos[\[Theta][T]]} /. sol],
Black, Thickness[0.007],
Line[{{0, 0}, {r[T] Sin[\[Theta][T]], -r[T] Cos[\[Theta][T]]} /.
sol}]}]
],
{T, 0, 100}
]
这个来绘图