A train car with a mass of m 500kg on a frictionless track
     A train car with a mass of m = 500kg on a frictionless track with an initial aped of v_0 = 3 m/s. It rolls up a hill with a height of h = 0.4m. After rolling up the hill train car runs into a spring with a spring constant of k = 200N/m and brought to rest.  Using the coordinate system shown determine the total mechanical of the system.  Determine the speed of the train car at the top of the hill (point A).  Determine how far the spring gets compressed in stopping the train car. 
  
  Solution
a)total mechanical energy = KE+PE = 1/2mv2+mgx = 1/2*500*32 + 500*9.8*0=2250J
b)Work by gravity = change in KE
-mgh = 1/2mv2 - 2250
1/2mv2 = 2250-mgh = 2250-500*9.8*0.4=290
v = (2*290/m)1/2 = 1.077m/s
3)at most compression v=0
so
work done by spring = change in KE
-1/2kx2 = 0 - 290
x = (2*290/k)1/2 = 1.70m

