> Hi, > > Excel has this "Goal Seek". Nice thing. You point it to a formular > and to the cell that is used as input and Excel finds the > input value that makes the formula result in a user specified value. > > In fact that is the problem of finding x in f(x) = 0. > > There are many algorithms which help you here, but they want > a) a range [a,b] to search in which can be very big with > double values. > b) two points a and b, so that f(a)*f(b) < 0. > > Can anyone tell me what to do here. Excel is getting quick and good > results, so there must be a way. I've checked how it works in Excel : there are two things you know : the function, but also a starting point (Excel looks for the closest solution to the starting point, not _all_ solutions). The solution is to use the Newton method : (credits to my father for thinking of it !) 1. Start from x0 => f(x0) 2. Now with x0 + delta, delta being arbitrary but "small" => f(x0 + delta), 3. The line (D) going from those two points cuts the horizontal axe at x1 = x0 - delta*f(x0) /{f(xo+delta) - f(xo)} and of course x1 is either smaller or bigger than x0 depending on the sign of f(x0) (let's say delta is positive once and for all) 4. Start again with x1 => x2, then x3 .... 5. A problem can happen if we are close to a max or min of f(x) because then (D) is almost horizontal, which throws xi very far...