`f(x)=xlnx` and `h = 1`, estimate `f^'(4) and f^('')(4)`
using Three 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 | 2 | 3 | 4 | 5 | 6 |
---|
y | 1.3863 | 3.2958 | 5.5452 | 8.0472 | 10.7506 |
---|
Three-point FDF (Forward difference formula)
`f^'(x)=1/(2h)[-3f(x)+4f(x+h)-f(x+2h)]`
`f^'(4)=1/(2*1)[-3f(4)+4f(4+1)-f(4+2*1)]`
`f^'(4)=1/2[-3f(4)+4f(5)-f(6)]`
`f^'(4)=1/2[-3(5.5452)+4(8.0472)-10.7506]`
`f^'(4)=2.4013`
Absolute Error:`|"exact value of " f^'(4)-(2.4013)|=|2.3863 -2.4013|=0.015`
Three-point BDF (Backward difference formula)
`f^'(x)=1/(2h)[f(x-2h)-4f(x-h)+3f(x)]`
`f^'(4)=1/(2*1)[f(4-2*1)-4f(4-1)+3f(4)]`
`f^'(4)=1/2[f(2)-4f(3)+3f(4)]`
`f^'(4)=1/2[1.3863-4(3.2958)+3(5.5452)]`
`f^'(4)=2.4192`
Absolute Error:`|"exact value of " f^'(4)-(2.4192)|=|2.3863 -2.4192|=0.0329`
Three-point CDF (Central difference formula)
`f^'(x)=(f(x+h)-f(x-h))/(2h)`
`f^'(4)=(f(4+1)-f(4-1))/(2*1)`
`f^'(4)=(f(5)-f(3))/2`
`f^'(4)=(8.0472-3.2958)/2`
`f^'(4)=2.3757`
Absolute Error:`|"exact value of " f^'(4)-(2.3757)|=|2.3863 -2.3757|=0.0106`
Three-point FDF (Forward difference formula) for second derivatives
`f^('')(x)=(f(x)-2f(x+h)+f(x+2h))/(h^2)`
`f^('')(4)=(f(4)-2f(4+1)+f(4+2*1))/((1)^2)`
`f^('')(4)=(f(4)-2f(5)+f(6))/(1)`
`f^('')(4)=(5.5452-2(8.0472)+10.7506)/(1)`
`f^('')(4)=0.2014`
Absolute Error:`|"exact value of " f^('')(4)-(0.2014)|=|0.25 -0.2014|=0.0486`
Three-point BDF (Backward difference formula) for second derivatives
`f^('')(x)=(f(x-2h)-2f(x-h)+f(x))/(h^2)`
`f^('')(4)=(f(4-2*1)-2f(4-1)+f(4))/((1)^2)`
`f^('')(4)=(f(2)-2f(3)+f(4))/(1)`
`f^('')(4)=(1.3863-2(3.2958)+5.5452)/(1)`
`f^('')(4)=0.3398`
Absolute Error:`|"exact value of " f^('')(4)-(0.3398)|=|0.25 -0.3398|=0.0898`
Three-point CDF (Central difference formula) for second derivatives
`f^('')(x)=(f(x-h)-2f(x)+f(x+h))/(h^2)`
`f^('')(4)=(f(4-1)-2f(4)+f(4+1))/(1)^2`
`f^('')(4)=(f(3)-2f(4)+f(5))/(1)`
`f^('')(4)=(3.2958-2(5.5452)+8.0472)/(1)`
`f^('')(4)=0.2527`
Absolute Error:`|"exact value of " f^('')(4)-(0.2527)|=|0.25 -0.2527|=0.0027`
This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then