I have a function that is data generated and not a polynomial. For most data, it only has one root, but it can also have two roots, as in in the following plot:
uniroot()
tends to fail because the function has the same sign at both a small value for h and a large value for h, which I use at the interval endpoints.
Is there a way to find the greatest root of a function in R for a function that is known to go to minus infinity for large values of its argument?
As a workaround, I have placed the search interval around a large value for h, i.e. into a region on the right where I know the function has no roots, and then used the argumend extendInt="downX"
. I wonder however whether there is something more robust.