Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: nummath
See also: nmgolden nmbracket nmlinminder nmcongrad nmbrentder

Quantlet: nmlinminder
Description: Finds a minimum of func along the direction "direc" from x0 (using derivatives of func)

Usage: lmin = nmlinminder(func,fder,x0,direc)
Input:
func name of function (string) whose minimum is to be found. The function should have just one parameter x (vector n x 1). As a result, the function should return scalar.
fder name of function (string) computing the gradient of func; it should return n x 1 vector. if empty, nmgraddiff will be used for computing the gradient
x0 n x 1 vector, starting point for the line minimization
direc n x 1 vector, direction vector of a line for the line minimization
Output:
lmin.xlmin n x 1 vector, minimum of func on the line x0 + span{direc}
lmin.flmin scalar, minimum function value on the line, f(xlmin)
lmin.moved n x 1 vector, vector displacement during line minimization, moved = xlmin - x0

Example:
library("nummath")
;
; definition of function
;
proc(p)=ftion(x)
  p = x[1,]^2 + 3*(x[2,]-1)^2
endp
;
lmin = nmlinminder("ftion","",#(2,2),#(0,1))
lmin
;
; minimization for x1 = 2, x2 = 2 + t

Result:
Contents of lmin.xlmin
[1,]        2
[2,]        1
Contents of lmin.flmin
[1,]        4
Contents of lmin.moved
[1,]        0
[2,]       -1
Example:
library("nummath")
;
; definition of function
;
proc(p)=ftion(x)
  p = x[1,]^2 + 3*(x[2,]-1)^2
endp
;
lmin = nmlinminder("ftion","",#(1,2),#(1,-1))
lmin
;
; minimization for x1 = 1 + t, x2 = 2 - t

Result:
Contents of lmin.xlmin
[1,]      1.5
[2,]      1.5
Contents of lmin.flmin
[1,]        3
Contents of lmin.moved
[1,]      0.5
[2,]     -0.5



Author: L. Cizkova, 20010802 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006