Simple Pendulum motion - Numerical Integration

AI Thread Summary
The discussion revolves around solving the differential equation for a simple pendulum using numerical integration methods, specifically Euler's method and the 4th order Runge-Kutta method. Participants clarify that for the initial condition of θ=60 degrees, the full non-linear equation must be used rather than a linear approximation due to the large angle. The conversation includes detailed steps on implementing the Runge-Kutta method, emphasizing the need to treat the second-order differential equation as a system of first-order equations. There is also a focus on ensuring correct calculations for the k-values in the Runge-Kutta method, with participants seeking clarification on their derivations and implementations. Overall, the thread provides insights into numerical methods for solving pendulum motion equations.
Alexanddros81
Messages
177
Reaction score
4

Homework Statement


The differential equation of motion for the simple pendulum can be shown to be
##\ddot {θ} = -(g/L)sinθ##. Given that L=9.81 m and that the pendulum is released
from rest at θ=60deg, determine the time required for the pendulum to reach the position
θ=0deg. Use Δt=0.10s, and compare your answer with the analytical solution of 1.686s

Fig P13_81.png

Homework Equations

The Attempt at a Solution



Pytels_Dynamics095.jpg


I guess I am missing something...
I need to compute θ value? How do I do that? Do I find θ by using x, L, s ?
 

Attachments

  • Fig P13_81.png
    Fig P13_81.png
    7.2 KB · Views: 1,060
  • Pytels_Dynamics095.jpg
    Pytels_Dynamics095.jpg
    14.7 KB · Views: 1,365
Physics news on Phys.org
What method are you using? Eulers? What is your question for us?
 
Last edited:
Since ##u_{\theta} = \dot \theta##, ##\dot u_{\theta} = \ddot \theta##.
So, you are solving the equation ##\ddot \theta = -\sin{\theta}##. No need to introduce x or s.
 
  • Like
Likes scottdave
Hi.
Can you check the following if it is correct?
By reading on a Dover book regarding differential equations and browsing on the web
i give the following as a linear solution for the undamped pendulum problem for small angle θ.
Pytels_Dynamics096.jpg


Do I proceed with the linear equation of the pendulum equation or with non-linear for this
particular problem? (Initial condition for θ = 60deg)

Also I want to use the 4th order Runge-Kutta method.
 

Attachments

  • Pytels_Dynamics096.jpg
    Pytels_Dynamics096.jpg
    30.7 KB · Views: 867
With an initial condition of θ=60 degrees, θ in radians is 1.05, and sin(θ) = 0.866, so you can see that the small angle approximation fails badly. You need to use the full non-linear equation in your Runge-Kutta code. That is the whole point of the exercise. With the small angle approximation, the equation can be solved analytically and there is no need for numeric integration.
 
So the equivalent first-order diff.equations are

##u_θ=\dot {θ}## and ##\dot {u_θ} = -(g/L)sinθ##

Correct?
 
Alexanddros81 said:
So the equivalent first-order diff.equations are

##u_θ=\dot {θ}## and ##\dot {u_θ} = -(g/L)sinθ##

Correct?

Correct.
 
Pytels_Dynamics097.jpg


How do I implement the above runge-kutta 4th order to this specific problem?
I don't know how...

Is ##k1=f(θ_i)## ? and ## k2=f(θ_i + 1/2h) ## etc. ?
Is ##\dot {u} = f(θ)## ? (not according to the above)

Is ##k1=f(θ_ι, ω_i)## etc ?
 

Attachments

  • Pytels_Dynamics097.jpg
    Pytels_Dynamics097.jpg
    27.6 KB · Views: 705
  • #10
Since this is a second order problem, your yi's and k's are two component vectors, with the components being y_i = (\theta, \dot \theta). Here your function f(t, y_i) = f(t, (\theta, \dot \theta)) = (\dot \theta, -\frac{g}{L} \sin(\theta)). Note that f is independent of t, which simplifies things. So you start with y_0 = (\theta, \dot \theta) = (\theta_0, 0). So then k_1 = f(0,(\theta_0,0)) = (0, -\frac{g}{L} \sin(\theta_0)) , k_2 = f(h/2,y_0 + h/2*k_1) = f(h/2,(\theta_0,-\frac{g}{L} \sin(\theta_0)*h/2))=(-\frac{g}{L} \sin(\theta_0)*h/2, -\frac{g}{L} \sin(\theta_0)) and so on. Does this help?
 
  • #11
to phyzguy:
thanks this is the information I needed. Is there some more info related to this?
 
  • #12
A few questions:
1) since ##y_0 = (\theta, \dot \theta) = (\theta_0, 0)## we say that ##k_1 = f(0,(\theta_0,0)) = (0, -\frac{g}{L} \sin(\theta_0))##

the last expression for k1 is ##f(0,(\theta_0,0)) = (0, -\frac{g}{L} \sin(\theta_0))##
The above means that t=0 (first parameter) and ##y_0 = (\theta_0,0) = -\frac{g}{L} \sin(\theta_0)## (second parameter). Correct?

2) Is your expression for k2 correct? If yes how did you derived it?
 
  • #13
I think you're still not getting it. The function f returns the derivative of y, so since y = (\theta, \dot \theta), f(y) = (\dot \theta,-\frac{g}{L} \sin(\theta)). From there you just plug in. To find k2 you just plug in y_0 + \frac{h}{2} k1 into f. You wrote:

Alexanddros81 said:
##y_0 = (\theta_0,0) = -\frac{g}{L} \sin(\theta_0)## (second parameter).

The first equality is correct, but the second is not.

Here is a link which explains in more detail. Are you writing some computer code to do this? If so in what language? You might try defining the code, maybe that will help. Define a function f that takes y as its input, and define another function that does one RK4 step.
 

Similar threads

Back
Top