Quiz 01 - Questions & Solutions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

ERRORS & TAYLOR SERIES.

Quiz #1
Student Name: Student ID:

1.
(a) Evaluate the polynomial
y = x3 − 7x2 + 8x − 0.35
at x=1.37. Use 3-digit arithmetic with chopping. Evaluate the percent relative
error.
(b) Repeat (a) but express y as
y = ((x − 7)x + 8)x − 0.35
Evaluate the error and compare with part (a).

a) True value:
𝑦 = 𝑥 3 − 7𝑥 2 + 8𝑥 − 0.35 = 1.373 − 7(1.37)2 + 8(1.37) − 0.35 = 0.043053
Value chopped to 3 significant figures: 0.0430
True error: 𝐸𝑡 = 0.043053 − 0.0430 = 0.000053
0.000053
Percent relative true error: 𝜀𝑡 = 0.043053 . 100% ≃ 0.123%
b) True value:
𝑦 = ((𝑥 − 7)𝑥 + 8)𝑥 − 0.35 = ((1.37 − 7)1.37 + 8)1.37 − 0.35 = 0.043053
Value chopped to 3 significant figures: 0.0430
True error: 𝐸𝑡 = 0.043053 − 0.0430 = 0.000053
0.000053
Percent relative true error: 𝜀𝑡 = . 100% ≈ 0.123%
0.043053
 Two expressions of y produces the same results.

HVUS 1
2. Use of Taylor series expansions to approximate the following functions with
x0=0
(a) 𝑓(𝑥) = √𝑥 2 + 1 − 𝑥

We have:
𝑓(x0 ) = 1
𝑥
𝑓 ′ (𝑥) = − 1 ⇒ 𝑓 ′ (x0 ) = −1
√𝑥 2 + 1
1
𝑓 ′′ (𝑥) = 2 ⇒ 𝑓 ′′ (x0 ) = 1
(𝑥 + 1)3/2
−3𝑥
𝑓 (3) (𝑥) = 2 ⇒ 𝑓 (3) (x0 ) = 0
(𝑥 + 1)5/2
(4) 3(4𝑥 2 − 1)
𝑓 (𝑥) = 2
(𝑥 + 1)7/2

Apply Taylor series expansion with 𝑛 = 3 and 𝑥0 = 0:


𝑓 ′′ (𝑥0 ) 𝑓 (3) (𝑥0 ) 𝑓 (4) (𝜉)
𝑓(𝑥) = 𝑓(𝑥0 ) + 𝑓 ′ (𝑥0 )(𝑥 − 𝑥0 ) + (𝑥 − 𝑥0 )2 + (𝑥 − 𝑥0 )3 + (𝑥 − 𝑥0 )4
2! 3! 4!
𝑥2 (4𝜉 2 − 1) 4
=1−𝑥+ + 𝑥
2 8(𝜉 2 + 1)7/2

sin 𝑥
(b) 𝑓(𝑥) = 1+cos 𝑥
We have:
𝑓(x0 ) = 0
1 1
𝑓 ′ (𝑥) = ⇒ 𝑓 ′ (x0 ) =
1 + cos 𝑥 2
sin 𝑥
𝑓 ′′ (𝑥) = ⇒ 𝑓 ′′ (x0 ) = 0
(1 + cos 𝑥)2
2 − cos 𝑥 1
𝑓 (3) (𝑥) = 2
⇒ 𝑓 (3) (x0 ) =
(1 + cos 𝑥) 4
sin 𝑥(5 − cos 𝑥)
𝑓 (4) (𝑥) =
(1 + cos 𝑥)3

Apply Taylor series expansion with 𝑛 = 3 and 𝑥0 = 0:


𝑓 ′′ (𝑥0 ) 𝑓 (3) (𝑥0 ) 𝑓 (4) (𝜉)
𝑓(𝑥) = 𝑓(𝑥0 ) + 𝑓 ′ (𝑥0 )(𝑥 − 𝑥0 ) + (𝑥 − 𝑥0 )2 + (𝑥 − 𝑥0 )3 + (𝑥 − 𝑥0 )4
2! 3! 4!
𝑥 𝑥 3 sin 𝜉(5 − cos 𝜉) 4
= + + 𝑥
2 24 (1 + cos 𝜉)3

