Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
14 views

Assignment 03 APSC 256

The document contains the solutions to three questions regarding Taylor series approximations and numerical methods. For question 1, Taylor series approximations are calculated up to fourth order for the function f(x) = ln(x) at x=1, and the corresponding true and approximate errors are reported. For question 2, forward, backward and centered difference approximations are calculated for the derivative of f(x) = 25x^3 - 6x^2 + 7x - 88 at x=2, and centered difference is shown to have the lowest error. Question 3 gives the iterative steps to find the root of a function using the bisection method.

Uploaded by

greenfang999
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Assignment 03 APSC 256

The document contains the solutions to three questions regarding Taylor series approximations and numerical methods. For question 1, Taylor series approximations are calculated up to fourth order for the function f(x) = ln(x) at x=1, and the corresponding true and approximate errors are reported. For question 2, forward, backward and centered difference approximations are calculated for the derivative of f(x) = 25x^3 - 6x^2 + 7x - 88 at x=2, and centered difference is shown to have the lowest error. Question 3 gives the iterative steps to find the root of a function using the bisection method.

Uploaded by

greenfang999
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Animish Gupta APSC 256 52627577

Assignment 03

Q1) f(x) = ln(x) and true value: x = 1.5

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.

Taylor Series expansions until fourth order:

Zero-order approximation: T0​(x)=f(a)=0


First-order approximation: T1​(x)=P0​(x)+f’(a)(x−a)=0+1∗(1.5−1)=0.5
𝑓''(𝑎)(𝑥−𝑎)
Second-order approximation: T2​(x)=T1​(x)+ 2!
=0.5−(1.5−1)2/2=0.375
𝑓'''(𝑎)(𝑥−𝑎)
Third-order approximation: T3​(x)=T2​(x)+ 3!
=0.375+2∗(1.5−1)3/6=0.41667
𝑓''''(𝑎)(𝑥−𝑎)
Fourth-order approximation: T4​(x)=T3​(x)+ 4!
=0.41667−6∗(1.5−1)4/24=0.40104

Zeroth-order:

a = 1, f(xi) = f(a) = f(1) = ln(1) = 0

𝑙𝑛(1.5) − 𝑙𝑛(1)
εT = || 𝑙𝑛(1.5) || = 1

No εa as no previous value.

First-order:

𝑇𝑟𝑢𝑒 𝑉𝑎𝑙𝑢𝑒 − 𝐴𝑝𝑝𝑟𝑜𝑥 𝑉𝑎𝑙𝑢𝑒 | | 𝑙𝑛(1.5) − 0.5 |


εT: || 𝑇𝑟𝑢𝑒 𝑉𝑎𝑙𝑢𝑒 | | 𝑙𝑛(1.5) | = 0.234

𝑃𝑟𝑒𝑠𝑒𝑛𝑡 𝐴𝑝𝑝𝑟𝑜𝑥 − 𝑃𝑟𝑒𝑣𝑖𝑜𝑢𝑠 𝐴𝑝𝑝𝑟𝑜𝑥 | | 0.5 − 0 |


εa: || 𝑃𝑟𝑒𝑠𝑒𝑛𝑡 𝐴𝑝𝑝𝑟𝑜𝑥 | = | 0.5 | = 1

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

Q2) f(x) = 25x3 - 6x2 + 7x - 88, at x = 2 and h = 0.1

f’(x) = 75x2 - 12x + 7

f’(2) = 283 = True Value

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)

Iteration Approximate Root Approximate Relative Error

1 0.75 33.33

2 0.875 14.2857

3 0.9375 6.6666

4 0.9062 3.4483

You might also like