[Math] Numerical Differentiation – Finding h value

derivativesintegrationnumerical methodsnumerical-calculusordinary differential equations

I am trying to understand one question's solution, but I didn't get that how they computed "h" in this particular question:

Original Question Statement:

With using the data on the table below, Calculate approximate values of $f'(0.3), f'(0.5), f'(1.1)$ and $f'(1.5)$ in terms of $a,b,c,d,…,j$ with the best method approach.

The Question and Its solution

Actually, the question wants us to find approximate values of $f'(0.3), f'(0.5), f'(1.1)$ and $f'(1.5)$ with using the best methods. In the solution part, first they find its h value, then determine which formula will they use ( 3PEP – 5 PEP or something else ) and then applying the formula and in the end writing it in the form of $a,b,c,d,…,j$ . Here, 3PEP is short name of Three Point Endpoint Formula, 5PEP is Five Point Endpoint Formula, 5PMP is Five Point Midpoint Formula and so on. So after all of the explanation, as a summary of what I didn't understood from this solution:

1) How they found the h value for particular $x$ value ?
2) How they determined which formula they should use for this $x$ value ?

Thank you for all answers from now ..

Best Answer

  1. The only requirement for h is for the points be equally spaced. So you can choose any value h which has the corresponding value.

eg. f'(0.3).
If I choose h = 0.2, f(0.3+h)=f(0.5) = b, However f(0.3+2h)=f(0.7) is undefined, so we cannot choose h=0.2
If I choose h = 0.5, f(0.3+h)=f(0.8) = c, However f(0.3+2h)=f(1.3) is undefined, so we cannot choose h=0.5
If I choose h = 0.7, f(0.3+h)=f(1) = d, However f(0.3+2h)=f(1.7)=k. This works
If I choose h = 0.8, f(0.3+h)=f(1.1) = e, However f(0.3+2h)=f(1.9)=j. This works
When two option works, we compare the error. We know the error for 3PEP is $$\frac{h^2}{3}f'''(x_0)$$ Since $$\frac{(0.7)^2}{3}f'''(x_0)<\frac{(0.8)^2}{3}f'''(x_0)$$ We choose the h=0.7

Similar work need to be done for calculating the best h

  1. Generally we actually use every possible rule and check which has the lowest error. Since 5 point rule (5PEP or 5PMP) error is proportional to the fifth derivative, while the 3 point rule (3PEP or 3PMP) is proportional to the third derivative. We always check if it is possible to use the 5 point rule.
    As we know the error for 3PMP is $$\frac{h^2}{6}f'''(x_0)$$ and the error for 3PEP is $$\frac{h^2}{3}f'''(x_0)$$
    We try to minimize this error by choosing the best rule.

eg. f'(0.3) cannot use midpoint rule since there is no values for below 0.3. Also from above we get the minimum h is 0.7 ( f(0.3+3h) is undefined, therefore we cannot use 5 point ).

eg. f'(0.5) cannot use midpoint rule since we cannot really use h=0.2 or h=0.3 using midpoint f(0.5).Using similar method as part 1, we found 5 PEP using 0.3. Since 5PEP is better than 3PEP by argument above.

eg. f'(1.1). Thereare bunch of options :
3PMP using h = 0.1
3PMP using h = 0.3
3PMP using h = 0.6
3PMP using h = 0.8
3PEP using h = 0.3
5PMP using h = 0.3
Always choose the 5 point rule if available over 3 point rule, so 5PMP using h=0.3 is used

I will leave f'(1.5) for you to decide

From https://www3.nd.edu/~zxu2/acms40390F15/Lec-4.1.pdf