`f(x)=sinx` and `h = 0.1`, estimate `f^'(0.8) and f^('')(0.8)`
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) = sin(x)`.
`:. f^'(x) = cos(x)`
`:. f^('')(x) = -sin(x)`
The value of table for `x` and `y`
x | 0.6 | 0.7 | 0.8 | 0.9 | 1 |
---|
y | 0.5646 | 0.6442 | 0.7174 | 0.7833 | 0.8415 |
---|
Three-point FDF (Forward difference formula)
`f^'(x)=1/(2h)[-3f(x)+4f(x+h)-f(x+2h)]`
`f^'(0.8)=1/(2*0.1)[-3f(0.8)+4f(0.8+0.1)-f(0.8+2*0.1)]`
`f^'(0.8)=1/0.2[-3f(0.8)+4f(0.9)-f(1)]`
`f^'(0.8)=1/0.2[-3(0.7174)+4(0.7833)-0.8415]`
`f^'(0.8)=0.6988`
Absolute Error:`|"exact value of " f^'(0.8)-(0.6988)|=|0.6967 -0.6988|=0.0021`
Three-point BDF (Backward difference formula)
`f^'(x)=1/(2h)[f(x-2h)-4f(x-h)+3f(x)]`
`f^'(0.8)=1/(2*0.1)[f(0.8-2*0.1)-4f(0.8-0.1)+3f(0.8)]`
`f^'(0.8)=1/0.2[f(0.6)-4f(0.7)+3f(0.8)]`
`f^'(0.8)=1/0.2[0.5646-4(0.6442)+3(0.7174)]`
`f^'(0.8)=0.6992`
Absolute Error:`|"exact value of " f^'(0.8)-(0.6992)|=|0.6967 -0.6992|=0.0025`
Three-point CDF (Central difference formula)
`f^'(x)=(f(x+h)-f(x-h))/(2h)`
`f^'(0.8)=(f(0.8+0.1)-f(0.8-0.1))/(2*0.1)`
`f^'(0.8)=(f(0.9)-f(0.7))/0.2`
`f^'(0.8)=(0.7833-0.6442)/0.2`
`f^'(0.8)=0.6955`
Absolute Error:`|"exact value of " f^'(0.8)-(0.6955)|=|0.6967 -0.6955|=0.0012`
Three-point FDF (Forward difference formula) for second derivatives
`f^('')(x)=(f(x)-2f(x+h)+f(x+2h))/(h^2)`
`f^('')(0.8)=(f(0.8)-2f(0.8+0.1)+f(0.8+2*0.1))/((0.1)^2)`
`f^('')(0.8)=(f(0.8)-2f(0.9)+f(1))/(0.01)`
`f^('')(0.8)=(0.7174-2(0.7833)+0.8415)/(0.01)`
`f^('')(0.8)=-0.7827`
Absolute Error:`|"exact value of " f^('')(0.8)-(-0.7827)|=|-0.7174 +0.7827|=0.0653`
Three-point BDF (Backward difference formula) for second derivatives
`f^('')(x)=(f(x-2h)-2f(x-h)+f(x))/(h^2)`
`f^('')(0.8)=(f(0.8-2*0.1)-2f(0.8-0.1)+f(0.8))/((0.1)^2)`
`f^('')(0.8)=(f(0.6)-2f(0.7)+f(0.8))/(0.01)`
`f^('')(0.8)=(0.5646-2(0.6442)+0.7174)/(0.01)`
`f^('')(0.8)=-0.6437`
Absolute Error:`|"exact value of " f^('')(0.8)-(-0.6437)|=|-0.7174 +0.6437|=0.0737`
Three-point CDF (Central difference formula) for second derivatives
`f^('')(x)=(f(x-h)-2f(x)+f(x+h))/(h^2)`
`f^('')(0.8)=(f(0.8-0.1)-2f(0.8)+f(0.8+0.1))/(0.1)^2`
`f^('')(0.8)=(f(0.7)-2f(0.8)+f(0.9))/(0.01)`
`f^('')(0.8)=(0.6442-2(0.7174)+0.7833)/(0.01)`
`f^('')(0.8)=-0.7168`
Absolute Error:`|"exact value of " f^('')(0.8)-(-0.7168)|=|-0.7174 +0.7168|=0.0006`
This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then