Magnetic potential energy in a Gauss gun How does magnetic potential energy have an effect on the velocity on the final ball of the gauss gun (magnetic linear accelerator)?
it is said that the kinetic energy of the last ball (the ball that shoots away) is the sum of the kinetic energy and the magnetic potential energy of the first ball (ball that strikes the magnet) minus the potential energy required to release the ball from their magnets.
Ek(last ball) = [ Ek incoming ball + Ep of incoming ball – Ep of leaving ball – E (sound, heat, rotational) ]
Ep = magnetic potential energy
my question is what is magnetic potential energy in this context and how does it make the final ball have a higher velocity than the first ball?
Edit: this setup is a single stage gun with only one magnet in the system 
 A: If you magnetize the cool before the projectile gets to it, there will be an attractive force. The integral of this force with distance is the work that could be done moving the projectile into the coil.
Now if you leave the coil magnetized you will do equal and opposite work to pull the projectile out again. BUT if you turn off the coil just as the projectile enters it, there will be no force needed to extract and there will be a net increase in velocity (nicely demonstrated in the diagram of the coil gun Wikipedia article linked in the comment under your question.)
A: The magnetic potential energy is equal (in magnitude) to the work you would have to do to separate the balls from the magnet (and each other) and place them at infinity. 
The zero point would be at infinity so the magnetic potential
energy would be negative for both initial and final configurations.
Whatever setup you are using, the final configuration will have a more negative magnetic potential energy. The difference between the initial and final magnetic potential energies will go into the kinetic energy of the exiting ball plus other loss mechanisms. 
If I am imagining your setup correctly, the difference in potential energy arises from the asymmetry of the initial setup (2 balls on one side of the magnet) vs the symmetry of the final state (1 ball either side of the magnet).
