Examples of smooth functions 1 [closed]

I am trying to understand smooth functions. My question is what is an example of a smooth function $$f\colon\mathbb{R}\to\mathbb{R}$$ such that $$f(x)=0$$ for all $$x\leqslant-1$$ and $$x\geqslant1$$, but $$f(0)=1$$?

And similarly, what about an example of a smooth function $$f\colon\mathbb{R}\to\mathbb{R}$$ where $$f'(x)=-1$$ for all $$x\leqslant-1$$ and $$f'(x)=1$$ for all $$x\geqslant1$$?

closed as off-topic by user10354138, Jendrik Stelzner, José Carlos Santos, Robert Shore, StrantsMay 13 at 22:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please provide additional context, which ideally explains why the question is relevant to you and our community. Some forms of context include: background and motivation, relevant definitions, source, possible strategies, your current progress, why the question is interesting or important, etc." – user10354138, Jendrik Stelzner, José Carlos Santos
If this question can be reworded to fit the rules in the help center, please edit the question.

The best examples comes from the study of mollifiers. Mollifiers are used to find smooth approximations to well known cut off functions such as $$sgn(x)$$, and the heaviside function.
A standard example is $$\varphi(x) = e^{-1/(1-|x|)}$$. This will fit the bill for your first question as long as you normalise it by multiplying by $$e$$.
You just have to look for a function $$f(x)=0$$ on the interval $$(-\infty ,-1]\cup [1,\infty)$$ and extend it with continuity on $$(-1,1)$$ by imposing $$f(-1)=f(1)=0$$,$$f(0)=1$$ and $$f'(-1)=f'(1)=0$$.
Since $$f(x)=0$$ is continuous in $$(-\infty ,-1]\cup [1,\infty)$$ and also is its derivative, you just have to ensure to pick a function accordingly to the conditions above that is continuous on $$(-1,1)$$ with continuous derivative.
Similarly for second request you just have to find the proper function to extend with continuity your function in the interval $$(-1,1)$$