is.increasing {FuzzyNumbers.Ext.2} | R Documentation |
Diagnosis an increasing function
Description
is.increasing
tests if the introduced one-variable function is increasing (or in fact, non-decreasing) on the considered x.bound
or not.
In other words, is.increasing
returns TRUE
if the introduced function is increasing on the considered x.bound
; and it returns FALSE
otherwise.
The goal of introducing function is.increasing
in package FuzzyNumbers.Ext.2
is using in function f2apply
.
Usage
is.increasing(fun, x.bound = c(-1, 1), step = 0.01)
Arguments
fun |
a one-variable R function |
x.bound |
a vector with two real ordered elements which determine a bound on x-axis for checking the monotonic of the considered function |
step |
a positive real-valued number which determine the increment of the considered sequence for checking the monotonic of the considered function. The default of |
Value
TRUE
for increasing one-variable functions on the considered x.bound
; otherwise FALSE
See Also
is.decreasing
Examples
is.increasing(fun=function(x) 2*x, x.bound=c(4,6), step=.1)
g = function(x) x^2
is.increasing(g, x.bound=c(-24,6), step=.01)
h = function(x) x^5
is.increasing(h, c(-24,6), .01)
curve(h(x), xlim=c(-2,2))
## The function is currently defined as
function (fun, x.bound = c(-1, 1), step = 0.01)
{
x = seq(x.bound[1], x.bound[2], by = step)
i = 1
while (fun(x[i]) <= fun(x[i + 1])) {
if (i < length(x) - 1) {
i <- i + 1
}
else (return(TRUE))
}
return(FALSE)
}