# doc-cache created by Octave 4.0.0
# name: cache
# type: cell
# rows: 3
# columns: 3
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
numgradient


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 587
numgradient(f, {args}, minarg)

Numeric central difference gradient of f with respect
to argument "minarg".
* first argument: function name (string)
* second argument: all arguments of the function (cell array)
* third argument: (optional) the argument to differentiate w.r.t.
        (scalar, default=1)

"f" may be vector-valued. If "f" returns
an n-vector, and the argument is a k-vector, the gradient
will be an nxk matrix

Example:
function a = f(x);
        a = [x'*x; 2*x];
endfunction
numgradient("f", {ones(2,1)})
ans =

  2.00000  2.00000
  2.00000  0.00000
  0.00000  2.00000



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
numgradient(f, {args}, minarg)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
numhessian


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 597
numhessian(f, {args}, minarg)

Numeric second derivative of f with respect
to argument "minarg".
* first argument: function name (string)
* second argument: all arguments of the function (cell array)
* third argument: (optional) the argument to differentiate w.r.t.
        (scalar, default=1)

If the argument
is a k-vector, the Hessian will be a kxk matrix

function a = f(x, y)
        a = x'*x + log(y);
endfunction

numhessian("f", {ones(2,1), 1})
ans =

    2.0000e+00   -7.4507e-09
   -7.4507e-09    2.0000e+00

Now, w.r.t. second argument:
numhessian("f", {ones(2,1), 1}, 2)
ans = -1.0000



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
numhessian(f, {args}, minarg)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
samin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1794
samin: simulated annealing minimization of a function. See samin_example.m

usage: [x, obj, convergence, details] = samin("f", {args}, {control})

Arguments:
* "f": function name (string)
* {args}: a cell array that holds all arguments of the function,
* {control}: a cell array with 11 elements
        * LB  - vector of lower bounds
        * UB - vector of upper bounds
        * nt - integer: # of iterations between temperature reductions
        * ns - integer: # of iterations between bounds adjustments
        * rt - (0 < rt <1): temperature reduction factor
        * maxevals - integer: limit on function evaluations
        * neps - integer:  number of values final result is compared to
        * functol -   (> 0): the required tolerance level for function value
                           comparisons
        * paramtol -  (> 0): the required tolerance level for parameters
        * verbosity - scalar: 0, 1, or 2.
                * 0 = no screen output
                * 1 = only final results to screen
                * 2 = summary every temperature change
        * minarg - integer: which of function args is minimization over?

Returns:
* x: the minimizer
* obj: the value of f() at x
* convergence:
        0 if no convergence within maxevals function evaluations
        1 if normal convergence to a point interior to the parameter space
        2 if convergence to point very near bounds of parameter space
          (suggest re-running with looser bounds)
* details: a px3 matrix. p is the number of times improvements were found.
           The columns record information at the time an improvement was found
           * first: cumulative number of function evaluations
           * second: temperature
           * third: function value

Example: see samin_example



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
samin: simulated annealing minimization of a function.





