octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: small bug in fminsearch


From: Kai Torben Ohlhus
Subject: Re: small bug in fminsearch
Date: Thu, 8 Aug 2019 10:39:20 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 8/8/19 12:10 AM, Andrea Latina wrote:
> Hello Olaf (as maintainer of the 'optim' package), hello everyone,
> 
> I've found a small bug in fminsearch.m in octave 5.1.0 :
> 
> line 168 should be
>     fval = feval (fun, x, varargin{:});
> 
> and not
>     fval = feval (fun, x);
> 
> Best,
> Andrea


Dear Andrea,

Thank you for the report.  Do you want to enable the following calling
scheme?

  f = @(x,a) x.^2 + a;
  a = 3;
  x0 = 1;
  [x, fval] = fminsearch (f, x0, [], a)

This behavior is no longer documented by Matlab [1] (but still works in
R2019a). The Mathworks encourages to use anonymous functions instead:

  f = @(x,a) x.^2 + a;
  a = 3;
  fun = @(x)f(x,a);
  x0 = 1;
  [x, fval] = fminsearch (fun, x0)

This works perfectly in both Octave and Matlab.  In bug #55742 [2] it
was recently decided not to support undocumented Matlab features, as
they are more likely to change quietly and are difficult to support and
test.

With best wishes,

Kai

[1] https://www.mathworks.com/help/matlab/ref/fminsearch.html
[2] https://savannah.gnu.org/bugs/?55742




reply via email to

[Prev in Thread] Current Thread [Next in Thread]