0% found this document useful (0 votes)
21 views6 pages

Quiz2 Solution

Uploaded by

tamimahmed854
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views6 pages

Quiz2 Solution

Uploaded by

tamimahmed854
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

B.Sc. Engg.

SWE 5th Semester 21 September 2023 (Afternoon)

ISLAMIC UNIVERSITY OF TECHNOLOGY (IUT)


ORGANISATION OF ISLAMIC COOPERATION (OIC)
Department of Computer Science and Engineering (CSE)
QUIZ-2 WINTER SEMESTER, 2022-2023
DURATION: 35 MINUTES FULL MARKS: 15
Math 4543: Numerical Methods
Programmable calculators are not allowed. Write your Student ID at the top of your extra pages (if any).
Answer all 4 (four) questions. Figures in the right margin indicate full marks of questions whereas
corresponding CO and PO are written within parentheses.

STUDENT ID:
1. The Taylor series for a function f (x) is — 6
h h2 h3 h4 h5 (CO1)
f (x + h) = f (x) + f 0 (x) + f 00 (x) + f 000 (x) + f 0000 (x) + f 00000 (x) + . . . (PO2)
1! 2! 3! 4! 5!
Using the Taylor series (with at least the first 4 terms), derive the Maclaurin series of —
(i) ln(1 + x)
(ii) ln(1 − x)
 
1+x
Then use these two series to determine the Maclaurin series of ln .
1−x

Solution:
The Maclaurin series of a transcendental function is simply a Taylor series around the point
x = 0.
d 1 d n
We know, (ln(x)) = , and (x ) = nxn−1 .
dx x dx

(i) Now, for f (x) = ln(1 + x), let’s calculate the derivatives at the point x = 0.
1 1
f (x) = ln(1 + x), f (0) = ln(1 + 0) = ln(1) = 0; f 0 (x) = , f 0 (0) = = 1;
1+x 1+0
1 1 2 2
f 00 (x) = − 2
, f 00 (0) = − 2
= −1; f 000 (x) = 3
, f 000 (0) = = 2;
(1 + x) (1 + 0) (1 + x) (1 + 0)3
Using the first 4 terms of the Taylor series,
h h2 h3
f (x + h) = f (x) + f 0 (x) + f 00 (x) + f 000 (x) + . . .
1! 2! 3!
For x = 0,
h h2 h3
f (0 + h) = f (0) + f 0 (0) + f 00 (0) + f 000 (0) + . . .
1! 2! 3!
h2 2h3
⇒ f (h) = 0 + h − + + ...
2! 3!
x2 2x3
⇒ f (x) = 0 + x − + + ...
2! 3!
x2 2x3
⇒ ln(1 + x) = 0 + x − + + ...
2! 3!
x2 2x3
⇒ ln(1 + x) = x − + + ...
2! 3!

Math 4543 Page 1 of 6


(ii) Short version: Here,
f (x) = ln(1 − x)
= ln(1 + (−x))
(−x)2 2(−x)3
= (−x) − + + ... [using the Maclaurin series of ln(1 + x) from (i)]
2! 3!
x2 2x3
= −x − − + ...
2! 3!
Long version: Now, for f (x) = ln(1 − x), let’s calculate the derivatives at the point x = 0.
1 1
f (x) = ln(1 − x), f (0) = ln(1 − 0) = ln(1) = 0; f 0 (x) = − , f 0 (0) = − = −1;
1−x 1−0
1 1
f 00 (x) = − 2
, f 00 (0) = − = −1;
(1 − x) (1 − 0)2
2 2
f 000 (x) = − 3
, f 000 (0) = − = −2;
(1 − x) (1 − 0)3
Using the first 4 terms of the Taylor series,
h h2 h3
f (x + h) = f (x) + f 0 (x) + f 00 (x) + f 000 (x) + . . .
1! 2! 3!
For x = 0,
h h2 h3
f (0 + h) = f (0) + f 0 (0) + f 00 (0) + f 000 (0) + . . .
1! 2! 3!
h2 2h3
⇒ f (h) = 0 − h − − + ...
2! 3!
x2 2x3
⇒ f (x) = 0 − x − − + ...
2! 3!
x2 2x3
⇒ ln(1 − x) = 0 − x − − + ...
2! 3!
x2 2x3
⇒ ln(1 − x) = −x − − + ...
2! 3!

a
We know, ln = ln(a) − ln(b).
b
So,
 
1+x
ln = ln(1 + x) − ln(1 − x)
1−x
x2 2x3 x2 2x3
   
= x− + + . . . − −x − − + ...
2! 3! 2! 3!
4x3
= 2x + + ...
3!
Rubric:

• 2.5 points for the correct series of ln(1 + x).

• 2.5 points for the correct series of ln(1 − x).


 
1+x
• 1 point for the correct series of ln .
1−x

Math 4543 Page 2 of 6


2. Compare and contrast the following interpolation methods— Direct method, Newton’s Divided 2
Difference method, and Lagrangian method. (CO3)
(PO2, PO4)

Solution:
Any 2 valid comparisons will suffice. Some comparisons can be—

Criteria Direct Newton’s Divided Difference Lagrangian


