`f(x)=sinx` and `h = 0.1`, estimate `f^'(0.8) and f^('')(0.8)`
using Two 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.7 | 0.8 | 0.9 |
---|
y | 0.6442 | 0.7174 | 0.7833 |
---|
Two-point FDF (Forward difference formula)
`f^'(x)=(f(x+h)-f(x))/h`
`f^'(0.8)=(f(0.8+0.1)-f(0.8))/0.1`
`f^'(0.8)=(f(0.9)-f(0.8))/0.1`
`f^'(0.8)=(0.7833-0.7174)/0.1`
`f^'(0.8)=0.6597`
Absolute Error:`|"exact value of " f^'(0.8)-(0.6597)|=|0.6967 -0.6597|=0.037`
Two-point BDF (Backward difference formula)
`f^'(x)=(f(x)-f(x-h))/h`
`f^'(0.8)=(f(0.8)-f(0.8-0.1))/0.1`
`f^'(0.8)=(f(0.8)-f(0.7))/0.1`
`f^'(0.8)=(0.7174-0.6442)/0.1`
`f^'(0.8)=0.7314`
Absolute Error:`|"exact value of " f^'(0.8)-(0.7314)|=|0.6967 -0.7314|=0.0347`
Two-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`
This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then