"Comfort" function with tunable parameter

94 Views Asked by At

I'm trying to create a "comfort" function with the following characteristics:

  • its domain is $(-\infty, +\infty)$;
  • its range is $[0,1]$;
  • it is at or near its maximum value ($1$) in some interval $[x_{c}-\delta, x_{c}+\delta]$;
  • it is at or near its minimum value ($0$) in the intervals $(-\infty, x_{c}-\delta-\gamma]$ and $[x_{c}+\delta+\gamma, +\infty)$;
  • in the interval $(x_{c}-\delta-\gamma, x_{c}-\delta)$ it has behavior similar to the sigmoid function $\dfrac{1}{1 + e^{-x}}$, while in the interval $(x_{c}+\delta, x_{c}+\delta+\gamma)$ similar to the sigmoid function $\dfrac{1}{1 + e^{x}}$;
  • it should have tunable parameters to control $\delta$, $\gamma$, and the transition from minimum to maximum value and from maximum to minimum (in the same way that a sigmoid function can be controlled).

Can anybody help? Thank you.

1

There are 1 best solutions below

1
On BEST ANSWER

Here is my function. Through dumb luck tweaking another construct of mine this appears to fit the bill:

$$f(x)=\displaystyle\frac{e^{\delta^2r}}{e^{\delta^2r}+e^{rx^2}}.$$

Parameter descriptions:

  1. The parameter $\delta$ corresponds to your description. The jump/dip occurs at $\pm \delta$.

  2. The parameter $r$ controls the shape of the sigmoid turn at $\pm \delta$. If positive it jumps from $0$ to $1$ then back. If negative, it does the reverse.


An additional parameter improvement:

Here I just added an additional parameter $c$ which corresponds to your $x_c$ allowing for you to modify the center as well. :))

$$f(x)=\displaystyle\frac{e^{\delta^2r}}{e^{\delta^2r}+e^{r(x-c)^2}}.$$

That was alot of fun. Keep them coming!