"Linear Model" of a Pendulum via Euler's Method

Click For Summary
SUMMARY

The discussion focuses on implementing Euler's Method to model a pendulum using the linear approximation of the sine function, specifically \(\sin(x) = x\). The user attempts to solve the second-order differential equation \(\frac{d^{2}x}{dt^{2}} = -\sin(x)\) by converting it into a system of first-order equations. Initial conditions are set at X(1) = 1 and V(1) = 0, but the user encounters issues with the expected circular trajectory, instead producing a straight line or spiral. The conversation highlights the importance of keeping angle values within the small-angle approximation limit of less than 10 degrees for accurate results.

PREREQUISITES
  • Understanding of Euler's Method for numerical integration
  • Familiarity with the small-angle approximation in trigonometry
  • Basic knowledge of differential equations
  • Proficiency in programming for implementing numerical algorithms
NEXT STEPS
  • Explore the implementation of the Runge-Kutta method for improved accuracy in solving differential equations
  • Learn about the effects of varying step sizes in numerical simulations
  • Investigate the limitations of the small-angle approximation in pendulum motion
  • Study the mathematical derivation of the circular motion equations for pendulums
USEFUL FOR

Students and professionals in physics, mathematics, and engineering who are interested in numerical methods for solving differential equations, particularly in the context of pendulum dynamics.

Euler2718
Messages
90
Reaction score
3
In my problem the linear modal is defined as the first term in the series expansion of \sin(x) so:

\sin(x) = x - \frac{x^{3}}{3!}+\dots

\sin(x) = x is the linear modal.

So with this, I then have to write \frac{d^{2}x}{dt^{2}} = -\sin(x) as a system of x^{\prime} and y^{\prime}, so:
x^{\prime} = y
y^{\prime} = \sin(x)

I tried the linear modal in Euler's method, with initial conditions X(1) = 1 and V(1)=0 :

Code:
for i = 1:1000
    V(i+1) = V(i)-(1.*s) ;
    X(i+1) = V(i); 
end

Where s is the step size. But apparently I'm supposed to get a circle when I plot V with respect to X which makes sense, but all I get is a straight line.

If I change it to:

Code:
for i = 1:1000
    V(i+1) = V(i)-(X(i).*s) ;
    X(i+1) = V(i); 
end

With s=0.8 I get a spiral, which looks like a development but I'm no closer to the circular shape that I am expecting. I think I just need a fresh pair of eyes to see where perhaps an obvious error lies.
 
Physics news on Phys.org
In your example the sin(x) = x approximation has the understanding that x is in radians and that its true for small angles <10 degrees or so.

https://en.wikipedia.org/wiki/Small-angle_approximation

Is your x values exceeding that 10 degree in radians limit?

Also I'd try to hand calculate things or better yet have the computer print out x(i) and v(i) so you can see where it goes wrong.

EDIT:

I looked at your example, and it does produce a line by hand calculation the V goes 0.0 to -0.1 to -0.2 ... while the X values do the same but more abruptly 1, 0.0, -0.1, -0.2 ...

To get a circle, wouldn't V have to be something like ##V(i+1) = sqrt(1.0 - x(i)*x(i))##
and then it wouldn't work when x(i) > 10 degrees?
 
Last edited:

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
10K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K