TITLE: Continuous function for day/night with night being $c$ times longer than day
QUESTION [7 upvotes]: I'm looking for a function to transform domain $[0,1)$ into range $[0,1)$ such that the size of the domain corresponding to the range interval $[.5,1)$ is $c$ times the size of the domain corresponding to the range interval $[0,.5)$. The range interval $[0,.5)$ will correspond to day time and [.5,1) will correspond to night time, so this function's output will make night time $c$ times as long as day time.
A piece-wise function for example would satisfy the problem, but I would like the function to be smooth on the interval $[0,1)$ (and $y=x$ would satisfy this problem perfectly if $c=1$).
Some extra more explicit constraints:
$f'(0)=f'(1)$ (because I would like the transition from night to day to be smooth as well--if possible, all derivatives at $x=0$ and $y=1$ should be the same)
$f(0)=0$
$f(1)=1$
function is monotonic on $[0,1)$
$cf^{-1}(.5)=1$ (I believe this ensures night is $c$ times longer than day)

REPLY [2 votes]: If $0<c< 2$ then there are simple trigonometric formulae for $f$. For instance,  we can put $f(x)=\sin^k\left(\frac{\pi x}{2}\right)$, where $k>1$ is picked to assure $f\left(\tfrac 1{c+1}\right)=\tfrac 12$, that is $k=\log_{\sin\left(\frac{\pi}{2(c+1)}\right)}\frac 12$. Even simpler, we can put $f(x)=\sin \frac{\pi x^k}{2}$, where $k>1$ is picked to assure $f\left(\tfrac 1{c+1}\right)=\tfrac 12$, that is $k=\log_{c+1} 3$ or $c=\sqrt[k]3-1$.

I also looked for a polynomial $f$ of small degree, but not so successfully.
If $f$ is a polynomial of third degree such that $f(0)=0$ and $f(1)=1$ then $f(x)-x$ has roots $0$ and $1$, so $f(x)=x+ax(x-1)(x+b)$ for some real $a$ and $b$. Since case $a=0$ is trivial, we assume that $a\ne 0$. So $f’(x)=a(3x^2+2xb-2x-b)+1$. If $f’(0)=f’(1)$ then $-ab=a(1+b)$, so either $a=0$ or $b=-1/2$. In both cases $f(1/2)=1$.
Assume that $f$ is a polynomial of fourth degree. Then $f’(x)$ is a cubic polynomial such that $f’(x)-f’(0)$ has two roots $0$ and $1$. Thus $f’(x)=f’(0)+ax(x-1)(x+b)$ for some real $a$ and $b$. An equality $1=f(1)-f(0)=\int_0^1 f’(x)dx$ implies $f’(0)=1+\tfrac a{12}(2b+1)$. The monotonicity of $f$ is equivalent to $f’(x)\ge 0$ at $[0,1]$. The latter holds iff $f’(0)\ge 0$ and $f’(x_m)\ge 0$ for each local minimum $x_m\in (0,1)$ of the function $f$. Since $f’’(x_m)=0$, $3x_m^2+2(b-1)x_m-b=0$, that is $x_m=\tfrac{1-b+r}3$, where $r=\pm \sqrt{b^2+b+1}$. Since $f’’’(x_m)=6ax_m+2a(b-1)=2ar$ and $x_m$ is a point of a local minimum, we have that $r$ and $a$ have the same sign. We also need $x_m\in [0,1]$, that is $b-1\le r\le b+2$. It is easy to check that this is equivalent to $b\ge -1$, if $a>0$, and to $b\le 0$, if $a<0$. Unfortunately, I don’t see an easy way to find a range of $c$ for which there exists $f$ satisfying the above sconditions such that $f\left(\tfrac 1{c+1}\right)=\tfrac 12$. We can illustrate $f$ for $a=-12$ and $b=0$. Then $f(x)=-3x^4+4x^3$ and $f^{-1}\left(\tfrac 12\right)\approx 0.614$.