Quoted By:
The ideal gas laws, and a bit of the physics of materials. Since you won't practically be able to accelerate nails out of the gun using magnetism, your only real option is to release a shit-ton of high pressure air onto the back of the nail. The alternative would be to have a gas chamber into which you release methane to be combusted within, and you use that to fire out the nail. Regardless, you'll need to know the tensile strength of the materials being used to contain the pressure, such that when you use PV=nRT to determine the pressure exerted on the gun you've designed, the thing won't just blow itself apart or become critically damaged.