octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #57113] fminunc return wrong Hessian matrix


From: Kai Torben Ohlhus
Subject: [Octave-bug-tracker] [bug #57113] fminunc return wrong Hessian matrix
Date: Thu, 24 Oct 2019 21:44:21 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36

Update of bug #57113 (project octave):

                Severity:              3 - Normal => 2 - Minor              
                Priority:              5 - Normal => 3 - Low                
                  Status:                    None => Invalid                
             Open/Closed:                    Open => Closed                 
        Operating System:                  Mac OS => Any                    

    _______________________________________________________

Follow-up Comment #1:

Thank you for your bug report.  Please note, that Octave "primarily intended
for numerical computations".  It it not a computer algebra system
https://en.wikipedia.org/wiki/Computer_algebra_system.  Octave uses some
adapted BFGS (a quasi-Newton) method in "fminunc" (see "edit fminunc") and
only provides approximations of the Hessian matrix.


>> [x, fval, info, output, grad, hess] = fminunc (@(x) sum (x.^2), ones(2,1))
x =

  -0.0000000058530
  -0.0000000058530

fval =    6.8516e-17
info =  2
output =

  scalar structure containing the fields:

    iterations =  16
    successful =  7
    funcCount =  29

grad =

  -0.000000026607
  -0.000000026607

hess =

   1.50000   0.50000
   0.50000   1.50000


If you want to get a symbolic solution, please use the symbolic toolbox of
Octave, which does a great job for this toy problem:


>> pkg load symbolic
>> syms x y
>> f(x, y) = x^2 + y^2
f(x, y) = (symfun)

   2    2
  x  + y

>> grad(x, y) = [diff(f, x); diff(f, y)]
grad(x, y) = (symfun)

  ⎡2⋅x⎤
  ⎢   ⎥
  ⎣2⋅y⎦

>> hess(x, y) = [diff(f, x, 2), diff(diff (f, x), y); diff(diff (f, y), x),
diff(f, y, 2)]
hess(x, y) = (symfun)

  ⎡2  0⎤
  ⎢    ⎥
  ⎣0  2⎦


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57113>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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