Numerical Solution to the Nonlinear Pendulum Equation [ PyMath #6 ]
ฝัง
- เผยแพร่เมื่อ 20 ต.ค. 2024
- 10-15% Off all my Merch :) Use Code 42069 over on papaflammy.myt...
10% or more Off ALL Face Masks! =D stemerch.com/c...
Pendulum Differential Eq: • Exact Solution of the ...
Series of Elliptic: • Complete Elliptic Inte...
Advent Calendar Playlist: • Advent Calendar 2020
Try Wondershare Document Cloud right now :) bit.ly/3fj1Xnj
Subscribe to Document Cloud at 50% off! bit.ly/3fj2aa5
Today we are going to calculate the solution to the nonlinear pendulum differential equation, its period time for certain initial displacements, gravitational acceleration and string length. We implement the complete elliptic integral of the first kind into python and approximate the period time to a certain degree. Enjoy :) Video sponsored by Wondershare btw! =)
------------------------------------
The Code:
import math
def elliptic(n,k):
k = math.sin(k *math.pi / 360)
s = 1
for i in range(0, n+1):
p = 1
for j in range(1, 2*i+1+1 , 2):
p *= j / (j+1)
s += (p * k**(i+1))**2
return float(math.pi/2 * s)
l = int(input("String length l? "))
g = float(input("Gravitational acceleration g? "))
phi = float(input("Initial displacement phi_0? "))
n = int(input("Degree of approximation n? "))
print('')
print("Period time T =", 4*math.sqrt(l/g)*elliptic(n, phi))
-----------------------------------------------------
Help me create more free content! =)
stemerch.com/
/ mathable
papaflammy.myt...
Merch :v - papaflammy.myt...
www.amazon.com...
shop.spreadshi...
Become a Member of the Flammily! :0 / @papaflammy69
2nd Channel: / @npcooking69
--------------------------------------------------------------------------------
Wanna send me some stuff? lel:
Postfach 11 15
06731 Bitterfeld-Wolfen
Saxony-Anhalt
Germany
--------------------------------------------------------------------------------
Twitter: / flammablemaths
Instagram: / uncomfortably_cursed_m...
Flammy's subreddit: / flammybois
Facebook: / flammablemaths
Want to know more about me? Watch my QnA! =D • Question and Answer Ti...