I know that if I had evenly spaced points, I can use $U_{xx}\approx \frac{U_{i-1}-2U_{i}+U_{i+1}}{dx^2}$.
But if my gridpoints are unevenly spaced, I assume that I can obtain the finite difference formula in the following way:
$D^-[D^+(U)]$, where $D^-$ and $D^+$ are the backward and forward difference formulas. If I define $h_i=x_{i}-x_{i-1}$, then I think I would obtain:
$D^-[D^+(U)] = D^-[\frac{U_{i+1}-U_{i}}{h_{i+1}}] = \frac{\frac{U_{i+1}-U_{i}}{h_{i+1}} - \frac{U_{i}-U_{i-1}}{h_{i+1}}}{h_i}=\frac{U_{i-1}-2U_{i}+U_{i+1}}{h_ih_{i+1}}$.
However, I have some doubts about this formula. Particularly, the term $\frac{U_{i}-U_{i-1}}{h_{i+1}}$ might be wrong. Any feedback on this would be greatly appreciated :)