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

 Quantlet: nmbrentroot Description: Brent's method for finding a root of a given function in a given interval

Reference(s):
Press, W.H., Teukolsky, S.A., Vetterling, W.T., Flannery, B.P. (1992). Numerical Recipes in C. 2nd Edition.

 Usage: root = nmbrentroot(fname {,a0,b0,xtol,maxiter}) Input: fname string, name of a function whose root should be found. The function should have just one scalar parameter x. As a result, the function should return a scalar. a0,b0 optional scalars, distinct initial points bracketing a root; if not given, nmbrackout will be used to find a bracket xtol optional scalar; tolerance - fractional precision of the minimum; default xtol = 1e-8 maxiter optional scalar; maximal number of iterations; default maxiter = 100 Output: root scalar, root of fname (isolated to a fractional precision xtol)

Example:
library("nummath")
proc(fval) = ftion(x)
fval = x^2 - 16
endp
nmbrentroot("ftion")

Result:
Contents of root
[1,]        4
Example:
library("nummath")
proc(fval) = ftion(x)
fval = x^2 - 16
endp
nmbrentroot("ftion",-10,0)

Result:
Contents of root
[1,]       -4

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