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

 
 

bug #31070: fzero cannot compute initial bracketing

Submitted by:  Carlo de Falco <cdf>
Submitted on:  Sun 19 Sep 2010 12:24:28 PM UTC  
 
Category: LibrariesSeverity: 1 - Wish
Priority: 3 - LowItem Group: Feature Request
Status: PostponedAssigned to: Jaroslav Hajek <highegg>
Originator Name: Open/Closed: Closed
Release: devOperating System: Mac OS

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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>In charge of this item.
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>
Project 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>
Project Member

 

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

Attach File(s):
   
   
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
  • -unavailable- added by highegg (Posted a comment)
  • -unavailable- added by cdf (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 20 Sep 2010 06:59:51 PM UTChigheggStatusNone=>Postponed
      Open/ClosedOpen=>Closed
    Mon 20 Sep 2010 06:07:01 AM UTChigheggSeverity3 - Normal=>1 - Wish
      Priority5 - Normal=>3 - Low
      Item GroupIncorrect Result=>Feature Request
      Assigned toNone=>highegg
    Sun 19 Sep 2010 11:23:12 PM UTCcdfAttached File-=>Added patch_fzero.txt, #21501

    Back to the top


    Powered by Savane 3.1-cleanup1