6. Example-6 (`f(x)=sinx`)
`f(x)=sinx` and `h = 0.1`, estimate `f^'(0.8) and f^('')(0.8)` using Five 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.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1 | 1.1 | 1.2 |
---|
y | 0.3894 | 0.4794 | 0.5646 | 0.6442 | 0.7174 | 0.7833 | 0.8415 | 0.8912 | 0.932 |
---|
Five-point FDF (Forward difference formula) `f^'(x)=1/(12h)[-25f(x)+48f(x+h)-36f(x+2h)+16f(x+3h)-3f(x+4h)]`
`f^'(0.8)=1/(12*0.1)[-25f(0.8)+48f(0.8+0.1)-36f(0.8+2*0.1)+16f(0.8+3*0.1)-3f(0.8+4*0.1)]`
`f^'(0.8)=1/(1.2)[-25f(0.8)+48f(0.9)-36f(1)+16f(1.1)-3f(1.2)]`
`f^'(0.8)=1/(1.2)[-25(0.7174)+48(0.7833)-36(0.8415)+16(0.8912)-3(0.932)]`
`f^'(0.8)=0.6967`
Absolute Error:`|"exact value of " f^'(0.8)-(0.6967)|=|0.6967 -0.6967|=0`
Five-point CDF (Central difference formula) `f^'(x)=1/(12h)[f(x-2h)-8f(x-h)+8f(x+h)-f(x+2h)]`
`f^'(0.8)=1/(12*0.1)[f(0.8-2*0.1)-8f(0.8-0.1)+8f(0.8+0.1)-f(0.8+2*0.1)]`
`f^'(0.8)=1/1.2[f(0.6)-8f(0.7)+8f(0.9)-f(1)]`
`f^'(0.8)=1/1.2[0.5646-8(0.6442)+8(0.7833)-0.8415]`
`f^'(0.8)=0.6967`
Absolute Error:`|"exact value of " f^'(0.8)-(0.6967)|=|0.6967 -0.6967|=0`
Five-point CDF (Central difference formula) for second derivatives `f^('')(x)=1/(12h^2)[-f(x-2h)+16f(x-h)-30f(x)+16f(x+h)-f(x+2h)]`
`f^('')(0.8)=1/(12*(0.1)^2)[-f(0.8-2*0.1)+16f(0.8-0.1)-30f(0.8)+16f(0.8+0.1)-f(0.8+2*0.1)]`
`f^('')(0.8)=1/0.12[-f(0.6)+16f(0.7)-30f(0.8)+16f(0.9)-f(1)]`
`f^('')(0.8)=1/0.12[-0.5646+16(0.6442)-30(0.7174)+16(0.7833)-0.8415]`
`f^('')(0.8)=-0.7174`
Absolute Error:`|"exact value of " f^('')(0.8)-(-0.7174)|=|-0.7174 +0.7174|=0`
This material is intended as a summary. Use your textbook for detail explanation. Any bug, improvement, feedback then
|