bisection {spuRs}R Documentation

A function of the bisection algorithm.

Description

Applies the bisection algorithm to find x such that ftn(x) == x.

Usage

bisection(ftn, x.l, x.r, tol = 1e-09)

Arguments

ftn

the function.

x.l

is the lower starting point.

x.r

is the upper starting point.

tol

distance of successive iterations at which algorithm terminates.

Details

We assume that ftn is a function of a single variable.

Value

Returns the value of x at which ftn(x) == x. If the function fails to converge within max.iter iterations, returns NULL.

References

Jones, O.D., R. Maillardet, and A.P. Robinson. 2009. An Introduction to Scientific Programming and Simulation, Using R. Chapman And Hall/CRC.

See Also

newtonraphson, fixedpoint

Examples

ftn5 <- function(x) return(log(x)-exp(-x))
bisection(ftn5, 1, 2, tol = 1e-6)

[Package spuRs version 2.0.2 Index]