I am currently dealing with a complex function F(z) on the upper half-plane that has a log-term. I am trying to obtain its inverse function, but I can’t obtain its explicit form.

I used Julia package NLSolve and got F^{-1}(w) for each w in the complex plane by getting roots of F(z) - w, but there are some problems:

The roots are not smooth: I want roots to be smooth, but the results have some jumps and are not smooth due to branch cuts of the log-term. How can I set roots to be smooth by checking whether nearby points are mapped to nearby points or not?

Some roots are on the lower half-plane: F(z) is defined on the upper half-plane, but some roots are on the lower half-plane (maybe) due to the branch cut. How can I restrict the area of candidate roots in NLSolve?

If the domain is simple, as in this case, it’s usually simpler to transform into the domain rather than optimizing with a constraint. E.g. somthing like this:

Here the function transform maps into the upper half plane, so myfun is never evaluated outside. The solver may return something in the lower half plane, but the outer transform maps it to the right domain.

Maybe use numerical continuation to get a “smooth” set of roots on a regular set of points in a region of the upper-half plane (e.g. at the simplest level, evaluate on a fine grid, but use the solution previous grid point as the starting guess for the nonlinear solve at the next grid point). If you evaluate at a grid of Chebyshev points you can then use Chebyshev interpolation to quickly and accurately interpolate from your grid to arbitrary w in this region.