Learn R Programming

WebPower (version 0.9.4)

nuniroot: Solve A 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)

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.)

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.

Examples

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

Run the code above in your browser using DataLab