Test function $\phi$ for which $\int \phi dx = 1$ I'm looking for a test function $\phi$ in $\mathbb{R}^n$ (i.e. $\phi\in C_{\infty}(\mathbb{R}^n)$ for which $[\phi]$ is compact) such that $\int_{\mathbb{R}^n} \phi(x)dx=1$. I have seen multiple examples of test functions, but they all involve exponentials. I could take the easy road and pick such a test function and divide it by its integral over $\mathbb{R}^n$. But this raises the question of integral computation: f.ex. over $\mathbb{R}$, $$ \int_{-1}^1 \exp\left(-\frac1{1-x^2}\right)dx.$$
So,

*

*is there a test function, for which the integral can easily be computed and equals 1 (preferably without exponentials)?


*How to compute the integral mentioned above; or generally $\int_{B(a,R)} \exp\left( -\frac1{R^2-|x-a|^2}\right)dx$?
Thanks!
 A: Let $\Phi(x_1,x_2,\dots,x_n)=\Psi(x_1)\Psi(x_2)\cdots \Psi(x_n)$, where $\Psi:\mathbb{R}\to \mathbb{R}$ is given by the standard bump function over $\mathbb{R}$:
$$\Psi(x)=\begin{cases} \exp\left(-\frac{1}{1-x^2}\right),&x\in (-1,1) \\ 0,&\mathrm{otherwise}. \end{cases}$$
Then $\Phi$ is a smooth test function with compact (closed) support with a non-zero integral over $\mathbb{R}^n$, but is not normalized to $1$. To this end, we compute the integral of $\Psi(x)$ over $\mathbb{R}$:
$$\begin{align} \int_{\mathbb{R}} \Psi(x)~dx&=\int_{-1}^1 \exp\left(-\frac{1}{1-x^2}\right)~dx\\&=2\int_{0}^1 \exp\left(-\frac{1}{1-x^2}\right)~dx\\&=2\int_0^{\infty} \exp\left(-\frac{1}{1-\tanh^2(u)}\right)~\operatorname{sech}^2(u)~du\\&=2\int_0^{\infty} \exp\left(-\cosh^2(u)\right)~\operatorname{sech}^2(u)~du\\&=-2\int_0^{\infty} \tanh(u)\cdot (-2\sinh(u)\cosh(u)\exp(-\cosh^2(u))~du\\&=4\int_0^{\infty} \exp(-\cosh^2(u))\sinh^2(u)~du\\&=2e^{-1/2}\int_0^{\infty} \exp\left(-\frac{\cosh(2u)}{2}\right)(\cosh(2u)-1)~du\\&=e^{-1/2}\int_0^{\infty} \exp\left(-\frac{\cosh(v)}{2}\right)(\cosh(v)-1)~dv\\&=e^{-1/2}\left(K_1(1/2)-K_0(1/2)\right)\approx 0.4439938,\end{align}$$
where we have used that for $\Re(x)>0$ the modified Bessel function admits the integral representation
$$K_{\alpha}(x)=\int_0^{\infty} e^{-x\cosh(t)}\cosh(\alpha t)~dt.$$
Note that above we use the substitutions $x=\tanh(u)$ and $v=2u$ and we have used integration by parts in the third line. Hence a smooth test function for $\mathbb{R}^n$ whose integral is $1$ and whose (closed) support is compact is given by
$$\Phi_1(x_1,x_2,\dots,x_n)=\frac{e^{n/2}}{(K_1(1/2)-K_0(1/2))^n}\Psi(x_1)\Psi(x_2)\cdots \Psi(x_n).$$

Edit: After looking at Are there other kinds of bump functions than $e^\frac1{x^2-1}$?, it seems like there is a way to avoid non-elementary functions (if for some reason you dislike modified Bessel functions). Inspired by Robert Israel's answer, with
$$\Psi(x)=\begin{cases} \frac{4\left( {x}^{2}+1 \right)\ {{\rm e}^{{\frac {4x}{{x}^{2}-1}}}}}{\left( \left( {x}^{2}-1 \right)  \left( 1+{{\rm e}^{{\frac {4x}{{x}^{
2}-1}}}} \right)\right)^2},&x\in (-1,1) \\ 0,&\mathrm{otherwise}, \end{cases}$$
one has that $\int_{\mathbb{R}} \Psi(x)~dx=1$ (it has elementary anti-derivative $\frac{1}{1+e^{(4x)/(x^2-1)}}$ on $(-1,1)$), so the function $\Phi(x_1,x_2,\dots,x_n)=\Psi(x_1)\Psi(x_2)\cdots \Psi(x_n)$ should satisfy the properties you want.
