WebPower (version 0.5)

nuniroot: Sove An Single Equation

Description

The function searches in an interval for a root (i.e., zero) of the function f with respect to its first argument. The argument interval is for the input of x, the corresponding outcome interval will be used as the interval to be searched in.

Usage

nuniroot(f, interval, maxlength = 100)

Arguments

f

Function for which the root is sought.

interval

A vector containing the end-points of the interval to be searched for the root.

maxlength

The number of vaulue points in the interval to be searched. It is 100 by default.

Value

A list with at least four components: root and f.root give the location of the root and the value of the function evaluated at that point. iter and estim.prec give the number of iterations used and an approximate estimated precision for root. (If the root occurs at one of the endpoints, the estimated precision is NA.)

Examples

Run this code
# NOT RUN {
f <- function(x) 1+x-0.5*x^2
interval <- c(-3,-2,1,2,6)
nuniroot(f,interval)
# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace