A uniform distribution with exponential tails is useful for some applications where a particular range is of equal weight but the limits are soft. I was using it for the example of searching for a property within a particular price range. I might have a particular price range in mind but I don't want a step cutoff at a particular value. It is defined as: $$ pdf(x) = \frac{1}{2(\mu+\sigma)} \left\{ \begin{array} 11 & |x| \leq \mu \\ e^{-(x-\mu)/\sigma} & |x| > \mu \end{array} \right. $$ Where $\mu$ is the half width of the uniform section and $\sigma$ is the half width of the exponential tail. The factor of
using Plots
μ=1
σ=0.2
z=1/(2(μ+σ))
UniformExp(x) = abs(x) > μ ? z*exp(-(x-μ)/σ) : z
plot(0:0.001:3, UniformExp)
using QuadGK, Test
@test quadgk(UniformExp, 0, Inf, rtol=1e-10)[1] ≈ 0.5
Test Passed