Open dandelany opened 5 months ago
@adrienmaillard I'm moving the discussion to this issue:
I understand that the goal is to find f(x)=0
, but the algorithm is currently assuming that f(x)
is monotonically increasing (as in f(x) = x + C
) instead of checking if f(x)
is a decreasing function or what its slope is in general. If the second value it picks is another actual x val in the domain rather than assuming off a single point the shape of the fn, then nextValueAt
shouldn't have to check if it was actually handed a good value.
No, the algorithm is not assuming anything in general. This x1 is the only one for which we make this assumption. We can't know if it is decreasing or not before having a second point. Actually we can't know anything about the function, that's why we use this specific rootfinding. Otherwise we would used closed form solutions. The check about the second point could be moved out of nextValueAt
for the initValue
but we need it anyway in nextValueAt
in the general case (when it is testing several x and f(x)).
Split off from #1488 - a fix to enforce bounds of initial X-values in the rootfinding algorithm. In that PR, there was some discussion about why the is necessary, and whether there is a deeper improvement to be made to the underlying algorithm or heuristics. Let's continue that discussion here so we can merge & release #1488.
from @adrienmaillard:
from @Mythicaeda:
from @adrienmaillard: