Assignment 03 APSC 256
Assignment 03 APSC 256
Assignment 03
1 −1 2 −6
f’(x) = 𝑥
, f′′(x)= 2 , f′′′(x)= 3 , and f′′′′(x)= 4 .
𝑥 𝑥 𝑥
a=1, so f(a)=ln(1)=0, f′(a)=1, f′′(a)=−1, f′′(a)=−1, f′′′(a)=2, and f′′′′(a)=−6.
Zeroth-order:
𝑙𝑛(1.5) − 𝑙𝑛(1)
εT = || 𝑙𝑛(1.5) || = 1
No εa as no previous value.
First-order:
Second-order:
𝑙𝑛(1.5) − 0.375 |
εT: || 𝑙𝑛(1.5) | = 0.075
0.375 − 0.5
εa: || 0.5
| = 0.333
|
Third-order:
𝑙𝑛(1.5) − 0.417 |
εT: || 𝑙𝑛(1.5) | = 0.027
1
Animish Gupta APSC 256 52627577
Assignment 03
0.401 − 0.375 |
εa: || 0.401 | = 0.099
Fourth-order:
𝑙𝑛(1.5) − 0.401 |
εT: || 𝑙𝑛(1.5) | = 0.010
0.401 − 0.417 |
εa: || 0.401 | = 0.039
Forward Difference:
𝑓(2+0.1) − 𝑓(2) |
f’(x) = || 2.1 − 2 | = 297.65
283 − 297.65 |
εT: || 283 | = 0.0518
Backward Difference:
𝑓(2) − 𝑓(2−0.1) |
f’(x) = || 2 − 1.9 | = 268.85
283 − 268.85 |
εT: || 283 | = 0.05
Centered Difference:
𝑓(2+0.1) − 𝑓(1.9) |
f’(x) = || 2(0.1) | = 283.25
283 − 283.25 |
εT: || 283 | = 0.00088
As can be inferred from this information, the centered difference has the lowest true relative error
compared to forward and backward differences. The truncation method for centered difference is
of magnitude O(h2). This means that as h gets smaller, the error for the centered difference
2
Animish Gupta APSC 256 52627577
Assignment 03
approximation decreases quadratically, which is faster than the linear decrease for the forward
and backward difference approximations. This is why it’s considered the best approximation
based on Big O notation for truncation errors.
Q3)
(a)
3
Animish Gupta APSC 256 52627577
Assignment 03
(b)
1 0.75 33.33
2 0.875 14.2857
3 0.9375 6.6666
4 0.9062 3.4483