Building on @LubosMotl's answer a bit, let's generalize a bit. (I suspect this is largely the point of the mollifiers mentioned by @Mauro but I didn't find the Wikipedia article very practically useful)
We have two functions, $f$ and $g$ which intersect at some point $x^*$ where WOLG $f'(x^*), so that (at least locally) $f(x)>g(x),x and vice versa to the right.
We want a function $h$ which "smooths" $f$ and $g$ together--either we want $h$ to look like $f$ to the right and $g$ to the left of $x^*$ (which I'll focus on below) or the opposite.
To this end, we might consider writing $h$ as the "linear combination" of $f$ and $g$ using weights $\lambda$:
$h(x)=\lambda(x)g(x)+(1-\lambda(x))f(x)$
The appropriate restrictions on $\lambda$ are:
- $\lambda(x^*)=\frac{1}{2}$ (so that $h$ passes through $f(x^*)=g(x^*)$)
- $\lim\limits_{x\rightarrow x_L}=1$
- $\lim\limits_{x\rightarrow x_R}=0$
- $\lambda$ monotone decreasing
Where $x_k$ is chosen at some point where we want $h$ to intersect exactly one of the original functions, or set to $\pm \infty$ to approach $f,g$ asymptotically.
The simplest choice is simple linear combinations: $\lambda(x)=\frac{x_R-x}{x_R-x_L}$, but the form also lends itself to $\lambda$ which are symmetric CDFs.
The weighting given by @LubosMotl is just the Logistic CDF, with $\mu=x^*$ and $s=\frac{1}{2K}$ being the scaling parameter--the closer to 0, the narrower the spread of the underlying distribution, and the closer $h$ will be to tracking $f$ and $g$ exactly.
The simplest choice for finite $x_L,x_R$ is probably a symmetric (which requires the parameters are equal) non-central Beta distribution: $\lambda(x;\alpha,x_L,x_R)=\frac{\intop\limits_0^{\frac{x-x_L}{x_R-x_L}} (t(1-t))^{\alpha-1}dt}{\intop_0^1 (t(1-t))^{\alpha-1}dt}$
A quick R
simulation to show this in action:
f<-x<-0:10; g<-5; llambda<-function(x,s=1,mu=5){1/(1+exp(-(x-mu)/s))} h<-function(f,g,l){l*g+(1-l)*f} h1<-h(f,g,llambda(x,s=1)) h.1<-h(f,g,llambda(x,s=.1)) h10<-h(f,g,llambda(x,s=10)) matplot(x,cbind(f,g,h1,h.1,h10),type="l", col=c("black","red","blue","green","orange"), ylab="",main="Comparison of Smoothers",lty=c(1,1,2,2,2),lwd=c(3,3,2,2,2)) legend("topleft",legend=c("f","g","h, scale=1","h, scale=.1","h, scale=10"), bty="n",col=c("black","red","blue","green","orange"), lty=c(1,1,2,2,2),lwd=c(3,3,2,2,2))
