REDUCE

17.2 Minima

The Fletcher Reeves version of the steepest descent algorithms is used to find the minimum of a function of one or more variables. The function must have continuous partial derivatives with respect to all variables. The starting point of the search can be specified; if not, random values are taken instead. The steepest descent algorithms in general find only local minima.

Syntax:

num_min (\(\langle \)exp\(\rangle \), \(\langle \)\(var_1\)\(\rangle \)\(\,[\)=\(val_1\)\(]\,\) [,\(var_2\)[=\(val_2\)] …]
[,accuracy=\(\langle \)a\(\rangle \)][,iterations=\(\langle \)i\(\rangle \)])
or
num_min (\(\langle \)exp\(\rangle \), {\(\langle \)\(var_1\)\(\rangle \)\(\,[\)=\(val_1\)\(]\,\) [,\(var_2\)[=\(val_2\)] …]}
[,accuracy=\(\langle \)a\(\rangle \)][,iterations=\(\langle \)i\(\rangle \)])

where \(\langle \)exp\(\rangle \) is a function expression, \(\langle \)\(var_{1}\)\(\rangle \), \(\langle \)\(var_{2}\)\(\rangle \), … are the variables in \(\langle \)exp\(\rangle \) and \(\langle \)\(val_{1}\)\(\rangle \), \(\langle \)\(val_{2}\)\(\rangle \), … are the (optional) start values.

num_min tries to find the next local minimum along the descending path starting at the given point. The result is a list with the minimum function value as first element followed by a list of equations, where the variables are equated to the coordinates of the result point.

Examples:

num_min(sin(x)+x/5, x);

{-0.0775896851944,{x=4.51103102502}}

num_min(sin(x)+x/5, x=0);

{-1.33422674662,{x=-1.77215826714}}

% Rosenbrock function (well known as hard to minimize).
fktn := 100*(x1**2-x2)**2 + (1-x1)**2;
num_min(fktn, x1=-1.2, x2=1, iterations=200);

{0.000000218702254529,{x1=0.999532844959,x2

    =0.99906807243}}


Hosted by Download REDUCE Powered by MathJax