Force on dielectric slab My Doubt is  regarding the procedure of calculating force on dielectric while it is being inserted between the capacitor plates (with or without battery).
This is the theory behind it.
Consider a capacitor which is charged and disconnected from the battery.
Now the energy stored in the capacitor is calculated by using the energy density equation,
$$\mathrm dU=\frac{1}{2} \epsilon_0 E^2\mathrm dV$$ 
Thus limiting the above equation to the region in between the capacitor we get the energy stored as $$U=\frac{Q^2}{2C}=\frac{1}{2} C V^2$$ 
Now to claculate the force on the dielectric we can write 
$$|F|=\biggr|\frac{\mathrm dU}{\mathrm dx}\biggr|$$
As the battery is disconnected, charge on the plates remain constant,so taking $U= \frac{Q^2}{2C}$
We get, $$|F|=\left|\frac{Q^2}{2C^2} \frac{\mathrm dC}{\mathrm dx}\right|$$
Now finding the C as a function of the distance covered by dielectric and differentiating with respect to it($x$) and thus substituting them in the above equation we get the force required.
If fringing electric field is the reason for the force on dielectric(as shown in the below picture), how can $\frac{\mathrm dU}{\mathrm dx} $ give the required  force where U is not the energy of fringing field but the energy as uniform field in between the capacitors!
Please explain. 

 A: To quote Griffith's E&M Text (3rd edition pg. 196)

Notice that we were able to determine the force without knowing anything about the fringing fields that are ultimately responsible for it! Of course, it's built into the whole structure of electrostatics that $\nabla\times\mathbf E=0$, and hence that the fringing fields must be present; we're not really getting something for nothing here - just cleverly exploiting the internal consistency of the theory. The energy stored in the fringing field themselves (which was not accounted for in this derivation) stays constant as the slab moves; what does change is the energy inside the capacitor, where the field is nice and uniform. (Bold emphasis mine)

The key is that $\frac{\text dU}{\text dx}=0$ where the fringing fields are, because on one side there is always dielectric and on the other side there is always no dielectric. The movement of the dielectric therefore does not change the energy outside of the capacitor, and hence we do not need to take this energy into account when looking at the change in energy as the dielectric moves.
Based on this, I suppose you would need to start considering the effects due to the change in energy once the dielectric slab starts "running out". But the derivation you have supplied is most likely considering the scenario where the end of the dielectric is "far enough* away from the capacitor.
