Approximate a discrete second derivative with assymetric points

529 Views Asked by At

Good morning.

I need to approximate the second derivative for a discrete function with only few points. My first intuition was to use the traditionnal formula: approximation of the second derivative

Unfortunately my available points are not at symmetrical distance from to the other. In consequence I have clearly doubtful results, with positivesecond derivative while my function is concave.

My question is, do have I to modify the coefficients in my formula to take into account the asymmetry between my two points ? And if I have to do so, which weights to use ? If my intuition is false, what would you recommend to me to do to take into account the assymetry ?

Thank you very much

2

There are 2 best solutions below

3
On

Disclaimer: we are dealing with approximations here; answers are neither unique nor exact, but consistent.

Let us say you want to approximate $$f'(9) \approx \dfrac{f(13) -f(5)}{13-5} \text{ as in }f'(x_0) \approx \dfrac{f(x_0+h) -f(x_0-h)}{2h} \text{ where }x_0=9, h=4.$$ Then, approximate $f'(10)$ either by $$f'(10) \approx \dfrac{f(10) -f(5)}{10-5} \text{ as in } f'(x_0) \approx \dfrac{f(x_0) -f(x_0-h)}{h} \text{ where } x_0=10, h=5;$$ or by $$f'(10) \approx \dfrac{f(13) -f(10)}{13-10} \text{ as in } f'(x_0) \approx \dfrac{f(x_0+h) -f(x_0)}{h} \text{ where } x_0=10, h=3.$$ So then you can approximate $$f''(10) \approx \dfrac{f'(10) -f'(9)}{10-9} \text{ as in } g'(x_0) \approx \dfrac{g(x_0) -g(x_0-h)}{h} \text{ where } x_0=10, h=1, g=f'.$$

0
On

I just came across this question (alas!) to which your task relates heavily to. Consider the formula you posted as an image: $$f''(x)\approx\dfrac{f(x+h)-2f(x)+f(x-h)}{h^2}. \tag{1}$$ It actually came from this: $$f''(x)\approx\dfrac{\dfrac{f(x+h)-f(x)}{h}-\dfrac{f(x)-f(x-h)}{h}}{h}.$$ The generalization for three asymmetric points is $$f''(x)\approx\dfrac{\dfrac{f(x+h_2)-f(x)}{h_2}-\dfrac{f(x)-f(x-h_1)}{h_1}}{\dfrac{h_1+h_2}{2}},$$ which simplifies to $$f''(x)\approx\dfrac{\dfrac{2h_1}{h_1+h_2}\cdot f(x+h_2)-2f(x)+\dfrac{2h_2}{h_1+h_2}\cdot f(x-h_1)}{h_1h_2}. \tag{2}$$ When plugging $h=h_1=h_2$ in $(2)$, you end up with the symmetric case $(1)$. For your specific points ($x=10$, $h_1=5$, $h_2=3$; compute $(h_1+h_2)/2=4$ beforehand) you have $$f''(10)\approx\dfrac{\tfrac{5}{4}f(13)-2f(10)+\tfrac{3}{4}f(5)}{5\cdot 3}.$$