Example of smooth compactly supported function

74 Views Asked by At

Is there an easy example of a smooth compactly supported function (ie. a test function) that equals $e^x$ on the interval $[-1,1]$?

This is in reference to the following stack exchange question here, where they describe a nice procedure but don't give an explicit example of such a function.

I've been trying to construct one and it does not seem obvious at all. Is there something more explicit to know it's existence?

2

There are 2 best solutions below

0
On

Step 1. Consider $$ f(x) = \begin{cases}\exp \left( \frac{-1}{x} \right) \exp \left( \frac{-1}{x-1} \right) , &\qquad 0 < x < 1, \\ 0, &\qquad x\notin (0,1). \end{cases} $$ It's easy to check that $f$ is smooth and obviously supported in $(0,1)$.

Step 2. Take $$ g(x)= f(x+1)-f(x-1). $$ Note that $\int g = 0$ and $g$ is supported in $(-1,2)$

Step 3. Consider $$ G(x)=\frac{\int_{-\infty}^x g(t)\,dt}{\int f}. $$ Since $\int g=0$, G is supported in $(-1,2)$ and $G\equiv 1$ on $(0,1)$.

Step 4. A function satisfying your conditions is $$ F(x)=e^x G(x/2+1/2). $$

0
On

I don't have enough knowledge to comment about your linked question, but a simple example of what you are asking for is considering the following continuous function: $$g(x) = \begin{cases} 1, \quad x=0;\\ 0,\quad |x|\geq 10;\\ \dfrac{1}{1+\exp\left(-\frac{20\left(|x|-5\right)}{x^2-10|x|}\right)},\,\text{otherwise} \end{cases}$$

Then $g(x)$ is a class $C^\infty$ function that has almost a flat top that equals to $g(x)=1$ between $x\in[-1,\ 1]$, and also it equals $g(x)=0$ for $|x|\geq 10$ (so, it is a smooth function with compact support - check smooth bump functions).

Now I can make the function: $$f(x) = g(x)\ e^x$$ such $f(x)$ is another smooth function with compact support, but it resembles the exponential function in the interval $x\in[-1,\ 1]$ (recall that $g(x)$ is not perfectly flat in the top side so $f(x)$ it is not a perfect match of the exponential function - but it is truly flat where it becomes zero).

Check both in Desmos.


Added later

I'm not fully sure about this, but maybe this simpler version of $g(x)$ with support on $x\in[-2,\ 2]$ would help: $$g(x) = \begin{cases} 1, \quad x=0;\\ 0,\quad |x|\geq 2;\\ \dfrac{1}{1+\exp\left(\frac{28-16|x|}{x^2-2|x|}\right)},\,\text{otherwise} \end{cases}$$

which looks like this on Desmos: last attempt

Caution here: I am not sure if this last example is still class $C^\infty$.