Radial flux through a truncated unit sphere (source code)

= Radial flux through a truncated unit sphere
{title2=$\Phi_h(s)=2\pi\int_{-1}^s h(z)\,dz+\pi s(1-s^2)h(s)$}

Let $-1<s<1$ and let $S_s$ be the outward-oriented boundary of $x^2+y^2+z^2\leq1$, $z\leq s$. For a continuous <function> $h:[-1,s]\to\mathbb R$, the <vector field> $\mathbf F=h(z)(x,y,z)^T$ has outward <flux>
$$
\Phi_h(s)=2\pi\int_{-1}^sh(z)\,dz+\pi s(1-s^2)h(s).
$$
On the curved unit <sphere>, the outward <unit normal> is $(x,y,z)^T$, so the normal component is $h(z)$. A horizontal spherical band has <area> $2\pi\,dz$, producing the first term. On the top <disk>, the outward <unit normal> is $(0,0,1)^T$, the normal component is $sh(s)$, and the <area> is $\pi(1-s^2)$, producing the second term.

For $h=f'$ with a continuous first <derivative>, the <fundamental theorem of calculus> gives
$$
\Phi_{f'}(s)=2\pi\bigl(f(s)-f(-1)\bigr)+\pi s(1-s^2)f'(s).
$$
This direct <surface integral> proof needs no second <derivative> of $f$. For $h=1$, it reduces to $\pi(2+3s-s^3)$; the <divergence theorem> identifies this with three times the enclosed <volume>.