bugGNU Octave - Bugs: bug #56885, fminsearch should accept a...

 
 

bug #56885: fminsearch should accept a function name as first input argument

Submitter:  Markus Mützel <mmuetzel>
Submitted:  Thu 12 Sep 2019 03:48:33 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Joel Lapin Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 13 Sep 2019 02:26:47 PM UTC, comment #3: 

@Markus: Anonymous functions are instances of function handles so there isn't a need to document separately that they may be used.

Inline functions in Matlab in Matlab have been discouraged ever since anonymous functions were introduced. BUT, it is still valid syntax in Matlab, and hence in Octave.  Since it is still a valid input to a function like fminsearch I think it is okay to keep the documentation in place.

Rik <rik5>
Group administrator
Fri 13 Sep 2019 12:10:18 PM UTC, comment #2: 

@Rik: Thank you for the quick fix. Just a little more than an hour after reporting. My respect!

With your change, it is now also possible to pass something like "@(x,y) x^2*y" for FCN, i.e. a string containing an "anonymous function". Should we also document that?

Should we also explicitly document that passing anonymous functions is fine? Or is this just a special case of a function handle?

Btw. the documentation for "inline" contains the following:

> Programming Note: The use of inline is discouraged and it may be removed from a future version of Octave. The preferred way to create functions from strings is through the use of anonymous functions (see Anonymous Functions) or str2func.

Markus Mützel <mmuetzel>
Group administrator
Thu 12 Sep 2019 04:59:29 PM UTC, comment #1: 

Sure, it should.  I modified fminsearch to accept a string for the function name and better focumented the first input in this changeset (https://hg.savannah.gnu.org/hgweb/octave/rev/d4655f32dde7).  I posted an additional changeset to use the same language in all of the optimization functions when referring to the input FCN (https://hg.savannah.gnu.org/hgweb/octave/rev/baeed03c3766).

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Thu 12 Sep 2019 03:48:33 PM UTC, original submission:  

For Matlab compatibility [1], fminsearch should accept a char array with a function name for the objective function.

As recently mentioned on the help mailing list [2], Octave currently needs a function handle.
Also the documentation isn't clear on what input is accepted.

[1]: https://de.mathworks.com/help/matlab/ref/fminsearch.html#bvadxhn-1-fun
[2]: https://octave.1599824.n4.nabble.com/Issue-with-fminsearch-function-td4693803.html

Markus Mützel <mmuetzel>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mmuetzel (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-09-12 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code