1

I was asked to give a finite difference scheme to approximate the second derivative ${U''}$ on a random grid $(x_{i+1}-x_i = h_i$ and $x_i-x_{i-1} = h_{i-1})$ and give its order.

As usual for this kind of exercice I try to write the Taylor series devellopement for the $u(x_{i+1})$ and $u(x_{i-1})$ and find a linear combination that in this case would give the second derivative. However as the grid is random I'm kinda not sure If I could define it as a function of the paces $h_i$ and $h_{i-1}$ and divide it with so (I think it would pose any trouble) as I do here:

$(i)$ $u(x_{i+1}) = u(x_{i}) +h_i u'(x_i) + \frac{h_i ^2}{2}u''(x_i) + ... $

$(ii)$ $u(x_{i-1}) = u(x_{i}) - h_{i-1} u'(x_i) + \frac{h_{i-1} ^2}{2}u''(x_i) + ... $

doing $(i)/h_i - (ii)/h_{i-1}$ gives

$...$

$\frac{1}{h_ih_{i-1}}[h_{i-1}u(x_{i+1}) - h_iu(x_{i-1})-u(x_i)(h_{i-1}-h_i)] + cst_1h_i^2u'''(x_i) + cst_2h_{i-1}^2u'''(x_i) + ... = \frac{1}{2}(h_i-h_{i-1})u''(x_i)$

which gives

$u''(x_i) ≈ 2\frac{1}{h_i-h_{i-1}}\frac{1}{h_ih_{i-1}}[h_{i-1}u(x_{i+1}) - h_iu(x_{i-1})-u(x_i)(h_{i-1}-h_i)]$

with and $error$ of second order $O(h^2)$

LeA
  • 55
  • 4

1 Answers1

1

Something seems slightly off here but it might just be how I choose to formulate it. Try looking at the linear combination of Taylor expansions given by

$$ h_{i-1}u_{i+1} + h_i u_{i-1} - (h_{i-1} + h_i)u_i \text{ .}$$

It should work out quite nicely and (as a cool side-note) you should be able to show that

$$u_{tt} \approx \frac{v_{i+1} - v_i}{\frac{1}{2}(h_i + h_{i-1})}$$

where $v_{i+1}$ is given by the forward difference approximation $$v_{i+1} = \frac{u_{i+1} - u_i}{h_i} \text{ .}$$

Let me know if you need anything else.

vb628
  • 1,784
  • 5
  • 12