\section{Examples}
\label{sec:example}
%
\paragraph{Example 1}
Let $\domain(r) := \{ \bx \in \Real^2 \;:\; \|\bx\| \leq r \}$ be a 2D disc centered at the origin with radius $r$ and
%
\begin{equation}
    \label{eqn:example1_I}
    I(r) := \int_{\domain(r)} \frac{1}{\| \bx \|} \,\D A(\bx),
\end{equation}
%
where $\D A$ denotes the area measure.
In this case, the boundary is simply the circumference of the disc: $\boundary(r) = \{ \bx \in \Real^2 \;:\; \|\bx\| = r \}$.
Then, since the integrand $1/\|\bx\|$ does not depend on $r$, according to \thmref{reynolds}, it holds that
%
\begin{equation}
    \label{eqn:example1_dI}
    \begin{split}
	    \left(\frac{\partial}{\partial r} I\right)(r)
	    &= \int_{\boundary(r)} \frac{\langle \gnorm(\bx), \velocity(\bx) \rangle}{\|\bx\|} \,\D\ell(\bx)\\
	    &= \int_{\boundary(r)} \frac{\langle \gnorm(\bx), \velocity(\bx) \rangle}{r} \,\D\ell(\bx),
    \end{split}
\end{equation}
%
where $\D\ell$ denotes the curve length measure.
Based on the parameterization of $\domain$, it holds that the normal velocity $\langle \gnorm(\bx), \velocity(\bx) \rangle$ on any point $\bx$ on its boundary $\boundary$ equals one constantly.
Thus, Eq.~\eqref{eqn:example1_dI} becomes
%
\begin{equation}
    \label{eqn:example1_dI_2}
    \left(\frac{\partial}{\partial r} I\right)(r)
    = \int_{\boundary(r)} \frac{1}{r} \,\D\ell(\bx)
    = 2\pi r \cdot \frac{1}{r} \equiv 2\pi,
\end{equation}
%
which agrees with the result obtained by directly differentiating Eq.~\eqref{eqn:example1_I}.
Specifically, it can be shown that $I(r) = 2\pi r$, yielding $\left(\frac{\partial}{\partial r} I\right) (r) \equiv 2\pi$.

\paragraph{Example 2}
We now alter the first example by making the integrand to depend on $r$:
%
\begin{equation}
    \label{eqn:example2_I}
    I(r) := \int_{\domain(r)} \frac{r}{\| \bx \|} \,\D A(\bx).
\end{equation}
%
Then, it holds that $I(r) = 2\pi r^2$.
Since $\frac{\partial}{\partial r} (r/\| \bx \|) = 1/\| \bx \|$, we have
%
\begin{equation}
    \label{eqn:example2_dI}
    \left(\frac{\partial}{\partial r} I\right)(r)
    = \underbrace{\int_{\domain(r)} \frac{1}{\| \bx \|} \,\D A(\bx)}_{=\; 2\pi r} + \underbrace{\int_{\boundary(r)} \D\ell(\bx)}_{=\; 2\pi r}
    = 4 \pi r,
\end{equation}
%
which agrees with $\left(\frac{\partial}{\partial r} I\right)(r) = \frac{\partial}{\partial r} (2\pi r^2) = 4\pi r$.

\paragraph{Example 3}
We now extend the previous example to 3D by letting $\domain(r) := \{ \bx \in \Real^3 \;:\; \|\bx\| \leq r \}$, $\boundary(r) = \{ \bx \in \Real^3 \;:\; \|\bx\| = r \}$, and
%
\begin{equation}
    \label{eqn:example3_I}
    I(r) := \int_{\domain(r)} \frac{r}{\| \bx \|^2} \,\D V(\bx),
