Thin-quadrupole energy dependence (source code)

= Thin-quadrupole energy dependence
{title2=$f(E)=f_0[1+\delta/\beta_0^2]+O(\delta^2)$}

At fixed gradient and magnet length, the signed thin-lens <focal length> is proportional to particle <momentum>. For total <energy> error $\delta=(E-E_0)/E_0$, differentiating $p^2c^2=E^2-m^2c^4$ gives $d\ln p/d\ln E=1/\beta^2$. The ultrarelativistic result is $f=f_0(1+\delta)$ to first order. If energy means kinetic energy instead, the coefficient is $(K+mc^2)/(K+2mc^2)$.