Description Usage Arguments Value See Also Examples
View source: R/is.decreasing.R
is.decreasing
tests if the introduced one-variable function is decreasing (or in fact, non-increasing) on the considered x.bound
or not.
In other words, is.decreasing
returns TRUE
if the introduced function is decreasing on the considered x.bound
; and it returns FALSE
otherwise.
The goal of introducing function is.decreasing
in package FuzzyNumbers.Ext.2
is using in function f2apply
.
1 | is.decreasing(fun, x.bound = c(-1, 1), step = 0.01)
|
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 |
TRUE
for decreasing one-variable functions on the considered x.bound
; otherwise FALSE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | is.decreasing(fun=function(x) -2*x+10, x.bound=c(4,6), step=.1)
g = function(x) x^3
is.decreasing(g, x.bound=c(-24,6))
## 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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.