Need function for tunable sigmoid 2D surface

560 Views Asked by At

This question is similar to one that I asked 6 months ago, but I added some additional requirements and I'll try to ask it more concisely.

Requirements:

  1. I need a $2D$ surface, $z = f(x, y)$ where the domain of $x$ is $[0,1]$ and domain of $y$ is $[0,1]$. I don't care how the function behaves outside the domain.
  2. $f(0, 0) = 0$.
  3. $f(1, y) = 1, f(x, 1) = 1$
  4. Surface should be monotonic. Meaning that $f(x + \delta, y) \geq f(x, y)$ and $f(x, y + \delta) \geq f(x, y)$. The "equal to" part is to handle the case where $x$ or $y = 1$. In that case, the function should be 1 per condition 3.
  5. Should be some way to adjust the shape of the surface or bias it. For example, here is an example of a tunable sigmoid function, $f(x)$:

enter image description here

I can modify the parameters $g$ and $k$ to change the shape inflection point of the sigmoid. I'd like the ability to "tune" the surface like that using hopefully only 3-6 parameters.

**Edit: Function does not need to be exactly 0 at $f(0,0)$ or exactly 1 at $f(1,y)$ or $f(x,1)$, but should be close.

1

There are 1 best solutions below

0
On

Here's my first solution. It does not represent every possible monotonic surface over the domain x : [0,1], y : [0,1], but it's a good start.

c, d, h, and k are tunable constants that range from -1 to 1.

f(a, x) = (x - x * a) / (a - abs(x) * 2 * a +1)
g(x, y) = (f(c, x) + f(d, y) - f(c, x) * k - f(d, y) * h) / (k + h - abs(f(c, x)) * 2 * k - abs(f(d, y)) * 2 * h + 2)

If anyone can come up with a solution that produces more monotonic surfaces (will probably require more parameters), please let me know.