\end{equation}
%
where $\D V$ denotes the volume measure.
Then, it holds that $I(r) = 4\pi r^2$.
As $\frac{\partial}{\partial r} (r/\| \bx \|^2) = \| \bx \|^{-2}$,
%
\begin{equation}
    \label{eqn:example3_dI}
    \left(\frac{\partial}{\partial r} I\right)(r)
    = \underbrace{\int_{\domain(r)} \frac{1}{\| \bx \|^2} \,\D V(\bx)}_{=\; 4\pi r} + \underbrace{\int_{\boundary(r)} \frac{1}{r} \D A(\bx)}_{=\; 4\pi r}
    = 8 \pi r,
\end{equation}
%
which agrees with the direct differentiation of $I(r)$.

\paragraph{Example 4}
We now consider an example where the integrand is discontinuous on the boundary.
Specifically, for all $\bx \in \Real^3$, let
%
\begin{equation}
	\label{eqn:example4_f}
	f(\bx \;|\; r) = \begin{cases}
		1 & \| \bx \| < r,\\
		\text{undefined} & \| \bx \| \geq r.
 	\end{cases}	
\end{equation}
%
Note that, although $f$ is undefined when $\| \bx \| = r$, it remains integrable over $\domain(r)$ under the volume measure. %as the domain where it is undefined has zero measure.
Let
\begin{equation}
	\label{eqn:example4_I}
	I(r) = \int_{\domain(r)} f(\bx \;|\; r) \,\D V(\bx).
	%= \frac{4}{3} \pi r^3,
\end{equation}
%
It is easy to verify that $I(r) = \frac{4}{3} \pi r^3$.
Differentiating Eq.~\eqref{eqn:example4_I} using \corref{main} yields
%
\begin{equation}
	\label{eqn:example4_dI}
	\left(\frac{\partial}{\partial r} I\right)(r) = \int_{\interface(r)} \underbrace{\lim_{\epsilon \to 0^-} f(\bx + \epsilon\,\velocity(\bx) \;|\; r)}_{=\;1} \,\D A(\bx) = 4\pi r^2,
\end{equation}
%
which agrees with direct differentiation of $I$ as $\frac{\partial}{\partial r}\left(\frac{4}{3}\pi r^3\right) = 4\pi r^2$.

\begin{figure}[t]
	\centering
	\includegraphics[width=1.6in]{images/sph_cap.pdf}
	\caption{\label{fig:example5}
		Calculating the projected velocity for Example 5.
	}
\end{figure}

\paragraph{Example 5}
In this example, we consider the derivative of the solid angle (viewed from the origin) subtended by a unit-radius sphere centered at $(0, 0, d)$ with $d > 1$.
Let $\domain$ be the projection of the sphere on $\Sph$, which is a spherical cap, then the solid angle equals the surface area of $\domain$ given by
%
\begin{equation}
	\label{eqn:example5_I}
	I(d) = \int_{\domain(d)} \,\D A(\bom).
\end{equation}
%
According to \thmref{reynolds}, differentiating Eq.~\eqref{eqn:example5_I} leads to
%
\begin{equation}
	\label{eqn:example5_dI}
	\left( \frac{\partial}{\partial d} I \right)(d) = \int_{\boundary(d)} \langle \gnorm(\bom), \velocity(\bom) \rangle \,\D\ell(\bom),
\end{equation}
%
where $\gnorm(\bom)$ and $\velocity(\bom)$ are the normal and velocity of the boundary $\boundary$ at $\bom$, respectively.
Note that both $\gnorm(\bom)$ and $\velocity(\bom)$ lie within the tangent plane at $\bom$.
As shown in the Figure~\ref{fig:example5}, it holds that $\langle \gnorm(\bom), \velocity(\bom) \rangle \equiv -1/(d \sqrt{d^2 - 1})$ for all $\bom \in \boundary(d)$.
Thus,
%
\begin{equation}
\label{eqn:example5_dI_2}
\left( \frac{\partial}{\partial d} I \right)(d) = -\frac{2\pi}{d^2 \sqrt{d^2 - 1}}.
\end{equation}
%
On the other hand, we know that $I(d) = 2\pi (1 - \sqrt{1 - (1/d)^2})$.
Differentiating this symbolically yields the same answer as Eq.~\eqref{eqn:example5_dI_2}.
