Is there a robust algorithm for this? My first thought was IntervalRootFinding.jl, but I ran into an issue [that MWE has p = normcdf(z), which as a host of numerical problems on its own, see the values above).
Not a solution, but you should be able to restrict your search space by noting that if f = 0, then
z = C_m + D_mH
and since H \in [0,1] (since it’s a cdf), this means that the root z must be in the interval [C_m, C_m + D_m] (if D_m is positive) or [C_m + D_m, C_m] (if D_m is negative).
This is a great idea! I can take this further and define
y = \frac{z - C_m}{D_m}
and then my problem is
H(C_f + D_f H(C_m + D_m y)) = y
where we know that y \in [0,1] so there is a bracket already. Brent’s method from Roots.jl is pretty good on this, not as fast as Newton’s, but much more robust.
I am only struggling with precision issues where I am around the edges (y \approx 0 or y \approx 1).
Thanks, that is really helpful. Now I convinced myself that there is either a unique root or 3 roots. Life would be so much simpler if I got IntervalRootFinding.jl working on this problem.
note that to use isolate_roots you’d need to define normcdf also for ArbSeries, which I’m not familiar with; If you’re interested ask @joeldahne about this!