fixedpoint: A function of the fixed point algorithm.

Description Usage Arguments Details Value References See Also Examples

View source: R/fixedpoint.R

Description

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

Usage

1
fixedpoint(ftn, x0, tol = 1e-09, max.iter = 100)

Arguments

ftn

the function.

x0

is the initial guess at the fixed point.

tol

distance of successive iterations at which algorithm terminates.

max.iter

maximum number of iterations.

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, bisection

Examples

1
2
ftn1 <- function(x) return(exp(exp(-x)))
fixedpoint(ftn1, 2, tol = 1e-6)

spuRs documentation built on May 20, 2017, 2:33 a.m.

Search within the spuRs package
Search all R packages, documentation and source code