Ordinary ortodoxian way for simple pendulum period calculation

Share your advanced PureBasic knowledge/code with the community.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Ordinary ortodoxian way for simple pendulum period calculation

Post by Psychophanta »

Code: Select all

Procedure.d PenduloSum(T0.d,n.q,fi1.d)
  ; This function makes the polynomial to calculate the period of a simple pendulum: T=T0·(sum(0,infinitum)((2n)!/n!/2^(2n))^2 · sin(fi1/2) )
  ; The greater the value of 'n' the greater the accuracy.
  Protected T.d=0,r.d=1,m.q=n
  While m>=0
    While n>0:r*(n*2-1)/(n*2):n-1:Wend
    T+(Pow(r,2)*Pow(Sin(fi1/2),m*2))
    r=1:m-1:n=m
  Wend
  ProcedureReturn T*T0
EndProcedure

R.d=3.5; <- length from pivot
a.d=9.82; <- gravitational flux intensity
fi1.d=#PI/3; <- initial angle
valor.d=#PI*2*Sqr(R/a)*(1+Pow(1/2,2)*Pow(Sin(fi1/2),2) + Pow(3/8,2)*Pow(Sin(fi1/2),4) + Pow(15/48,2)*Pow(Sin(fi1/2),6) + Pow((15*7)/(64*6),2)*Pow(Sin(fi1/2),8))
debug valor
debug PenduloSum(#PI*2*Sqr(R/a),4,fi1)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;