I believe that lbfgs attempts to compute the gradient symbolically, and
there is no means to supply this gradient if it is unable to compute it.
Is this correct?
Leo
---
(%i2) f : (x-1)^2;
(%o2) (x-1)^2
(%i3) lbfgs(f,'[x],[0],1e-2,[1,0]);
*************************************************
N= 1 NUMBER OF CORRECTIONS=25
INITIAL VALUES
F= 1.000000000000000D+00 GNORM= 2.000000000000000D+00
*************************************************
I NFN FUNC GNORM STEPLENGTH
1 2 0.000000000000000D+00 0.000000000000000D+00
5.000000000000000D-01
THE MINIMIZATION TERMINATED WITHOUT DETECTING ERRORS.
IFLAG = 0
(%o3) [x = 1.0]
/* A simple example */
(%i4) g : if x < 1.0 then (x-1)^2 else (x-1)^4;
(%o4) if x < 1.0 then (x-1)^2 else (x-1)^4
(%i5) lbfgs(g,'[x],[0],1e-2,[1,0]);
diff: second argument must be a variable; found 0.0
Maxima encountered a Lisp error:
NTH: T is not a list
Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.