Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Rate of Deceleration

  1. Jun 11, 2006 #1
    This is not homework. I'm an old game programmer :smile:

    There is a platform moving at a constant velocity 100. The distance to the 'end' is 75.

    I have 50 clock ticks to begin slowing down at a constant rate so the platform reaches the end spot and is at zero velocity at the end of the time.

    I need to know how much to reduce the velocity each clock tick.

    I know the equation:
    a = 2(d-vt) / t^2

    However this doesn't seem to work for this case. Am I using the wrong formula?
  2. jcsd
  3. Jun 11, 2006 #2


    User Avatar
    Science Advisor
    Gold Member

    I think you're overspecifying the problem. If you calculate a using your formula, you get a = -3.94 which will decelerate you so much that you'll be going in the opposite direction by your end time.

    If you calculate the constant acceleration it takes to get to zero velocity at t=50, (v = vo+at), you get a = -2. That doesn't slow you down enough as you end up at position 2500.

    You don't have enough degrees of freedom to do slow down at a constant rate and end up in that given spot at rest after a given amount of time. You have to relax one of the constraints on your problem. I hope that helps.
  4. Jun 11, 2006 #3

    Andrew Mason

    User Avatar
    Science Advisor
    Homework Helper

    You need to determine how much time it will take to come to a stop in those 75 units of distance. We don't know your units of speed. You can't start with predetermined values for all variables and make them fit. You either set speed, stopping distance and work out the time. Or you set the time and speed and work out the stopping distance.

    Let's do the former:

    [tex]v_f = v_0 - at[/tex] and since vf = 0:

    (1) [tex]a = v_0/t[/tex]

    [tex]d = v_{avg}t = t(v_0 + v_f)/2[/tex] or

    [tex]v_0 = 2d/t[/tex]

    (2) [tex]t = 2d/v_0[/tex]

    Plugging in numbers in (2):

    t = 2*75/100 = 1.5 clock ticks (assuming the 100 is 100 units/clock tick).

    From (1):

    a = 100/1.5 = 66.67 units/clock tick^2

    So every clock tick the speed must reduce by 66.67 units/tick

    Now if you want to make the stopping time 50 ticks, you either have to reduce the speed to 2 units / tick or increase the stopping distance by a factor of 50.

    Last edited: Jun 11, 2006
  5. Jun 11, 2006 #4
    Thanks to both, especially Andrew for the example. After studying it for an embarassingly long time, it finally sunk in :-)
  6. Jun 17, 2006 #5
    Update: I've discovered an issue with my game code that causes it not to work with the standard acceleration formula:

    In my game, objects accelerate in spurts. So when it goes from 0 to 1 to 2 units per second, it starts at 0 for one clock tick, then jumps to 1 for one clock tick, and so on.

    This is an example of how the results differ from the standard equation:
    vo = 100 (original velocity)
    vf = 0 (final velocity)
    d=50 (distance)
    t=1 (1 second, broke up into .05 intervals)
    a=-100 (acceleration)

    I computed the distance travelled from the point where deceleration begins for each time slice using:
    d = vi * t + (.5 * a * t^2)
    Note I'm using .05 to start for time, then .1, .15, etc.

    Code (Text):
    0   0
    4.875   4.75
    9.500   9.25
    13.875  13.5
    18.000  17.5
    The first column is correct. The second column is what my game is producing. It comes up short. The 4.75 is 95x.05 which is the rate one would expect if the object was moving steady at 95 for .05 seconds.

    My long winded question is, can I use another equation to calculate the rate of acceleration when I'm using instant jumps in speed? I've computed by hand this particular example works at -95.25 for acceleration. It reaches 0 at 20 clock ticks of .05 seconds. However I don't know the equation to calculate -95.25.
  7. Jun 17, 2006 #6

    Andrew Mason

    User Avatar
    Science Advisor
    Homework Helper

    This is only correct if you keep changing vi for each time slice. When there is constant acceleration, the speed at the end of each time slice is the speed at the beginning + the change in speed of the time slice, which is: [itex]\Delta v = at[/itex]

  8. Jul 24, 2006 #7
    I'm a bit weak in the physics/math department and could use some help. I'm also trying to compute stopping distance but I have only two parameters: current speed and rate of deceleration. Can someone explain how to compute time and distance in this case?

    I really only need the distance; I'm presuming that time would have to be computed as an intermediate step.
  9. Jul 24, 2006 #8


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    See if you can think it out for yourself!
    I'll help you along:
    First, would you agree that it could be smart to find out exactly WHEN the velocity has become zero?

    If you agree to that, how would you go on about finding that instant?
  10. Jul 24, 2006 #9
    After a bit of pondering, I would think that, since I'm subtracting the rate of deceleration from the initial velocity at regular intervals, the time taken to stop would be initial velocity divided by the rate of deceleration, which makes sense.

    An earlier post by Andrew mentions d=t(v_orig + v_final)/2, which at first seemed wrong to me until I realized that the rate of deceleration is implicit in the computation of t. I'm now thinking this to be the correct formula.

    I shudder to think how much less simple it would be were the deceleration rate not constant. I'll consider myself lucky. :)
  11. Jul 24, 2006 #10


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    You have thought correctly!
    Great that you found out the emphasized insight on your own!:smile:

    When it comes to the non-constant deceleration case, would you agree that the natural way of doing this is to regard the deceleration as piecewise constant over tiny time intervals?
    On each such time interval, this would be a good approximation, and we could use our insights from the strictly constant case in order to calculate the new velocity&traversed distance over that interval of time..
    Last edited: Jul 24, 2006
  12. Jul 24, 2006 #11
    Thanks for helping me out. I really appreciate it. :)

    I would certainly agree with the treatment of non-constant decleration as a series of piece-wise constant declerations for equal (and sufficiently small) amounts of the total time, but that's reached the point where I just can't see the math in my head anymore (I can visualize everything that's going on but I just don't have the mental tools yet to make a formula out of it).

    I'm assuming the rate of change to the deceleration rate to be itself a constant, else my brain would explode. :P
  13. Jul 24, 2006 #12


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    Apart from setting up some fancy notation for such humongous series, no mathematician would have it any easier to see what is going on than you, if it hadn't been for the most useful theorem in the history of maths:
    The fundamental theorem of Calculus.

    Armed with this weapon, the mathematician has an amazingly simple way to actually CALCULATE such huge sums.

    It is because of this theorem that all theoretical modern science has been able to flourish.

    It was Sir Isaac Newton and Leibniz for whom this theorem dawned upon first (independently of each other).
    Last edited: Jul 24, 2006
  14. Jul 25, 2006 #13


    User Avatar
    Homework Helper

    Recognize that the clock ticks are just a sampling rate and not the unit of time for this problem. You've also put a constraint on the number of clock ticks, fixing them at 50.

    You need to calcuate the rate of constant deceleration, and the amount of time it takes for the platform to stop.

    This was already done previously and as posted a = -66.66666... and t = 1.5

    Given the contraint that there are 50 clock ticks, a clock tick is 1.5 t / 50 = .03 t

    Then for each clock tick, the velocity decreases by the rate of deceleration times the elapsed time of a clock tick.
    Change in velocity for each tick is .03 t x -66.6666... = 2.0

    Average velocity for each tick is 1/2 x (initial velocity+final velocity)

    Distance moved per tick is the average velocity for the tick period times the tick period.

    Code (Text):

    tick  time  position  velocity  average velocity
     0    0.00   0.00     100
     1    0.03   2.97      98       99
     2    0.06   5.88      96       97
     3    0.09   8.73      94       95
    49    1.47  74.97       2        3
    50    1.50  75.00       0        1
    Last edited: Jul 25, 2006
  15. Jul 25, 2006 #14


    User Avatar
    Homework Helper

    In the real world of physics, even an ordinary event as simple ballastics that take into account the density of atmoshpere, and change in gravity versus altitude end up producing differential equations that can't be solved directly, so the answer is numerical integration, implemented via a series of small steps in time, which is similar to the process you're describing.

    In this example, the differential equations return an acceleration vector given a velocity vector and position for the object in question. Then then for a small step in time later, a new velocity and position is calculated. A new acceleration vector is calculated using the new velocity and position and the process is repeated. Keeping history of the results in the previous steps can improve accuracy, such as Runge Kutta techniques.

    Racing games are normally implemented in the same way. The simulated car's position, orientation vector, velocity vector, (orienation versus direction is the yaw) user control inputs (brake, throttle, steering), tire / pavement grip (including slip angle and spin effects), banking of the track, ... are used to calculate an acceleration vector. Then the process as mentioned above is used predict a new velocity, orientation, and position over small steps in time.
    Last edited: Jul 25, 2006
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook