6
$\begingroup$

I am looking for a 2D function, $f(x, y)$ which increases monotonically over the range $(0,0)$ to $(1,1)$. In other words, it will be $0$ at $(0,0)$ and $1$ at $(1,1)$. It will also evaluate to $0$ whenever $x = 0$ or $y = 0$. It's monotonic in the sense that the value at $(0.5,0.6)$ will be greater than at $(0.5, 0.5)$. The closest guess that I have to the function that I am looking for is:

Plot3D[1/((1+e^(-x*y))),{x,0,1},{y,0,1}]

But I would also like to be able to "bias" or make the function rise faster with $x$ relative to $y$ or vice-versa. Ideally, I would like to specify the surface with 2 variables. One that controls / scales how $f(x,y)$ rises relative to $x$, and another that controls / scales how $f(x,y)$ rises relative to $y$.

Edit:

I am looking for a sigmoid-shaped curve. The function does not need to be exactly equal to 1 at $z(1,1)$. However, $z(1,1)$ needs to be higher than any other $z(x,y)$ across the space $x[0:1], y[0:1]$. A closer function than the one above is:

$$z=1/\left(1+e^{-(x^a*y^b)}\right),$$

where $a$ and $b$ are used to "bias" or change the slope of the curve with respect to $x$ vs. $y$. However, that curve is close to 1 at $z(2,2)$ instead of $z(1,1)$. So $x$ and $y$ need to be scaled. Those scaling factors will be a function of $a$ and $b$. They cannot be computed directly since the exponent needs to be 0 to satisfy the equation exactly. However, if the exponent evaluates to a sufficiently small number, such as $0.01$, that should be close enough for my purposes.

$\endgroup$

2 Answers 2

5
$\begingroup$

Here's a simple example: $f(x,y)=xy$. You can change the powers of $x$ and $y$ to 'bias' one of $x$ or $y$.

Here's another function that is "sigmoid-shaped" and is close to your required values, as per your comments:

$$f(x,y)=\left( \frac{1}{1+e^{-100x+50}}\right)\left( \frac{1}{1+e^{-100y+50}}\right)$$

This is approximately $0$ at $(0,0)$ and $1$ and $(1,1)$, and is sigmoid-shaped in the sense that when either $x=1$ or $y=1$ the resulting slice of the 3D-plot is a sigmoid, as seen here:

enter image description here

Theoretically, you could also make this exactly equal to $1$ at $(1,1)$ and $0$ at $(0,0)$ by multiplying by a constant and changing the values of $50$ in the exponents appropriately to ensure that the function went through the points $(0,0,0)$ and $(1,1,1)$.

$\endgroup$
6
  • $\begingroup$ That fits my original requirements, but is there another function that also fits the requirements, but has more of a sigmoid shape? For example, z=1/(1+e^(-x^a*y^b)) might be the function that I am looking for, but how do I make it == 1 when x = 1, y = 1? The multiplier constant should be a function of a and b, but not sure how to compute it. $\endgroup$ Jul 10, 2014 at 21:49
  • $\begingroup$ Your function won't ever be able to equal to 1 when $x=y=1$ because $e^w$ is never zero, which would be necessary for you to have $z(1,1)=1$. You should add that you want a "sigmoid-shaped curve" to your question. You won't ever be able to get anything that is truly sigmoid-shaped that satisfies the other properties, simply because the horizontal asymptotes $y=0,1$ make this impossible. However, I can give you something "close" if you want. $\endgroup$
    – Hayden
    Jul 10, 2014 at 22:20
  • $\begingroup$ I should have mentioned that it does not have to exactly equal 1 at z(1,1). But I would like z(1,1) to be higher than any other z(x,y) across the space x[0:1], y[0:1]. The function that I mentioned above, z=1/(1+e^(-x^a*y^b)), for example with a = 2 and b = 0.9 is approximately equal to 1 at x = 2, y = 2. So z=1/(1+e^(-(x*2)^a*(y*2)^b)) is close enough to 1 at x = 1, y = 1 for a = 2 and b = 0.9. The problem is that the x and y multiplers (which are both 2 in this case) change as a function of a and b. What function did you have in mind that is "close"? $\endgroup$ Jul 10, 2014 at 22:55
  • $\begingroup$ @PentiumPro200 I think that you should put in your question exactly what you want. $\endgroup$
    – Hayden
    Jul 10, 2014 at 22:57
  • $\begingroup$ @PentiumPro200 see updated answer. $\endgroup$
    – Hayden
    Jul 10, 2014 at 23:08
0
$\begingroup$

The following function may fit your need: $$ \frac{1}{1+e^{-(x+y-1)*(a+b*(x-y)^2)}} $$ when $a = 4, b = 16$, the function looks like this:

enter image description here

The following is its contour plot:

enter image description here

When $x=y, a=1$, the function degenerates to a simple sigmoid function $\frac{1}{1+e^{-(x+y-1)}}$, which provides the basic required property of the function, such as $f(0, 0) \approx 0$, $f(1,1) \approx 1$.

Adding the term $a+b*(x-y)^2$ is to provide some control to the shape of the function to achieve $f(0, y) \approx 0$, $f(x,0) \approx 0$, $f(1, y) \approx 1$, $f(x,1) \approx 1$ etc.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .