|
From: | c. |
Subject: | Re: fzero initial bracketing [WAS: bug #31070] |
Date: | Tue, 21 Sep 2010 13:38:27 +0200 |
On 21 Sep 2010, at 13:05, Jaroslav Hajek wrote:
x0 = initial guess; n = 1; fx0 = fun (x0); while (1) for k = 1:2:n d = k*2^(k-n); x1 = x0 + d; if (sign (fun (x1)) * sign (fx0) <= 0) break; endif x1 = x0 - d; if (sign (fun (x1)) * sign (fx0) <= 0) break; endif endfor n++; endwhile
BTW that is the same approach I had in mind except for imposing a lower and upper limit to d: tolx*abs(x0) < d < abs (x0). I agree that it is unpractical to search for the bracketing over the whole real axis, but a finite number of attempts
might still make sense. c.
[Prev in Thread] | Current Thread | [Next in Thread] |