octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fzero initial bracketing [WAS: bug #31070]


From: c.
Subject: Re: fzero initial bracketing [WAS: bug #31070]
Date: Tue, 21 Sep 2010 14:35:06 +0200


On 21 Sep 2010, at 13:58, Jaroslav Hajek wrote:

No, it isn't, as far as I can see. Your sequence was simply partial
sum of bstep * 2^(n/2). Hence, intervals like x0 + (0.1..0.5) * bstep
were never reached.

No, that was the first guess I had submitted on the bug tracker,
what I posted on the developers list is:

dx = aa*.5.^(floor(-log2 (tolx)):-1:0);
for b = [(aa+dx);(aa-dx)](:)'
 fb = fun (b); nfev += 1;
 if (sign (fa) * sign (fb) <= 0)
  found = true;
  break;
 endif
endfor

You are right, though, that this is not the same as you have proposed as of course it was not my
intention to  traverse the whole set of real numbers.
I think, in your notation the sequence above could be written as

ii=1;
n = floor(-log2(tolx));
for k = 0:n
d = 2^(k-n)
x1 = x0 + d*x0/n;
if (sign (fun (x1)) * sign (fx0) <= 0)
break;
endif
x1 = x0 - d;
if (sign (fun (x1)) * sign (fx0) <= 0)
break;
endif
endfor

but I may be mistaken, is this right?
c.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]