f: function returning one function value, or a vector of...

Description Usage Arguments Details Value Author(s) Examples

View source: R/findallroots.R

Description

function returning one function value, or a vector of function values.

Usage

1
f(x, a, b)

Arguments

x

either one value or a vector containing the x-value(s)

a

vector of coefficients of the equation

b

vector of exponention of the equation,One one corresponding with a mentioned above

Details

the function f that estimates the function values will be called as f(x, ...). If x is a vector, then the first argument passed to f should also be a vector.

Value

the value(s) of the function equation,one function value, or a vector of function values.

Author(s)

Bingpei Wu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
a=c(2,-1,-13,-1,-5)
b=c(4:0)
x=c(1:3)
f(x,a,b)

## The function is currently defined as
function (x, a, b) 
{
    z = 0
    for (i in 1:length(b)) z = z + a[i] * x^(b[i])
    z
  }

FindAllRoots documentation built on May 2, 2019, 6:34 a.m.