Numerical evaluation of first and second derivative We start with the following function $g: (0,\infty)\rightarrow [0,\infty)$,
$$ g(x)=x+2x^{-\frac{1}{2}}-3.$$ From this function we need a 'smooth' square-root. Thus, we check $g(1)=0$, 
$$g'(x)=1-x^{-\frac{3}{2}},$$ $g'(1)=0$ and 
$$g''(x)=\frac{3}{2}x^{-\frac{5}{2}}\geq 0.$$ 
Therefore, we can define the function $f: (0,\infty)\rightarrow \mathbb{R}$,
$$f(x)=\operatorname{sign}(x-1)\sqrt{g(x)}.$$ 
We can compute the first derivatives as 
$$
f'(x)=\frac{1}{2} \frac{g'(x)}{f(x)}=\frac{1}{2}\frac{1-x^{-\frac{3}{2}}}{\operatorname{sign}(x-1)\sqrt{x+2x^{-\frac{1}{2}}-3}}
$$
and second derivatives as 
$$
f''(x)=\frac{1}{2} \frac{g''(x)f(x)-g'(x)f'(x)}{\bigl(f(x)\bigr)^2}\\
=\frac{1}{2}\frac{g''(x)-\frac{\bigl(g'(x)\bigr)^2}{2g(x)}}{f(x)}\\
=\frac{1}{2}\frac{\frac{3}{2}x^{-\frac{5}{2}}-\frac{\bigl(1-x^{-\frac{3}{2}}\bigr)^2}{2\bigl(x+2x^{-\frac{1}{2}}-3\bigr)}}{\operatorname{sign}(x-1)\sqrt{x+2x^{-\frac{1}{2}}-3}}
$$
where we used $f'(x)$ from above, reduced by $f(x)$ and used $f^2(x)=g(x)$. 
For $x=1$ the first and the second derivatives of $f$ are of the type $\frac{0}{0}$. 
I need a numerical stable evaluation of this derivatives. 
But we have numerical cancellation especially in the nominators. 
A linear Taylor-polynomial at $x=1$ is possible for $f'(x)$ but the computation of $f'''(1)$ by hand is time-consuming. 


*

*Is there a better formulation for $f(x)$?

*Is there an easy way to compute the coefficients of the Taylor-polynomials at $x=1$?

*(Edit 2:) How can I evaluate $f'(x)$ and $f''(x)$ numerically stable for $x\in (0,\infty)$?

Edit 1:
The Taylor-polynomial of degree 1 for $f'(x)$ at $x=1$ is 
$$
f'(x)=\frac{\sqrt{3}}{2} - \frac{5}{4\sqrt{3}}(x-1)+\mathcal{O}\bigl(\lvert x-1\rvert^2\bigr)
$$
 A: For the first question, since $g(x)=\frac{(\sqrt{x}-1)^2(\sqrt{x}+2)}{\sqrt{x}}$, then
$$f(x)=sign(x-1)\sqrt{\frac{(\sqrt{x}-1)^2(\sqrt{x}+2)}{\sqrt{x}}}$$
The $sign(x-1)$ part is necessary for $f$ to be smooth, as $\lim_{x\rightarrow1^-}f'(x)\neq\lim_{x\rightarrow1^+}f'(x)$.
Indeed, if we write
$$f'(x)=\frac{1}{2}\frac{1-\frac{1}{x\sqrt{x}}}{sign(x-1)\sqrt{\frac{(\sqrt{x}-1)^2(\sqrt{x}+2)}{\sqrt{x}}}}=\frac{\sqrt[4]{x}}{2\sqrt{(\sqrt{x}+2)}}\frac{1-\frac{1}{x\sqrt{x}}}{(\sqrt{x}-1)}$$
(ignoring the $sign$ part for manipulation), we see that
$$\lim_{x->1^+}f'(x)=\frac{1}{2\sqrt{3}}\frac{0}{0}$$
The part that gives the $\frac{0}{0}$ indetermination can be solved first by multiplying by the conjugate of the denominator...
$$\lim_{x->1^+}\frac{1-\frac{1}{x\sqrt{x}}}{(\sqrt{x}-1)}=\lim_{x->1^+}\frac{(1-\frac{1}{x\sqrt{x}})(\sqrt{x}+1)}{x-1}=\lim_{x->1^+}\frac{\sqrt{x}+1-\frac{1}{x}-\frac{1}{x\sqrt{x}}}{x-1}=\frac{0}{0}\dots$$
...and applying L'Hôpital's rule:
$$\dots\lim_{x->1^+}\frac{1}{2\sqrt{x}}+\frac{1}{x^2}+\frac{3}{2x^{5/2}}=3$$
Knowing this, we get that
$$\lim_{x->1^+}f'(x)=\frac{3}{2\sqrt{3}}=\frac{\sqrt{3}}{2}$$
Analysing the function $f$ taking now into account the $sign(x-1)$, we obtain that
$$\lim_{x->1^-}f'(x)=-\frac{\sqrt{3}}{2}$$
as can be seen plotting $f(x)$ and $-f(x)$.
A: Setting $x^{1/2} = 1 + u$ (the content of Octania's comment) gives, for $x > 0$,
$$
g(x) = x + 2x^{-1/2} - 3
  = \frac{x^{3/2} - 3x^{1/2} + 2}{x^{1/2}}
  = \frac{(1 + u)^{3} - 3(1 + u) + 2}{1 + u}
  = \frac{u^{2} (3 + u)}{1 + u}.
$$
Your definition of $f$ amounts to
$$
f(x) = u \sqrt{\frac{3 + u}{1 + u}}
  = u \sqrt{1 + \frac{2}{1 + u}}.
$$
This is smooth (and numerically stable) near $u = 0$ (i.e., near $x = 1$).
If you need a Taylor expansion, the geometric series and binomial theorem give the first few terms easily, and (in principle) as many terms as you like:
\begin{align*}
1 + \frac{2}{1 + u}
  &= 3\bigl(1 - \tfrac{2}{3}(u - u^{2} + u^{3} + \cdots)\bigr), \\
\sqrt{1 + v}
  &= 1 + \tfrac{1}{2} v - \tfrac{1}{8} v^{2} + \tfrac{1}{16} v^{3} - \cdots, \\
\sqrt{1 + \frac{2}{1 + u}}
  &= \sqrt{3}\left[1 - \tfrac{1}{2} \cdot \tfrac{2}{3}(u - u^{2} + u^{3} + \cdots)
    - \tfrac{1}{8} \cdot \tfrac{4}{9}(u - u^{2} + u^{3} + \cdots)^{2} + \cdots\right].
\end{align*}
