intersection of hypercube and hypersphere

The complexity here comes from the fact that in $n$ dimensions there are $n-1$ types of extended boundaries of the hypercube (in which $1,2,\ldots,n-1$ coordinates are maxed-out at $\pm A$). So, while in $3$ dimensions there are only edges and faces, the nomenclature of "caps" and "corners" does not capture the behavior in higher dimensions. The hypersphere starts intersecting the boundaries of type $j$ when its radius reaches $A\sqrt{j}$, and only fully contains them when its radius exceeds $A\sqrt{n}$, so we expect the final formula to be non-smooth at $n$ different radii.


However, we can find a reasonably simple recursive form. Let $V_n(R)$ be the volume of the intersection in $n$ dimensions when the hypersphere has radius $R$ and the hypercube has side length $2$. Then $$ V_n(R)=\int_{x_1=-1}^{+1}\int_{x_2=-1}^{+1}\cdots\int_{x_n=-1}^{+1}I\left[\sum_{i=1}^{n}x_i^2 < R^2\right]dx_1 dx_2 \cdots dx_n, $$ where $I(\Phi)$ is $1$ when $\Phi$ is true and $0$ otherwise. The integrand is nonzero only when $|x_1|<R$, in which case we have $$ I\left[\sum_{i=1}^{n}x_i^2 < R^2\right]=I\left[\sum_{i=2}^{n}x_i^2 < R^2-x_1^2\right]; $$ so $$ V_n(R)=\int_{x=-\min(1,R)}^{+\min(1,R)}V_{n-1}\left(\sqrt{R^2-x^2}\right)dx. $$ The base of the recursion is $V_0(R)=1$; or, if the $0$-dimensional volume seems too contrived, $V_1(R)=2\min(1,R)$.