`f(x)=xlnx` and `h = 1`, estimate `f^'(4) and f^('')(4)`
using Four point Forward difference, Backward difference, Central difference formula numerical differentiation
Also find exact value of f', f'' and error for each estimation
Solution:
Equation is `f(x) = xln(x)`.
`:. f^'(x) = ln(x)+1`
`:. f^('')(x) = 1/x`
The value of table for `x` and `y`
x | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
---|
y | 0 | 1.3863 | 3.2958 | 5.5452 | 8.0472 | 10.7506 | 13.6214 |
---|
Four-point CDF (Central difference formula)
`f^'(x)=1/(12h)[f(x-2h)-8f(x-h)+8f(x+h)-f(x+2h)]`
`f^'(4)=1/(12*1)[f(4-2*1)-8f(4-1)+8f(4+1)-f(4+2*1)]`
`f^'(4)=1/12[f(2)-8f(3)+8f(5)-f(6)]`
`f^'(4)=1/12[1.3863-8(3.2958)+8(8.0472)-10.7506]`
`f^'(4)=2.3872`
Absolute Error:`|"exact value of " f^'(4)-(2.3872)|=|2.3863 -2.3872|=0.0009`
Four-point FDF (Forward difference formula) for second derivatives
`f^('')(x)=(2f(x)-5f(x+h)+4f(x+2h)-f(x+3h))/(h^2)`
`f^('')(4)=(2f(4)-5f(4+1)+4f(4+2*1)-f(4+3*1))/((1)^2)`
`f^('')(4)=(2f(4)-5f(5)+4f(6)-f(7))/(1)`
`f^('')(4)=(2(5.5452)-5(8.0472)+4(10.7506)-(13.6214))/(1)`
`f^('')(4)=0.2353`
Absolute Error:`|"exact value of " f^('')(4)-(0.2353)|=|0.25 -0.2353|=0.0147`
Four-point BDF (Backward difference formula) for second derivatives
`f^('')(x)=(-f(x-3h)+4f(x-2h)-5f(x-h)+2f(x))/(h^2)`
`f^('')(4)=(-f(4-3*1)+4f(4-2*1)-5f(4-1)+2f(4))/((1)^2)`
`f^('')(4)=(-f(1)+4f(2)-5f(3)+2f(4))/(1)`
`f^('')(4)=(-0+4(1.3863)-5(3.2958)+2(5.5452))/(1)`
`f^('')(4)=0.1563`
Absolute Error:`|"exact value of " f^('')(4)-(0.1563)|=|0.25 -0.1563|=0.0937`
This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then