Interpolant  fn (x) = 
fn (x) = a0 + a1 x + fn (x) = b0 + b1 (x − x0 ) + · · · +
Polynomial n n
a2 x2 + · · · + an xn bn (x−x0 )(x−x1 ) . . . (x−xn−1 ) X Y x − xj 
Representation  f (xi )
i=0
x i − xj
j=0,j6=i
Depends on the algorithm
used to solve the The naïve implementation
Using memoized dynamic
Computational equations. It may be is O(n2 ), but it can
programming, we get a
Complexity O(n3 ), optimized further down to
complexity of O(n2 ).
O(n log(kAk + kbk)), or
3
O(n log2 (n)).
O((n + 1)!).
The polynomial is a
Each term has a weighted sum of the given
Each term has a coefficient bi
coefficient ai and these functional values f (xi ),
Property of the and each of these coefficients
coefficients are obtained and each term is a product
terms can be obtained by solving one
by solving all the of the Lagrangian weight
equation.
equations simultaneously. function Li (x) and the
functional value f (xi ).
Vulnerable to
the Runge Yes Yes Yes
Phenomenon?

Rubric:

• 1 point for each valid comparison.

Math 4543 Page 3 of 6


3. The specific heat capacity C of a substance is defined as the amount of heat that is required to raise 4
the temperature of unit mass of that particular substance by 1 degree. Suppose, you are conducting (CO2)
an experiment to determine how much heat is required to bring some volume of water to its boiling (PO3)
point. The values of specific heat capacity C of water that you have calculated at different temper-
ature values T are shown in the table below —

Temperature, T Specific Heat, C


(°C) (Jkg −1 °C −1 )
22 4181
42 4179
52 4186
82 4199
100 4217

Table 1: Specific heat C of water as a function of temperature T .

Determine the value of the specific heat at T = 61°C using the Direct method of interpolation and
a second order polynomial.

Solution:
For second order polynomial interpolation (also called quadratic interpolation), the equation for
the specific heat would be —
C(T ) = a0 + a1 T + a2 T 2
Here, the order n = 2. Now, let’s choose the nearest n + 1 = 2 + 1 = 3 points that bracket the
point T = 61°C and evaluate the polynomial. The 3 points are T0 = 42, T1 = 52, and T2 = 82.
The respective specific heat values are C(T0 ) = 4179, C(T1 ) = 4186, and C(T2 ) = 4199. Using
these values, we obtain the following equations —
C(42) = a0 + a1 × 42 + a2 × (42)2 = 4179
C(52) = a0 + a1 × 52 + a2 × (52)2 = 4186
C(82) = a0 + a1 × 82 + a2 × (82)2 = 4199
Writing these equations in matrix form, we have —
         −1  
1 42 1764 a0 4179 a0 1 42 1764 4179
1 52 2704 · a1  = 4186 ⇒ a1  = 1 52 2704 · 4186
1 82 6724 a2 4199 a2 1 82 6724 4199
 
533 287 91
   50 −
a0  25 50  
 4179

 67 31 47  

⇒ a1  =  − 200 −  · 4186

a2  75 600  4199
 1 1 1 

400 300 1200
   
a0 4135
⇒ a1  =  1.3267 
a2 −6.6667 × 10−3

Hence,
C(T ) = 4135 + 1.3267T − 6.6667 × 10−3 T 2 ; 42 ≤ T ≤ 82

Math 4543 Page 4 of 6


At the point T = 61, we get,
C(61) = 4135 + 1.3267 × 61 − 6.6667 × 10−3 × (61)2 = 4191.2Jkg −1 °C −1
Rubric:

• 1 point for the correct polynomial representation.

• 1 point for choosing the correct nearest points.

• 1 point for the correct coefficient values.

• 1 point for the correct answer.

Math 4543 Page 5 of 6


4. Prove that a polynomial of degree n or less that passes through n + 1 data points is unique. 3
(CO1)
(PO2)
Solution:

Proof: Let us use proof by contradiction. If the polynomial is not unique, then at least two
polynomials of order n or less pass through the n + 1 data points.
Assume two polynomials Pn (x) and Qn (x) go through n + 1 data points (x0 , y0 ), (x1 , y1 ), . . . ,
(xn , yn ). Then,
Rn (x) = Pn (x) − Qn (x)
Since Pn (x) and Qn (x) pass through all the n + 1 data points, we can say,
Pn (xi ) = Qn (xi ) ∀i ∈ {0, . . . , n}
Hence
Rn (xi ) = Pn (xi ) − Qn (xi ) ∀i ∈ {0, . . . , n}
⇒Rn (xi ) = 0
The nth order polynomial Rn (x) has n + 1 zeros. A polynomial of order n can have n + 1 zeros
only if it is identical to a zero polynomial, that is,
Rn (x) ≡ 0
⇒Pn (x) ≡ Qn (x)
So, Pn (x) and Qn (x) must be the same unique polynomial, which contradicts our initial assump-
tion.  Q.E.D.
Rubric:

• 1 point for correctly defining Pn (x), Qn (x), and Rn (x).

• 1 point for showing Rn (x) is a zero polynomial.

• 1 point for the final conclusion.

Math 4543 Page 6 of 6

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy