bugGNU Octave - Bugs: bug #36923, Bug in fminbnd?

 
 

bug #36923: Bug in fminbnd?

Submitted by:  Nir Krakauer <nir_krakauer>
Submitted on:  Mon 23 Jul 2012 04:19:02 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Nir KrakauerOpen/Closed: Closed
Release: 3.6.1Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 16 Jan 2014 01:24:00 AM UTC, comment #2:

I checked in the simpler change of '<=' going to '<'. I also added a %!test to check the new behavior. See http://hg.savannah.gnu.org/hgweb/octave/rev/61dab64aa5a6.

Rik <rik5>
Project Administrator
Wed 08 Jan 2014 01:02:18 AM UTC, comment #1:

The same effect can be had by changing line 192 of fminbnd.m from

to

There is the following comment in the original code:

By dropping the '=' the code goes back to the "original", whatever that means. I'm tempted to use this fix since it means 2 fewer function evaluations, however I don't pretend to have studied the algorithm and know if this is okay.

Rik <rik5>
Project Administrator
Mon 23 Jul 2012 04:19:02 PM UTC, original submission:

For functions that are flat after the first 38% (2-phi) of the interval, fminbnd doesn't return the minimum even if it's reached at one endpoint, e.g.

[x, fval, info] = fminbnd(@(x) (x > 0.3), 0, 1)

returns

x = 1.00000
fval = 1
info = 1

This can apparently be fixed at the cost of evaluating the function at the interval endpoints. I inserted after line 96 ('fv = fw = fval = fun (x);') in fminbnd.m

After this modification,

[x, fval, info] = fminbnd(@(x) (x > 0.3), 0, 1)

returns, correctly,

x = 5.7206e-09
fval = 0
info = 1

Nir Krakauer <nir_krakauer>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by nir_krakauer (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 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 16 Jan 2014 01:24:00 AM UTCrik5StatusNeed Info=>Fixed
      Open/ClosedOpen=>Closed
    Wed 08 Jan 2014 01:02:18 AM UTCrik5StatusPatch Submitted=>Need Info
    Mon 28 Oct 2013 02:19:04 AM UTCmtmillerCategoryNone=>Octave Function
      StatusNone=>Patch Submitted

    Back to the top


    Powered by Savane 3.1-cleanup1