I posted this question on the physics page. I feel like it might be better suited to this site, though.
Suppose we have an ideal LC circuit (no resistance) and an open switch where the capacitor has an initial voltage \$V_o\$.
Initially, the energy stored in the capacitor at \$t=0\$ is \$\frac{1}{2}CV_o^2\$ and the energy in the magnetic field of the inductor is zero because no current is flowing.
Now at time \$t=0+dt\$ we close the switch and current slowly begins to build up. When the current is a maximum, the energy stored in the magnetic field of the inductor is \$\frac{1}{2}LI^2\$ but now the energy stored in the capacitor is zero.
Thus we must have that \$\frac{1}{2}LI^2=\frac{1}{2}CV_o^2\$ because no energy is dissipated since there is no resistance.
There seems to be something very wrong here at a fundamental level. The charge (the electrons) traveling through the inductor at the instant that the current is a maximum have a non-zero kinetic energy (denote this kinetic energy \$K_{charge}\$.) They have to have non-zero kinetic energy since they constitute a current. But if they do posses this energy in addition to the magnetic field energy \$\frac{1}{2}LI^2\$, then the total energy at the moment the current is a maximum will equal \$E_{tot}=\frac{1}{2}LI^2+K_{charge} >E_{initial}=1/2CV_o^2\$. So it seems we have created energy in this process.
The only way I can work around this issue is to assume that the kinetic energy is already somehow factored into the magnetic field energy but I am not sure.