Description Usage Arguments Details Value Author(s) Examples

Let f be a non-increasing (or non-decreasing) function that changes sign within the
interval specified. If 'pos.side'=TRUE (or FALSE) then
`unirootDiscrete`

finds the value x such that f(x) is closest
to the sign change and is positive (or negative).

1 2 3 |

`f` |
function for which a root is needed |

`interval` |
an interval giving minimum and maximum allowable values for root |

`lower` |
lower bound for root |

`upper` |
upper bound for root |

`tol` |
absolute tolerance, abs(true root-estimated root)<= tol |

`pos.side` |
if TRUE finds value x closest to the sign change in f, such that f(x)>0 |

`print.steps` |
if true prints interations |

`maxiter` |
maximum number of iterations |

`...` |
additional arguments to f |

The algorithm evaluates f(x) iteratively, and the change in 'x' is halved each iteration until the change in 'x' is less than tol. Then the root is returned according to the pos.side parameter.

A list with the folllowing elements,

`iter` |
number of iterations (times f is evaluated) |

`f.root` |
value of f(x), where x is the root |

`root` |
the root x, where f(x)>=0 if pos.side=TRUE |

...

M.P. Fay

1 2 | ```
test<-function(x,parm=10.987654321){ ifelse(x>=parm,1,-1) }
unirootDiscrete(test,lower=0,upper=100,tol=10^-4,pos.side=FALSE,print.steps=TRUE)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.