I have this problem which I believe is pretty simple, however I'm not finding anything online.
I need to find a zero of a function numerically. I know that $f(0)<0$ and $f(1)>0$ and that $f(x)$ is continuous in this interval. I can do bisection and find numerically the zero to the desired accuracy.
However, the time that it takes to evaluate the function $f(x)$ numerically is different if $f(x)<0$ or $f(x)>0$. Let's say that for $f(x)<0$ the time needed for evaluation is $1$ and for $f(x)>0$ it's $C$, with $C>1$. At this point it's convenient not to look at the halfway point anymore, i.e. $f(1/2)$, but I would save some time by choosing a point a bit closer to $0$, since evaluation of $f$ is more likely to be faster. What is the optimal point to choose in a situation like this, so that I can do bisection in the fastest way possible?
Edit: I am only interested in a bisection method, I know in principle there are more effective ways using derivatives of $f$. However, since my $f$ is in practice a boolean function which is true at $f(0)$ and becomes false somewhere between $x=0$ and $x=1$, and I want to find this point, I can only do bisection.
Here's intuition. I can't quite seem to find the probabilistic argument that shows it minimizes expected computation cost.
Assume the unknown root is uniformly distributed in the unit interval. Assume that the best strategy is to choose your evaluation point dividing the interval in the ratio $(1-r):r$. When $C=1$ you want $r= 1/2$. For larger $C$, $r$ should approach $0$. I suggest $$ \frac{1-r}{r} = C $$ which leads to $$ r = \frac{1}{1+C}. $$ You apply the same ratio recursively to each subinterval in your binary search.
Whether or not you can justify this, it's a very easily implementable heuristic.
In your particular application you might be able to do better if you also use the actual values for $f$ at the endpoints to choose the division point, assuming that values smaller in absolute value are likely to be nearer to the unknown root.