Consider the function:
$$f(a) = \frac{K\left(\frac{2 k(a) i}{g(a) + k(a) i}\right)}{\sqrt{g(a) + k(a) i}}$$
where $g(a)$ and $k(a)$ are smooth real-valued functions of a real parameter $a\in[0,1]$, with $g(a)$ positive on part of its domain, and $k(a)$ positive on its entire domain. $K$ is the complete elliptic integral of the first kind, and we are following the convention where:
$$K(m) = \int_0^{\pi/2}\frac{1}{\sqrt{1-m \sin(\theta)^2}}\,d\theta$$
When $g(a)\ge 0$, $f(a)$ will be real-valued. However, if $g(a)$ becomes negative at a point where:
$$\Re\left(\frac{2 k(a) i}{g(a) + k(a) i}\right) \gt 1$$
then we encounter a branch cut in $K$ that stretches from 1 to $\infty$ along the real axis, and $f$ switches discontinuously to an imaginary-valued function.
Is there any systematic way to continue the smooth, real-valued function defined on the portion of the domain where $g(a)\ge 0$, into a larger domain?
In the particular example of interest to me, $g(a)$ only changes sign at one point in the domain, and:
$$\frac{2 k(a) i}{g(a) + k(a) i}$$
traces out an approximate three-quarters of a unit circle centred on 1 in the complex plane, with a gap in the circle between $\pi$ and about $\frac{3\pi}{2}$.