octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] Re: [bug #31070] fzero cannot compute initial brack


From: Jaroslav Hajek
Subject: [Octave-bug-tracker] Re: [bug #31070] fzero cannot compute initial bracketing
Date: Mon, 20 Sep 2010 09:34:54 +0200

On Mon, Sep 20, 2010 at 8:58 AM, Carlo de Falco <address@hidden> wrote:
>
> On 20 Sep 2010, at 08:48, c. wrote:
>
>> Hi,
>>
>> On 20 Sep 2010, at 08:07, Jaroslav Hajek wrote:
>
>
>>> 2: Document what exactly the new sequence is and why is it better. It
>>> should
>>> be clear from the above that merely pointing out an example where this
>>> sequence works and the existing one doesn't is not enough, you should
>>> present
>>> some sort of discussion about common and uncommon use cases.
>>
>> The new sequence is essentially
>> a +- [(a/100)]
>> a +- [(a/100) + (a/100)*sqrt(2)]
>> a +- [(a/100) + (a/100)*sqrt(2) + (a/100)*2]
>> a +- [(a/100) + (a/100)*sqrt(2) + (a/100)*2 + (a/100)*2^3/2] ...
>>
>> as opposed to the original one which was
>> a +- .1*a, a +- a, a +- 1.5*a, a +- 2*a
>>
>> the idea is the same, start close to the guess provided by the user then
>> gradually further away,
>> simply it is more fine-grained, increases the step more gradually and
>> tries a few more choices.
>>
>> Although I agree that there is now general way to make sure a correct
>> initial bracketing is always found,
>> I believe fzero should at least try a bit harder before failing, so if you
>> have ideas for a different approach
>> it is OK with me as long as the generated sequence is longer and more
>> fine-grained than the current one.
>
> Sorry, I forgot to mention, it is a very common use case to search for a
> root near a given initial guess,
> rather than within a bracket.

Yes; unfortunately "near" can mean almost anything...

> fsolve is probably better in this case, but
> many Matlab users do not know fsolve
> because it is in the optimization package and thus costs extra money to
> them.
>
> c.
>
> P.S. just out of curiosity, is there any particular reason why you check
>
> if (sign (fa) * sign (fb) <= 0)
>
> rather than
>
> if (fa * fb <= 0)
>
> is it more efficient/robust?
>

octave:1> fa = fb = -1e-200
fa = -1.0000e-200
octave:2> fa * fb <= 0
ans =  1
octave:3> sign (fa) * sign (fb) <= 0
ans = 0
octave:4> fa = Inf; fb = 0;
octave:5> fa * fb <= 0
ans = 0
octave:6> sign (fa) * sign (fb) <= 0
ans =  1

hth

-- 
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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