[Math] How to construct a bump function ends at different value

analysis

May I ask how to construct a ''bump'' function ends at different value? For example: $\Psi\colon [0,1] \to [0,1]:$
$$ \Psi (x) =
\begin{cases}
0 & \quad \text{for $0 \leq x < 1/3$}\\
??? & \quad \text{for $1/3 \leq x < 1/2$}\\
1 & \quad \text{otherwise}
\end{cases}$$

Best Answer

Take $$g(t)=\left\lbrace \begin{array}{ll} \exp\left(-1/t^2 \right) & t>0 \\ 0 & t\leq 0 \end{array}\right.$$ Now define

$$\phi(t) = \left(\int_{-1}^{t}h(\tau)d\tau\right)\cdot \left(\int_{-1}^{t}h(\tau)d\tau\right)^{-1} $$ with $$h(t) = g(1+t)\cdot g(1-t)$$

Now take a look at $$f(x) = \phi\left(\frac{R+r-2\|x-a\|}{R-r}\right)$$

Hence function is equals to $0$ for $\|x-a\|\geq R$ and $1$ for $\|x-a\|\leq r$, i.e. $$f(x)=\left\lbrace \begin{array}{ll} 1 & \|x-a\|\geq R\\ 0 & \|x-a\|\leq r \end{array}\right.$$

and for all $x$ with $r<\|x-a\|<R$ it it increasing from $0$ to $1$

Furthermore $f$ is actually a $\mathcal{C}^{\infty}$-function. Your part is just to find convenient values for $r$, $R$ and $a$ so that $f$ fullfills your requirements.