A smooth function instead of a piecewise function I want to find a smooth function approximating f(x) as best as possible:
\begin{equation*}
f(x) =
\begin{cases}
x & \text{if } x \le a,\\
a & \text{if } x > a.
\end{cases}
\end{equation*}
as a  smooth function ($a$ is a positive constants and x is a positive real number). $f(x)=\sqrt[n]{x}$ has a similar trend, but not good enough. What is best alternative function for the piecewise one. 

 A: As I said in one of my comments you can modify $f(x)$ in a neighbourhood of $x=a$, say $(a-\varepsilon,a+\varepsilon)$, for $\varepsilon>0$ as small as you wish. In that small interval you want to change your function by some other smooth function $g(x)$ satisfying the following conditions: $g(a-\varepsilon)=a-\varepsilon$, $g(a+\varepsilon)=a$, $g'(a-\varepsilon)=1$, $g'(a+\varepsilon)=0$. These conditions ensure that $g$ glues well (smoothly) with $f$.
If my computations are not wrong a function satisfying the conditions above is $$g(x)=-\frac{1}{4\varepsilon}\left(x^2-2(a+\varepsilon)x+(a-\varepsilon)^2\right).$$
Then a smooth function approximating $f$ would be
$$
f_{\varepsilon}(x)=\left\{
\begin{array}{ccl}
x &\mbox{if}& x\leq a-\varepsilon\\-\frac{1}{4\varepsilon}\left(x^2-2(a+\varepsilon)x+(a-\varepsilon)^2\right)&\mbox{if}&  a-\varepsilon\leq x\leq a+\varepsilon\\
a&\mbox{if} & x\geq a+\varepsilon
\end{array}
\right.
$$
Notice the subscript $f_\varepsilon$ indicating the dependence on the parameter $\varepsilon$. The smaller you take the parameter, the better the approximation (since you're modifying $f$ in a smaller interval).
A: Consider the weighting function $h(x)=exp(5(x-a))/(1+exp(5(x-a))$, which takes values close to 0 for $x<<a$ and close to 1 for $x>>a$, [plot it to check this statement] Now approximate your $f(x)$ weighting $x$ and $a$, like in 
$$
g(x)=x(1-h(x))+ah(x)
$$
Intuitively, $h$ allows you to switch from $x$ to $a$ (or any other constant or function, for that matters) around $x=a$, with a speed that depends on the arbitrary coefficient 5, which can be seen in the definition of $h$. Increase it to improve the fit.
See an example for $a=3$ in the picture below.
A: If you are looking for a smooth function $f\colon[0,\infty)$ such that $f'(0)=1$ and $f(x)\to a$ as $x\to\infty$, you can try
$$ f(x)=\frac{2a}{\pi}\arctan \frac {2x} {a\pi}$$
or 
$$ f(x)=\frac{x+ax^2}{1+x^2}.$$
In order to say what is "best", some measure of quality should be specified.
A: A nice class of functions which "approximate" your continuous example is given by the sigmoids: 
http://en.wikipedia.org/wiki/Sigmoid_function
Unfortunately your "best alternative function" concept is not well defined, as pointed out by Hagen von Eitzen. I would try (if this is your exact problem!) at least to work with a fixed "error" $a-g(a)$ at the point $a$, while searching for a smooth candidate $g$ approximating your function $f$.
