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: nmbrackout

Quantlet: nmbrackin
Description: searches for zero crossings of a given scalar function in n equally spaced subintervals of a given interval

Reference(s):

Usage: {a,b,fa,fb} = nmbrackin(fname {,a0,b0,n})
Input:
fname string, name of a function whose root should be bracketed. 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 for bracketing, default: a0 = -10, b0 = 10
n optional scalar, a number of equally spaced subintervals of [a0,b0] that will be searched for zero crossings; default n = 100
Output:
a,b m x 1 vectors, bracketing pairs; a[i] contains the left bracket and b[i] contains the right bracket of the i-th bracketing pair (subinterval containing zero crossing)
fa,fb m x 1 vectors, function values at a and b

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

Result:
In the default interval of [-10,10] divided into 100 (default)
subintervals, two zero crossings in [-4.2,-4] and [3.8,4]
were found:

Contents of bracket.a
[1,]     -4.2
[2,]      3.8
Contents of bracket.b
[1,]       -4
[2,]        4
Contents of bracket.fa
[1,]     1.64
[2,]    -1.56
Contents of bracket.fb
[1,] -3.5527e-15
[2,]  7.1054e-15



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