View Full Version : Balancing GPE & KE
ma1ic3
17th September 2006, 12:26 PM
I am making a simple program with a ball that drops and bounces back up. Right now the conditions are ideal, there is no loss of energy.
As the ball drops, the GPE goes down and the KE goes up. But the GPE goes down faster than the KE goes up. The ball is set at a height of 500 meters with a mass of 10 kilograms. It takes it about 3-4 seconds to hit the ground. At that point the KE is around 4,000, but the GPE started out at 49,000. I tried to see how fast the velocity would have to be for it to reach a KE that high, and it was about 100 m/s. That seems to high for a drop of 500 meters.
GPE[49000]=m[10]*g[9.8]*h[500]
KE[49005]=0.5*m[10]*v[99]^2
Hellbound
17th September 2006, 12:45 PM
Well, the final velocity squared is 2 * acceleration * distance (see here (http://id.mind.net/~zona/mstm/physics/mechanics/kinematics/EquationsForAcceleratedMotion/Origins/TimeIndependent/Origin.htm)).
So,
Vf2 = 2 * 9.8m/s2 * 500m
Vf2 = 9800m2/s2
Vf = 98.995 m/s
Seems that's about right.
Zombified
17th September 2006, 12:46 PM
Half a kilometer of acceleration with no air resistance. It'll be going quickly.
By comparison, 0-60 in 10 seconds, a decent car (but not sports car) acceleration, is only around a quarter G.
For further comparison the speed of sound is about 340 m/s.
Ziggurat
17th September 2006, 12:55 PM
I am making a simple program with a ball that drops and bounces back up.
Is your program solving the equations of motion exactly, or are you doing some sort of numerical integration(ala Euler's method, etc.)?
ma1ic3
17th September 2006, 01:24 PM
I am not using any special kind of method. The code is in a timer that goes off every 10 milliseconds. vD is distance traveled, vV is velocity and vG is the gravitational acceleration (9.8).
ball1.vD += ball1.vV * 0.1
then later on in the code...
ball1.vV += vG * 0.01
I uploaded a copy of it if you want to see it. Just click HERE (www.inevuluns.com/parts/xphysBall(beta).exe). The ball hits the ground before it can reach 100 meters per second. Don't pay attention to the textboxes on the right side, they don't do anything at this point of time.
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'THE CEILING is 32 and the GROUND is 532
'Gravitational Acceleration is 32.1741 feet per second
ball1.vD += ball1.vV * 0.1 '(Distance = Velocity * Time)
ball1.vH = 500 - (ball1.Pos.Y - 32)
ball1.vT1 += 0.01
ball1.vT2 += 0.01
ball1.vGPE = ball1.vM * vG * ball1.vH '(GPE = mgh)
ball1.vKE = (ball1.vM * ball1.vV ^ 2) / 2 '(KE = mV^2 / 2)
ball1.vEnergy = ball1.vGPE + ball1.vKE
ShowINFO()
'COLLISION DETECTION (THE GROUND)
If ball1.vPoint + ball1.vD > 531 Then
ball1.Pos.Y = 532
ball1.vDirectionY = "up"
ball1.vD = 0
ball1.vT2 = 0
'ball1.vV += ball1.vG * 0.01
End If
'MAXIMUM GPE, TIME TO COME BACK DOWN
If ball1.vV <= 0 And ball1.vH >= 0 Then
ball1.vDirectionY = "down"
ball1.vPoint = ball1.Pos.Y
ball1.vD = 0
ball1.vT2 = 0
End If
'MOVE DOWN
If ball1.vDirectionY = "down" Then
ball1.Pos.Y = ball1.vPoint + ball1.vD
ball1.vV += vG * 0.01
End If
'MOVE UP
If ball1.vDirectionY = "up" Then
ball1.Pos.Y = 532 - ball1.vD
ball1.vV -= vG * 0.01
End If
'MAKE SURE VELOCITY IS NOT NEGATIVE
If ball1.vV < 0 Then
ball1.vV = 0
End If
'IF ENERGY IS 0 THEN STOP LOOP/TIMER
If ball1.vEnergy = 0 Then
Timer1.Enabled = False
End If
Me.Invalidate()
End Sub
Ziggurat
17th September 2006, 01:32 PM
I am not using any special kind of method. The code is in a timer that goes off every 10 milliseconds. vD is distance traveled, vV is velocity and vG is the gravitational acceleration (9.8).
ball1.vD += ball1.vV * 0.1
then later on in the code...
ball1.vV += vG * 0.01
I uploaded a copy of it if you want to see it. Just click HERE (www.inevuluns.com/parts/xphysBall(beta).exe). The ball hits the ground before it can reach 100 meters per second. Don't pay attention to the textboxes on the right side, they don't do anything at this point of time.
The method you used is a simple Euler integration (not that the name is important, but it's a little bit of trivia for you).
I can't run it right now, but if you cut and pasted from your code (as opposed to making a typo transcribing it for this post), then your problem appears to be simply that the time interval used to increment your position is 10 times as large as the time interval used to increment your position (0.1 seconds versus 0.01 seconds). If that's what happened, that certainly would make your ball reach the ground too soon.
Yup, just saw your update, I think that's the problem (line 4 of your code).
It's always the stupid things with debugging. :)
Hellbound
17th September 2006, 01:33 PM
ball1.vD += ball1.vV * 0.1
then later on in the code...
ball1.vV += vG * 0.01
Hmm.
I think your approach is going to cause some errors, but I don't have the understanding others do. For example, the displacement is not equal to the velocity of the ball *.1. The first second is a great example: the ball ends that first second going 9.8m/s, and will travel 4.8 meters. The second second the ball will end at 19.6m/s, and travel 14.6m total distance (the 4.8 plus an additional 9.8).
Your velocity/gravity change seems right, though. I think you're mis-figuring distance, but I'll have to think about how to figure it :)
ETA: And I'd go with Zig's comments above over mine :)
Ziggurat
17th September 2006, 01:42 PM
I think your approach is going to cause some errors, but I don't have the understanding others do.
That's true with any numerical integration technique, but the errors decrease the smaller the time interval used (of course, it takes more computer time to calculate finer time slices). There are more sophisticated integration techniques (google Runge-Kutta, for example) which can make these errors significantly smaller than the Euler method above, but you can't totally eliminate that problem with any technique (other than an analytic solution, which is possible here but not in general). But the errors from the Euler technique for this problem should be fairly small (I'd guess less than 1%), at least for one bounce.
ma1ic3
17th September 2006, 01:54 PM
Thanks. That was the problem. I can't believe I overlooked that. I'll be sure to check out the other methods.
© 2001-2009, James Randi Educational Foundation. All Rights Reserved.
vBulletin® v3.7.5, Copyright ©2000-2009, Jelsoft Enterprises Ltd.