- #1
Kaimyn
- 44
- 1
Hello and thanks in advance for your help.
For about a week now, I've been trying to write what should be a simple python program. The idea is first to write a program for a simple harmonic pendulum, then adapt it to a spring pendulum. However, in order to do this, I have to write the simple harmonic pendulum so that it is moved by forces in certain directions.
I have all (or most?) of the mathematics and physics behind it sorted, but I have no idea how to program it in a way that would include the forces acting upon the pendulum to make it work.
The forces (simple harmonic pendulum):
Gravity: g
Perpendicular: -mgsin(theta)
Bottom of the weight: mgcos(theta)
Total (directionless) speed of weight: [tex]v=\sqrt{2gr(cos(\theta_{1})-cos(\theta_{0}))[/tex] (Theta1 is the current angle the object is making, Theta0 is the starting angle)
And a few others
Would it require a rule that doesn't allow it to go more than the length of the string away from the origin, or is it possible to model it with forces too? (It doesn't really matter though, as the spring pendulum doesn't have this restriction)
With the pendulum as a spring, the only thing I can think of to add would be Hooke's law.
Thanks again, and any help would be appreciated.
For about a week now, I've been trying to write what should be a simple python program. The idea is first to write a program for a simple harmonic pendulum, then adapt it to a spring pendulum. However, in order to do this, I have to write the simple harmonic pendulum so that it is moved by forces in certain directions.
I have all (or most?) of the mathematics and physics behind it sorted, but I have no idea how to program it in a way that would include the forces acting upon the pendulum to make it work.
The forces (simple harmonic pendulum):
Gravity: g
Perpendicular: -mgsin(theta)
Bottom of the weight: mgcos(theta)
Total (directionless) speed of weight: [tex]v=\sqrt{2gr(cos(\theta_{1})-cos(\theta_{0}))[/tex] (Theta1 is the current angle the object is making, Theta0 is the starting angle)
And a few others
Would it require a rule that doesn't allow it to go more than the length of the string away from the origin, or is it possible to model it with forces too? (It doesn't really matter though, as the spring pendulum doesn't have this restriction)
With the pendulum as a spring, the only thing I can think of to add would be Hooke's law.
Thanks again, and any help would be appreciated.