Message Boards Message Boards

Using the pendulum equation to numerically calculate gravitational constant

Posted 2 years ago

Hello I would like to use this equation (nonlinear pendulum) to calculate the gravitational constant.

The differential equation which represents the motion of a simple pendulum

I mananaged to find a way how to calculate the period of the pendulum by using the following code:

g=9.81
L=0.78
y=.
y=First[y/.NDSolve[{y''[t]==-(g/L)*Sin[y[t]],y[0]==30*Pi/180,y'[0]==0},y,{t,0,10}]]
Plot[y[t],{t,0,10}]
FindMaximum[y[t],{t,1.7,2.5}]

But I would need it the other way. So that I can calculate the gravitational constant. Any help is appreciated!

POSTED BY: Jan Novák
3 Replies

Thanks a lot, however, what I do not understand is that the results that I acquire from using your equation do not match mine. If I were to use your example:

g=9.80824
L=0.78
y=.
y=First[y/.NDSolve[{y''[t]==-(g/L)*Sin[y[t]],y[0]==30Pi/180,y'[0]==0},y,{t,0,10}]]
Plot[y[t],{t,0,10}]
FindMaximum[y[t],{t,1.7,2.5}]

The period would equal t=1.80272. while in your calculation you had t=1.426.

POSTED BY: Jan Novák

Yes I made a mistake. I corrected formula. Now works fine.

Regards.

POSTED BY: Mariusz Iwaniuk

From Wikipedia we have:

$$g=\frac{16 l \left(\int_0^{\frac{\pi }{2}} \frac{1}{\sqrt{1-\sin ^2\left(\frac{\text{$\omega $0}}{2}\right) \sin ^2(u)}} \, du\right){}^2}{\text{T0}^2}$$

l = 0.78; \[Omega]0 = 30*Pi/180; T0 = 1.80255(*Period*);

(16 l Integrate[
     1/Sqrt[1 - Sin[\[Omega]0/2]^2*Sin[u]^2], {u, 0, Pi/2}]^2)/T0^2

 (*9.81004*)

With power series solution for the elliptic integral:

  ClearAll["`*"]; SERIES = 
   Series[Integrate[1/Sqrt[
      1 - Sin[\[Omega]0/2]^2*Sin[u]^2], {u, 0, Pi/2}], {\[Omega]0, 0, 
      10}] // Normal
   (*\[Pi]/2 + (\[Pi] \[Omega]0^2)/32 + (11 \[Pi] \[Omega]0^4)/6144 + (
    173 \[Pi] \[Omega]0^6)/1474560 + (
    22931 \[Pi] \[Omega]0^8)/2642411520 + (
    1319183 \[Pi] \[Omega]0^10)/1902536294400*)

   l = 0.78; \[Omega]0 = 30*Pi/180; T0 = 1.80255; (16 l SERIES^2)/T0^2
    (*9.81004*)

Regards.

POSTED BY: Mariusz Iwaniuk
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract