I'm working on a problem at work that requires me to search for the first date (x) that a financial model returns a value greater than zero (y>0).
Our current approach is simple. Start a guess-and-check several periods before an reasonably educated guess would expect y to be greater than 0. After that, we step 1 period at a time forward until be pass our threshold (y>0).
This financial model takes significant time to run, so each individual guess is costly and we'd like to improve our search speed by implementing a more intelligent approach.
The problem:
- the results are discontinuous
- the result (y) may go above and below zero many times within the search region
- the result may go above and below zero from one period to the next.
- we need to find the first occurrence of this happening, not just any f(x)=0
For all these reasons, basic search algorithms (Ridders, Secant, Bisection, etc) can't help us.
So my basic question: Is there a root-find algorithm for discontinuous functions? ideally one that searches for the first instance of a zero within a bracketed region?