this is an energy question
the potential energy at the starting h is M*g*h
the kinetic energy at the top of the loop is 1/2 *m*v^2
the potential energy must be such that KE is greater than zero at the top of the loop, at least!
the height drop from the starting point to the top of the loop is the only dependance in an ideal world, the radius does not matter. So as long as the starting point is just above the top of the loop, h>0, the rollercoaster will complete the loop. However, there's a big difference in yours, that's due to friction between the cart and track.
In you equations:
total energy = mgh
total energy =1/2mv^2
h is proportional to v^2, g and m are constant
the 'extra h' is the frictional energy to be over come which is simply:
where, h is the starting height above the top of the loop
you can go into more detail if you want here:
and there's a niceanimation of what I explained here: