How Can Gravity Affect Distance Traveled in a Coding Simulation?

Click For Summary

Discussion Overview

The discussion centers around coding a simulation that incorporates the effects of gravity on the distance traveled by an object in free fall. Participants explore the mathematical relationships involved in calculating distance based on velocity and time, particularly when starting from a paused state without initial conditions.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant proposes using the equation Velocity = Vi * t + 0.5 * G * T2 to calculate distance, but seeks clarification on how to apply it without initial conditions.
  • Another participant corrects the initial equation, suggesting Vf = Vi + G * t and Xf = Xi + Vi * t + .5 * G * t2 as more appropriate for the context.
  • A later reply emphasizes the importance of distinguishing between gravity as a force and its effect as a constant acceleration, suggesting that the correct approach involves using the velocity at the moment of pausing as the initial velocity in the distance calculation.
  • One participant shares a personal anecdote about struggling with the problem due to a lack of physics background, indicating a misunderstanding of how to apply the equations correctly.
  • Another participant introduces a self-created formula for calculating distance but later expresses a preference for the established equation, indicating a desire for clarity and correctness in their approach.

Areas of Agreement / Disagreement

Participants exhibit some agreement on the need to use the correct equations for calculating distance under the influence of gravity, but there is disagreement regarding the terminology and the initial conditions necessary for these calculations. The discussion remains unresolved regarding the best approach to take without initial conditions.

Contextual Notes

Participants express uncertainty about the initial conditions required for their calculations, and there are unresolved issues regarding the application of the equations in the context of a paused fall. Some participants also highlight the importance of precise terminology in physics, which may affect their understanding of the concepts discussed.

bnpla
Messages
3
Reaction score
0
I'm tyring to code an engine that simply adds gravity to the world.
I know that gravity is a constant value added to the velocity of an object on each second, like this:

Velocity = Vi * t + 0.5 * G * T2

What I'm tyring to figure out, is the distance traveled of an object falling from any point in time, without having the values of the initial time or initial velocity...

Let's say i drop a coin from some distance to the floor. Now let's say i stop the time at some X seconds. I want to know how much the coin will move in the Y axis only knowing the velocity of the coin at that particular time and nothing else.

I don't want to know the total distance since i dropped the coin. I want to know the distance that the coin will travel starting from the moment i paused the fall to 1 second forward in time.
 
Physics news on Phys.org
bnpla said:
I'm tyring to code an engine that simply adds gravity to the world.
I know that gravity is a constant value added to the velocity of an object on each second, like this:

Velocity = Vi * t + 0.5 * G * T2

That equation is incorrect

Vf = Vi + G * t
Xf = Xi + Vi * t + .5 * G * t2

I don't want to know the total distance since i dropped the coin. I want to know the distance that the coin will travel starting from the moment i paused the fall to 1 second forward in time.

Rewrite the second equation above.

distance = Xf - Xi = Vi * t + .5 * G * t2

Use the velocity when you paused as Vi and use 1 for t.
 
It should be:
Distance = Vi * t + 0.5 * G * T2
so use this formula with v_i=v(X) and T=1
 
Welcome to PF!

bnpla said:
I'm tyring to code an engine that simply adds gravity to the world.
I know that gravity is a constant value added to the velocity of an object on each second, like this:

Velocity = Vi * t + 0.5 * G * T2

Just a complaint about terminology: I would not say that gravity IS a constant value added to the velocity of an object each second. Gravity is a force. It is true that the force of gravity ADDS a constant value to the (vertical) velocity of a falling object each second. In other words, the force of gravity causes a constant acceleration. That is its effect. The change in velocity in one second due to this acceleration is what you described above. You might think I'm being pedantic, but it is important to distinguish between different types of quantities in physics. Gravity is a force, and a force is not the same thing as a velocity or an acceleration. A force causes an acceleration, which implies a change in velocity.

bnpla said:
What I'm tyring to figure out, is the distance traveled of an object falling from any point in time, without having the values of the initial time or initial velocity...

