1
$\begingroup$

enter image description here

(* Q7 - a *)
Block[
    {Theta=Pi/6,r=6},
    Graphics[
        {
            Thick, Black, Line[{{-2,-(12-r)},{-2,0},{2,0},{2+r*Sin[Theta],-r*Cos[Theta]}}],
            Red, AbsolutePointSize[20],Point[{-2,-(12-r)}],
            Blue,AbsolutePointSize[10],Point[{2+r*Sin[Theta],-r*Cos[Theta]}],
            Black,AbsolutePointSize[8],Point[{{-2,0},{2,0}}],
            {Dashed,Line[{{2,0},{2,-7}}]},
            Circle[{2,0},1,{-Pi/2,-Pi/2+Theta}],
            Text[Style["Theta",FontSize -> 15],{2+1.5Sin[Theta/2],-1.5Cos[Theta/2]}],
            Text[Style["  r  ",FontSize -> 15],{2.5+r/2Sin[Theta],-r/2Cos[Theta]}]
        }
    ]
]



ansQ7 = With[{mu = 4.5, g = 9.8},
    NDSolve[
    {
        (mu + 1)*r''[t] - r[t]*Theta'[t]^2 + g*(mu - Cos[Theta[t]]) == 0,
        r[t]*Theta''[t] + 2 r'[t]*Theta'[t] + g*Sin[Theta[t]] == 0,
        r[0] == 1,
        Theta[0] == Pi/2,
        r'[0] == 0, 
        Theta'[0] == 0
    }, 
    {r, Theta}, {t, 0, 100}
    ]
]


(* Q7 - b *)
Plot[Evaluate[r[t] /. ansQ7], {t, 0, 20}, PlotRange -> All]
Plot[Evaluate[Theta[t] /. ansQ7], {t, 0, 20}, PlotRange -> All]

I am not sure if I understand (c) correctly. Is it asking to plot the exact location of the m?

I am thininking that I need to use something like CoordinateTransform, but I am not sure how to use it. Also in this case, the angle Theta is measured postively from downwards??

Thanks.

$\endgroup$
3
$\begingroup$

I would interpret c) as asking for a plot of $\{r\,\cos\,\theta, r\,\sin\,\theta\}$. This can be done as follows:

With[{mu = 4.5, g = 9.8}, 
  {rF, θF} = 
     NDSolveValue[
       {(mu + 1)*r''[t] - r[t]*Theta'[t]^2 + g*(mu - Cos[Theta[t]]) == 0, 
        r[t]*Theta''[t] + 2 r'[t]*Theta'[t] + g*Sin[Theta[t]] == 0, 
        r[0] == 1, Theta[0] == Pi/2, r'[0] == 0, Theta'[0] == 0}, 
       {r, Theta}, {t, 0, 100}]];

ParametricPlot[{rF[t] Cos[θF[t]], rF[t] Sin[θF[t]]}, {t,0, 100}]

plot

$\endgroup$
  • $\begingroup$ OMG!!! I actually tried something like ParametricPlot[{r,θ}, {t,0, 100}] but I was overthinking and using CoordinateTransform. Thanks. That was really neat and should be correct. $\endgroup$ – CasperYC Dec 14 '19 at 19:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.