HVUS 2
3. The following infinite series can be used to approximate ex :
𝑥2 𝑥3 𝑥𝑛
𝑒𝑥 = 1 + 𝑥 + + + ⋯ +
2 3! 𝑛!
(a) Prove that this Maclaurin series expansion is a special case of the
Taylor series expansion with xi = 0 and h = x.
(b) Use the Taylor series to estimate f (x) = e−x at xi+1=1 for xi=0.2. Employ the
zero-, first-, second-, and third-order versions and compute the |εt| for each
case.

a) We have 𝑓 (𝑘) (𝑥) = 𝑒 𝑥 ∀𝑘 ∈ ℕ∗ ⇒ 𝑓 (𝑘) (𝑥𝑖 ) = 𝑓 (𝑘) (0) = 1 ∀𝑘 ∈ ℕ∗

Apply Taylor series expansion at 𝑥𝑖 = 0 and ℎ = 𝑥 of 𝑓(𝑥) = 𝑒 𝑥 :

𝑓 ′′ (𝑥𝑖 ) 2 𝑓 (3) (𝑥𝑖 ) 3 𝑓 (𝑛) (𝑥𝑖 ) 𝑛


𝑓(𝑥𝑖+1 ) = 𝑓(𝑥𝑖 ) + 𝑓 ′ (𝑥𝑖 )ℎ + ℎ + ℎ + ⋯+ ℎ
2! 3! 𝑛!
𝑥2 𝑥3 𝑥𝑛
𝑓(𝑥𝑖+1 ) = 1 + 𝑥 + + + ⋯ +
2 3! 𝑛!

Hence, it is proven that Maclaurin series expansion is a special case of the


Taylor series expansion.

b) For 𝑓(𝑥) = 𝑒 −𝑥 , we have:

𝑓 ′ (𝑥) = −𝑒 −𝑥
𝑓 ′′ (𝑥) = 𝑒 −𝑥
𝑓 (3) (𝑥) = −𝑒 −𝑥

Also, we have ℎ = 𝑥𝑖+1 − 𝑥𝑖 = 1 − 0.2 = 0.8

True value: 𝑓(𝑥𝑖+1 ) = 𝑓(1) = 𝑒 −1 ≈ 0.3679

Apply Taylor series expansion at 𝑥𝑖 = 0.2 and ℎ = 0.8:

Zero-order approximation:

𝑓(𝑥𝑖+1 ) ≈ 𝑓(𝑥𝑖 ) = 𝑒 −0.2 ≈ 0.8187


0.3679 − 0.8187
|𝜀𝑡 | = | | . 100% ≈ 122.53%
0.3679

First-order approximation:

𝑓(𝑥𝑖+1 ) ≈ 𝑓(𝑥𝑖 ) + 𝑓 ′ (𝑥𝑖 )ℎ = 𝑒 −0.2 − 𝑒 −0.2 (0.8) ≈ 0.1637


0.3679 − 0.1637
|𝜀𝑡 | = | | . 100% ≈ 55.50%
0.3679

Second-order approximation:

𝑓 ′′ (𝑥𝑖 ) 2 𝑒 −0.2
𝑓(𝑥𝑖+1 ) ≈ 𝑓(𝑥𝑖 ) + 𝑓 ′ (𝑥𝑖 )ℎ + ℎ = 𝑒 −0.2 − 𝑒 −0.2 (0.8) + 0.82 ≈ 0.4257
2! 2
0.3679 − 0.4257
|𝜀𝑡 | = | | . 100% ≈ 15.71%
0.3679

Third-order approximation:

HVUS 3
𝑓 ′′ (𝑥𝑖 ) 2 𝑓 (3) (𝑥𝑖 ) 3
𝑓(𝑥𝑖+1 ) ≈ 𝑓(𝑥𝑖 ) + 𝑓 ′ (𝑥𝑖 )ℎ + ℎ + ℎ
2! 3!
𝑒 −0.2 𝑒 −0.2
= 𝑒 −0.2 − 𝑒 −0.2 (0.8) + 0.82 − 0.83 ≈ 0.3559
2 6
0.3679 − 0.3559
|𝜀𝑡 | = | | . 100% ≈ 3.26%
0.3679

HVUS 4

You might also like