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: nmbracket nmgolden nmbrent nmlinmin nmcongrad nmgraddiff

Quantlet: nmbrentder
Description: Brent's method for the minimization of a given scalar function using derivatives

Usage: min = nmbrentder(func {,a,b,c,xtol})
Input:
func name of function (string) whose minimum is to be found. The function should have just one scalar parameter x. As a result, the function should return a scalar.
fder first derivative of func; there are several possible formats: 1. name of function (string) describing the function computing the first derivative of func (its output is scalar) 2. empty string; in this case the derivative will be computed automatically using the quantlet nmgraddiff with a default step h 3. scalar h; the derivative will be computed automatically using the quantlet nmgraddiff with the given step h
a,b,c optional scalars; a bracketing triplet for minimum of func, i.e., a < b < c and fb < fa, fb < fc; default values: results of nmbracket(func)
xtol optional scalar; tolerance - fractional precision of the minimum; default xtol = 1e-8
Output:
min.xmin minimum of func (isolated to a fractional precision of xtol)
min.fmin minimum function value f(xmin)

Example:
library("nummath")
nmbrentder("sin","cos",pi,1.3*pi,2*pi)
; the bracketed minimum is sin(3/2*pi) = -1

Result:
Contents of _tmp.xmin
[1,]   4.7124
Contents of _tmp.fmin
[1,]       -1
Example:
library("nummath")
min = nmbrentder("sin")
min.xmin
min.fmin
; uses the quantlet nmbracket to bracket the minimum first...

Result:
; minimum in -pi/2:

Contents of xmin
[1,]  -1.5708
Contents of fmin
[1,]       -1
Example:
library("nummath")
;
; definition of function
;
proc(p)=ftion(x)
  p = cos((x+3*pi)/4).*x^2
endp
min=nmbrentder("ftion")
min

Result:
Contents of min.xmin
[1,]   6.6506
Contents of min.fmin
[1,]  -28.275



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