Let's say i drop a coin from some distance to the floor. Now let's say i stop the time at some X seconds. I want to know how much the coin will move in the Y axis only knowing the velocity of the coin at that particular time and nothing else.

I don't want to know the total distance since i dropped the coin. I want to know the distance that the coin will travel starting from the moment i paused the fall to 1 second forward in time.

You can still use the same equation and just take NOW to be the initial time, and "one second from now" to be the final time. So, in this situation, vi is the velocity now which we are taking to be the initial velocity. The important thing to remember is that the equation is actually:

d = vi Δt + (1/2)a(Δt)2

where Δt is the difference between the final time (after the distance has been travelled) and the initial time. Normally, we take the initial time to be t = 0, and the final time, t is the amount of elapsed time "up to now", so that Δt = t - 0 = t, and it's just fine to replace Δt with t. But if you're not starting at t = 0, then that's not the case.

Example:

You're watching a recorded video of me dropping a coin. Suppose, at t = 0, I dropped the coin (i.e. I released it from rest) from a height of 1 metre. Suppose that you come into the room 3 seconds after the video had already started. So you don't know what the initial height was. All you know is that right now at this instant (at t = 3 s) it is falling at a speed of 29.43 m/s. (Somehow you were able to determine this -- who cares how). Now, you want to determine how far it will have fallen (below its current height) one second from now, at t = 4 s. All you have to do is take the initial time ti to be 3 s , and the final time, tf to be 4 s. Then Δt = tf - ti = 1 s. In this time interval, the object will fall a distance:

d = vi Δt + (1/2)a(Δt)2

= (-29.43 m/s)*(1 s) + (1/2)(-9.81 m/s2)*(1 s)2

= -29.43 m - (4.905 m/s2)*(1 s2)

= -34.335 m

Notice that the ONLY numbers I used in the calculation above were: 1. the time interval I was interested in (1 s), 2. the velocity at the beginning of that time interval, and 3. the acceleration due to gravity.

A slight flaw with my example is that an object dropped from a height of 1 m would hit the floor long before t = 3 s, but who cares? It's irrelevant to the example. This is the distance that a freely falling object with that initial downward speed will fall in 1 second regardless of where or how fast it started.
 
cepheid said:
Welcome to PF!

Just a complaint about terminology: I would not say that gravity IS a constant value added to the velocity of an object each second. Gravity is a force. It is true that the force of gravity ADDS a constant value to the (vertical) velocity of a falling object each second. In other words, the force of gravity causes a constant acceleration. That is its effect. The change in velocity in one second due to this acceleration is what you described above. You might think I'm being pedantic, but it is important to distinguish between different types of quantities in physics. Gravity is a force, and a force is not the same thing as a velocity or an acceleration. A force causes an acceleration, which implies a change in velocity.

Yes i know, i was in a rush, and i do agree that terminology IS important.

cepheid said:
You can still use the same equation and just take NOW to be the initial time, and "one second from now" to be the final time. So, in this situation, vi is the velocity now which we are taking to be the initial velocity. The important thing to remember is that the equation is actually:

d = vi Δt + (1/2)a(Δt)2

Thanks! Finally i can sleep! Having no background in physics, this simple problem was killing my poor brain, lol. At one time i was using that same formula, and i was getting wrong results, but after i saw this posts i noticed my error: i was taking the initial distance rater than speed in the first component of the equation, so that was destroying my rational brain haha.

Ok, problem solved!


As a side note, i ended up solving this problem on a diferent manner a few moments before reading this post. I formulated this:

*** Warning: this formula was made up without physics knowledge ***

Code:
Let V = Velocity of the object at a given time.
Let Y = Vertical position of the object at a given time.

StepY = V * (V/g)  * 0.5  - Y; //this is how much the object will move in the next second.
 
PS: i will use the d = vi Δt + (1/2)a(Δt)2 formula, my "made up formula" is way to ugly, and it was a desperated attempt to solve my problem. Doing Vi + 0.5 * a is way cleaner, because i will always evaluate 1 second ahead of time.
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 9 ·
Replies
9
Views
1K
Replies
3
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
Replies
12
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
5K