I am very new to numerical computation and want to check if it is better to implement $$\partial_x\left(\frac{1}{x}\cdot \partial_x(x\cdot y(x)\right)$$ or if it is faster/more accurate to do $$\partial_x^2 y(x)+\frac 1 x \partial_x y(x)-\frac {y(x)}{x^2}.$$
I use centered difference quotients. When I discretize $x\to k\Delta x$ I end up with $$\partial_x^2 y(x)+\frac 1 x \partial_x y(x)-\frac {y(x)}{x^2}\to \frac{y_{k+1}-2y_k+y_{k-1}}{\Delta x^2}+\frac{1}{k\Delta x}\frac{y_{k+1}-y_{k-1}}{2\Delta x}+\frac{y_{k}}{\Delta x^2k^2}$$ and $$\partial_x\left(\frac{1}{x}\cdot \partial_x(x\cdot y(x)\right)\to \frac{1}{4\Delta x^2k}\left((1+k)y_{k+2}-2ky_k+(k-1)y_{k-2}\right)$$
I am sure that there is a difference between these formulations as this is a question in the script of my professor.
I think in terms of computation time both expressions are very similar (if the former one is rearranged), but I find it strange, that the derivative at $k\Delta x$ depends on coefficients that are not direct neighbors. So I guess that the there is a problem when it comes to the order of this operation, but I do not know how to verify my guess.
I tried to insert the Landau-Symbols $\mathrm{O}(\Delta x^2)$ but ended up with the result, that both are of second order. Because I did not really know what I was doing I would happy if you can help with this calculation.
Best, Alex