A "smooth" version of this function? Let $(L,M,H)\in\mathbb{R}^3$ s.t. $L<M<H$. I am seeking a function $\varphi:\mathbb{R}\to[0,1]$ that satisfies the following:

*

*$\varphi(M)=1$ and $\varphi(x)=0$ $\forall x\in(-\infty,L]\cup[H,\infty)$.

*$\varphi'(x)\geq0$ $\forall x\in[L,M) $ and $\varphi'(x)\leq0$ $\forall x\in[M,R] $

*Continuously-differentiable

Something that achieves the first two criteria -- but not the third -- is the "triangle function" $f(x;L,M,H)$, given by
\begin{equation}
f(x;L,M,H) := \begin{cases}
0, & \text{if } x<L \\ 
\frac{x-L}{M-L}, & \text{if } x \in[L,M)\\
1-\frac{x-M}{H-M}, & \text{if }  x\in[M,R]\\
0 , & \text{if } x>R 
\end{cases}
\end{equation}
Is there a continuously-differentiable function that achieves all three criteria?
Reason for question: I am tinkering with a model. I need a unimodal function with a range [0,1], whose bounded support ($[L,R]$) and mode $M$ can be flexibly manipulated. The "triangle function" $f$ I defined above acheives this, but its "kink" is making life difficult.

 A: It is easier to just find a specific increasing function $\rho$ such that $\rho(x)=0$ for $x\leq 0$ and $\rho(x)=1$ for $x\geq 1.$ Then combine in various ways:
$$\phi(x)=\rho\left(\frac{x-L}{M-L}\right)\left(1-\rho\left(\frac{x-M}{H-M}\right)\right)$$
We can find such a function $\rho$ which is infinitely differentiable, but it is easier to find a continuously differentiable $\rho.$
For example: $$\rho(x)=\begin{cases}0&x\leq 0\\2x^2&0<x\leq 1/2\\1-2(1-x)^2&1/2<x<1\\1&x\geq 1\end{cases}$$

For infinite differentiability, you need to know this function:
$$f(x)=\begin{cases}e^{-1/x^2}&x>0\\0&x\leq 0\end{cases}$$ is infinitely differentiable.
Then let $h(x)=f(x)f(1-x).$ This is infinitely differentiable, positive in $(0,1),$ and $0$ outside $(0,1).$ Define:
$$\rho(x)=\frac1C\int_0^x h(t)\,dt$$ with $C={\int_0^1 h(t)\,dt}.$ Then $\rho(x)$ has our property - increasing, zero at $x\leq 0,$ $1$ at $x\geq 1$, and infinitely differentiable.
That might be less than useful in a computing setting, since $\rho(x)$ is unlikely to have an easy closed formula.

You can do this trick with any $f$ which is continuously $n-1$-differentiable with $f^{(i)}(0)=0$ for $i=0,1,\dots,n-1$ and positive on $(0,1).$ This will give a continuously $n$-differentianle function.
For example, for $n=1,$ $f(x)=x$ gives, for $x\in[0,1]:$
$$\int_0^x t(1-t)\,dt=\frac{x^2}2-\frac{x^3}{3}$$ with $C=\frac{1}{6},$ and you get:
$$\rho(x)=\begin{cases}3x^2-2x^3&x\in(0,1)\\
0&x\leq 0\\
1&x\geq0\end{cases}$$
The polynomial $q(x)=3x^2-2x^3$ has the property that $q(0)=q’(0)=0$ and $q(1-x)=1-q(x).$
