bugGNU Octave - Bugs: bug #31070, fzero cannot compute initial...

 
 

bug #31070: fzero cannot compute initial bracketing

Submitter:  Carlo de Falco <cdf>
Submitted:  Sun 19 Sep 2010 12:24:28 PM UTC
   
 
Category:  Libraries Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  Postponed Assigned to:  highegg
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Mac OS
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 20 Sep 2010 03:28:02 PM UTC, comment #3: 

I agree that this is not a bug,
so I moved the discussion to the developers' mailng list.
Please close this tracker item.

Carlo de Falco <cdf>
Group Member
Mon 20 Sep 2010 06:07:01 AM UTC, comment #2: 

fzero is designed to work with a bracketing, and it is unrealistic to expect it to always find one, as well as to expect it to behave identically to Matlab.
Therefore, I don't see anything "incorrect" about the result.
If a valid bracketing is not given, fzero simply tries a number of trial points, and in this case none of them works. Of course, for any trial sequence you can construct a failing case.

I don't object to using a better trial sequence, but please

1: Make it separate from any other changes.
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.

PS. If you want to change the default tolerance, make it a separate change with an explanation why.
PPS. Prior to 3.2, fzero didn't exist at all in Octave, so it surely wasn't giving results more similar to Matlab.

Jaroslav Hajek <highegg>
Sun 19 Sep 2010 11:23:12 PM UTC, comment #1: 

The attached changeset seems to fix the problem for me.

(file #21501)

Carlo de Falco <cdf>
Group Member
Sun 19 Sep 2010 12:24:28 PM UTC, original submission:  

with today's tip:

>> fun = @(x) x.^2 - 1 + exp(x);
>> fzero (fun, 1)

ans = 0

>> fzero (fun, -1)

ans = 0

>> fzero (fun, 1.1)

error: fzero: not a valid initial bracketing
error: called from:
error:   /Users/carlo/Desktop/OF/octave/octave/fzero.m at line 170, column 5

as a reference, here are results from Matlab:

>> fun = @(x) (x.^2 - 1 + exp(x));
>> fzero (fun, 1)

ans =
   5.4422e-18

>> fzero (fun, 1.1)

ans =
  -1.3817e-17

>> fzero (fun, -1)

ans =
   -0.7146

the incorrect behavior is present in the 3.2.x release but
prior to 3.2 Octave was giving results more similar to Matlab.

c.

Carlo de Falco <cdf>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #21501:  patch_fzero.txt added by cdf (2KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by highegg (Posted a comment)
  • -email is unavailable- added by cdf (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-09-20 highegg StatusNone Postponed
        Open/ClosedOpen Closed
    2010-09-20 highegg Severity3 - Normal 1 - Wish
        Priority5 - Normal 3 - Low
        Item GroupIncorrect Result Feature Request
        Assigned toNone highegg
    2010-09-19 cdf Attached File- Added patch_fzero.txt, #21501

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code