[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Exit codes for fzero
From: |
Jaroslav Hajek |
Subject: |
Re: Exit codes for fzero |
Date: |
Tue, 16 Feb 2010 08:30:43 +0100 |
On Mon, Feb 15, 2010 at 7:49 PM, Rik <address@hidden> wrote:
>
>>
>> It's wrong here. So it's not like there is something magical, probably
>> just a test like you proposed above.
>> But I'm not against it; if you want to, propose a patch.
>>
>
> Jaroslav,
>
> I took a look at the return codes from Matlab
> (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/fzero.html) and
> the -5 indicates that the algorithm *may* have converged on a singularity.
> This is pretty much what I was looking for -- an indication that I
> should look more closely at the objective function but not a guarantee that
> the function is good or bad.
>
> For a patch, I considered a simple level test, such as fval <
> SOME_TOLERANCE or (fb - fa) < SOME_TOLERANCE. These would catch one type
> of singularity where the right- or left-hand limit was undefined and going
> to infinity. However, it wouldn't catch a simple jump discontinuity such
> as a step function from -1 to +1. In that case both limits would exist and
> both would be well-bounded but the two limits do not converge on the same
> value. Instead, my patch looks at the numerically calculated slope
> between the last two computed points of fzero. If the slope is extremely
> high this *may* indicate a discontinuity of either the infinite or bounded
> sort.
>
> A draft of the patch is attached. If it looks good and I get no other
> comments I will commit it in a few days.
>
I have some comments. This looks good, but I think you should more
carefully consider what an "extremely high" slope is.
In particular, I don't like the absolute constant 1e6, because it
makes the test scaling-dependent. Yes, absolute scaling independence
is impossible due to limited FP range, but 1e6 is way too small. I
think it would be better if the slope of the final bracketing were
compared to the slope of the initial bracketing.
Btw., Matlab 2007 misclassifies for instance this simple example:
>> [x, fval, info, out] = fzero (@(x) sign(x) + (x==0), [-5,4])
x =
-2.7756e-16
fval =
-1
info =
1
out =
intervaliterations: 0
iterations: 54
funcCount: 56
algorithm: 'bisection, interpolation'
message: 'Zero found in the interval [-5, 4]'
--
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- Exit codes for fzero, Rik, 2010/02/10
- Re: Exit codes for fzero, Jaroslav Hajek, 2010/02/10
- Re: Exit codes for fzero, Rik, 2010/02/10
- Re: Exit codes for fzero, Jaroslav Hajek, 2010/02/11
- Re: Exit codes for fzero, Rik, 2010/02/15
- Re: Exit codes for fzero,
Jaroslav Hajek <=
- Re: Exit codes for fzero, Rik, 2010/02/16
- Re: Exit codes for fzero, Jaroslav Hajek, 2010/02/17
- Re: Exit codes for fzero, Rik, 2010/02/18
- Re: Exit codes for fzero, Jaroslav Hajek, 2010/02/19
Exit codes for fzero, John W. Eaton, 2010/02/10