Solution (source code)

= Solution

At an end, $x=0$, the <on-axis magnetic field of a finite solenoid> is
$$
B_{\rm end}=\frac{\mu_0NI}{2\sqrt{a^2+L^2}}.
$$
At its centre, $x=L/2$, it is
$$
B_{\rm centre}=\frac{\mu_0NI}{2\sqrt{a^2+L^2/4}}.
$$
The ratio is therefore
$$
\boxed{\frac{B_{\rm end}}{B_{\rm centre}}
=\frac{\sqrt{a^2+L^2/4}}{\sqrt{a^2+L^2}}
=\frac12\sqrt{\frac{1+4a^2/L^2}{1+a^2/L^2}}
\longrightarrow\frac12\quad(L\gg a).}
$$
For a long <solenoid>, $B_{\rm centre}\simeq\mu_0NI/L$ and $B_{\rm end}\simeq\mu_0NI/(2L)$. For a very short <solenoid>, the ratio tends to one, providing a separate check: its centre and end become nearly coincident compared with its <radius>.