Swinging String Attached to Mouse Cursor: Vectors Explored

  • Thread starter Thread starter phaelax
  • Start date Start date
  • Tags Tags
    String Vectors
AI Thread Summary
The discussion centers on programming a simulation where a ball is attached to a mouse cursor by a string, focusing on the physics of motion and forces involved. Key forces include gravity, which always acts downward, and tension, which pulls the ball toward the cursor. Participants suggest starting with a simplified model that only considers gravity and tension before introducing cursor movement and eventually adding friction and drag. The importance of understanding these forces is emphasized, as they are crucial for accurately simulating the swinging motion. The conversation highlights a structured approach to developing the program while learning physics concepts.
phaelax
Messages
4
Reaction score
0
I'm trying to write a program where a piece of string is attach to the mouse cursor, and the other end has a ball on it. I want to be able to swing it around freely, but I'm not sure how to figure all the vectors. So far, I have 2 force vectors, gravity and the mouse cursor. Any ideas where else I can start?
 
Physics news on Phys.org
The two forces that act on the ball is tension and gravity. The gravity force vector should always point from the ball downwards, and the tension force vector should always point from the ball towards the cursor (assuming the string is to remain straight at all times).

If you are allowing the string to stretch, you can treat it as a spring, in which case the magnitude of its force is proportional to the elongation of the string. If it's not allowed to stretch the magnitude of the force would vary depending on the position of the ball and its motion, with a maximum allowed tension so the string will be torn if the limit is exceeded.
 
So if I were to move the cursor to the left, pulling the string, the ball at the end would swing back and forth when I stop moving the cursor. How would I do that? Since gravity is always pulling down on it, I know its got to have something to do with gradually slowing the swinging.
 
Well, theoretically the swinging should not stop. In real life it does, due to friction... but are you going to account for that as well?
 
The ball will be swinging in the air. So the only thing that could affect it is wind or gravity, right?
 
phaelax said: "Since gravity is always pulling down on it, I know its got to have something to do with gradually slowing the swinging."

Gravity doesn't make the ball stop swinging back and forth, in fact without gravity, it wouldn't swing back and forth at all. The only thing that would make it stop swinging is friction at the point where the cursor is attached to the string, and as you said, wind, or the drag caused by the ball moving through the air. But trust me here, you don't want to mess with that yet! If I were you, I'd do this in 3 steps.

1) Don't let the cursor move, and just model two forces: gravity (constant and always down) and tension (magnitude T and always along the direction of the string). You can get help from people here on how to calculate T if you can't figure it out.

2) Now let the cursor accelerate

3) Now add the drag and frictional forces.

If you can make it through #1 you will have learned quite a bit of physics, and it will be pretty cool

If you can make it through #2, you will have learned A LOT of physics and it will be VERY cool! (And I'll want a copy!)

So let us know how it goes.
 
Last edited:
I have recently been really interested in the derivation of Hamiltons Principle. On my research I found that with the term ##m \cdot \frac{d}{dt} (\frac{dr}{dt} \cdot \delta r) = 0## (1) one may derivate ##\delta \int (T - V) dt = 0## (2). The derivation itself I understood quiet good, but what I don't understand is where the equation (1) came from, because in my research it was just given and not derived from anywhere. Does anybody know where (1) comes from or why from it the...
Back
Top