Problem
Given a function f
and a list of interested value [y1, y2, ..., yn]
, how do you do to find the list [x1, x2, ..., xn]
such that f(xi)=yi
for each i
.
I know there are many root finding algorithms and we can use any of those to find the root of f-yi
to find xi
. However, at least for the bisect method, if I can reuse the evaluated values, then the total time should be decreased, especially if evaluating f
is time consuming, right?
Example
For example, using bisect method, I want find the [x1, x2]
such that f([x1, x2])=[1, 5]
. When finding y1=1
, these values are evaluated
+------+-----+----+
| iter | x | y |
+------+-----+----+
| 1 | 8 | 14 |
+------+-----+----+
| 2 | 4 | 6 |
+------+-----+----+
| 3 | 2 | 2 |
+------+-----+----+
| 4 | 1 | 0 |
+------+-----+----+
| 5 | 1.5 | 1 |
+------+-----+----+
and therefore x1=1.5
. When finding y2=5
, if we can make use of the evaluated values and find
+------+-----+---+
| iter | x | y |
+------+-----+---+
| 1 | 3 | 4 | <- because 2, 4 are evaluated
+------+-----+---+
| 2 | 3.5 | 5 |
+------+-----+---+
with less iterations than not using.
Question
Do you know any algorithm that make use of this, any language is fine? Or would you explain why there isn't any?