Antiderivatives on disconnected domains (source code)

= Antiderivatives on disconnected domains
{title2=$(G-F)|_{I_j}=C_j$}

Let $U$ be an <open subset> of the <real line>, and let $F,G$ be <antiderivatives> of the same <function> on $U$. Each <connected component> $I_j$ is an open <interval>. On that component, $(G-F)'=0$, so the <mean value theorem> gives $G-F=C_j$. The constants on different components are independent: there is no subinterval inside $U$ joining them. Conversely, adding any chosen constant on each component preserves the <derivative> everywhere on $U$.

For example, the domain of $g(x)=1/x$ is $U=\mathbb R\setminus\{0\}$. Every <antiderivative> on this domain has the form
$$
F(x)=
\begin{cases}
\log|x|+C_-,&x<0,\\
\log|x|+C_+,&x>0,
\end{cases}
$$
with arbitrary real $C_-,C_+$. The <logarithm> of the <absolute value> differentiates to $1/x$ on each side. The function with $C_-=2$ and $C_+=-1$ is therefore a valid <antiderivative>, although it cannot be written as $\log|x|+C$ with one global constant.

\Image[/antiderivative-disconnected-domain-constants.png]
{title=Two disconnected intervals allow independent constants while the derivative stays the same}

An <initial condition> at $x=1$ fixes $C_+$ and leaves $C_-$ free. Fixing both constants requires one reference value in each <connected component>, or additional conditions that couple the components. The <locally constant function> $F(x)-\log|x|$ captures this remaining freedom.