is.decreasing.on.x: Diagnosis a decreasing two-variable function toward x

Description Usage Arguments Value See Also Examples

View source: R/is.decreasing.on.x.R

Description

is.decreasing.on.x tests for any fixed y from y.bound, if the introduced two-variable function f(x,y) is decreasing toward x on the considered x.bound or not. In other words, is.decreasing.on.x returns TRUE if the introduced function f(x,y) is decreasing function of x on the considered x.bound (for any fixed y in y.bound); and it returns FALSE otherwise. The goal of introducing function is.increasing.on.x in package FuzzyNumbers.Ext.2 is using in function f2apply.

Usage

1
is.decreasing.on.x(fun, x.bound = c(-1, 1), y.bound = c(-1, 1), step = 0.01)

Arguments

fun

a two-variable R function

x.bound

a vector with two real ordered elements which determine a bound on x-axis for checking the monotonic

y.bound

a vector with two real ordered elements which determine a bound on y-axis for checking the monotonic

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 step is 0.01. Increasing step value can cause the decreasing the time of computation and also cause the decreasing the precision of the calculations.

Value

TRUE for two-variable function f(x,y) which is decreasing toward x on x.bound (for any fixed y from y.bound); and otherwise FALSE

See Also

is.decreasing, is.decreasing.on.y

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
is.decreasing.on.x(fun=function(x,y) 2*x+y, x.bound=c(0,2), y.bound=c(1,2), step=.2)

f = function(x,y) -x^2+y
is.decreasing.on.x(f, x.bound=c(0,2), y.bound=c(0,2))
is.decreasing.on.x(f, x.bound=c(-2,2), y.bound=c(0,2))

## The function is currently defined as
function (fun, x.bound = c(-1, 1), y.bound = c(-1, 1), step = 0.01) 
{
    y = seq(y.bound[1], y.bound[2], by = step)
    for (i in 1:length(y)) {
        g = function(x) fun(x, y[i])
        if (is.decreasing(g, x.bound, step) == FALSE) {
            return(FALSE)
        }
    }
    return(TRUE)
  }

FuzzyNumbers.Ext.2 documentation built on May 1, 2019, 9:15 p.m.