How to modify this bump function so that the "bump" is at $y=1$?

573 Views Asked by At

$$f(x) = \begin{cases} e^{-1/(1 - x^2)} & -1 < x < 1\\ 0 & \text{otherwise} \end{cases} $$

I noticed that when I multiply the denominator of the fractional part of this function (the $1 - x^2$ part) by larger and larger numbers, the "bump" almost reaches $1$, but it never does (even when I put in $99999\cdot1 - x^2$). I am trying to modify this function so that $f(x) = 1$ for $a \leq x \leq b$, where $a = b = 0$ in this particular case, but still maintain that $f(x) = 0$ for $x < \alpha$ and $x > \beta$ where $\alpha = -1$ and $\beta = 1$ in this case. $f(x)$ must also be smooth.

2

There are 2 best solutions below

0
On BEST ANSWER

If you're trying to make the maximum value of the function 1, just divide it by its maximum value, so it'll be 1 at the maximum.

If you want to define a $C^\infty$ function that is 1 on $[-a,a]$ and 0 outside the interval $[-b,b]$ with $a<b$, you can do the following.

Scale and shift your argument x so that your function is supported on $[-b,-a]$. Subtract another copy of it that's supported on $[a,b]$. Now if you integrate this function from $-\infty$ to $x$ you'll get a function that's similar to what you want, but its maximum value is not 1. Just divide it by the integral under one of the bumps to make it 1.

0
On

If you want to have that $f(0) = 1$, just let $f(x) = e^{-\frac{1}{1-x^2}+1}$ within $x\in(-1,1)$ instead.


Why does this work? Your function attains its maximum value at $x=0$, which is $f(0) = e^{-1}$. Dividing by this value (which is multiplying by $e$) will force the maximum to be $1$, hence the function will be

$$e\cdot f(x) = e^{-\frac{1}{1-x^2}+1} $$ when $x\in(-1,1)$ and $0$ otherwise.

This, however, only works for one point. If you want to make the function equal to $1$ within an interval, you're going to need to use another approach.