Solutions 8

You might also like

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

Indian Institute of Technology Kharagpur

Department of Mathematics
MA11004 - Linear Algebra, Numeircal and Complex Analysis
Problem Sheet - 8
Spring 2024

1. Given that f (1) = 2, f (2) = 4 , f (3) = 8 , f (4) = 16 , f (7) = 128. Find the value of f (5)
using the Lagrange’s interpolation formula.

Answer:

According to the question,


x0 = 1, x1 = 2, x2 = 3, x3 = 4, x4 = 7
f (x0 ) = 2, f (x1 ) = 4, f (x2 ) = 8, f (x3 ) = 16, f (x4 ) = 128.

Using Lagrange’s formula for x = 5, we get

(5 − 2)(5 − 3)(5 − 4)(5 − 7) (5 − 1)(5 − 3)(5 − 4)(5 − 7)


f (5) = ×2+ ×4
(1 − 2)(1 − 3)(1 − 4)(1 − 7) (2 − 1)(2 − 3)(2 − 4)(2 − 7)
(5 − 1)(5 − 2)(5 − 4)(5 − 7) (5 − 1)(5 − 2)(5 − 3)(5 − 7)
+ ×8+ × 16
(3 − 1)(3 − 2)(3 − 4)(3 − 7) (4 − 1)(4 − 2)(4 − 3)(4 − 7)
(5 − 1)(5 − 2)(5 − 3)(5 − 4)
+ × 128
(7 − 1)(7 − 2)(7 − 3)(7 − 4)
−2 32 128 128
= + − 24 + +
3 5 3 15
494
= = 32.93333
15

Hence f (5) = 32.9333

2. Using the Lagrange’s interpolation formula, express

3x2 + x + 1
x3 − 6x2 + 11x − 6
as the sum of partial fraction.

Answer:

We can write
3x2 + x + 1 3x2 + x + 1
=
x3 − 6x2 + 11x − 6 (x − 1)(x − 2)(x − 3)
f (x)
=
(x − 1)(x − 2)(x − 3)

1
where f (x) = 3x2 + x + 1.

Now, f (1) = 5, f (2) = 15, f (3) = 31.


Using Lagrange’s interpolation formula

(x − 2)(x − 3) (x − 1)(x − 3) (x − 1)(x − 2)


f (x) = ×5+ × 15 + × 31
(1 − 2)(1 − 3) (2 − 1)(2 − 3) (3 − 1)(3 − 2)
5 31
= (x − 2)(x − 3) − 15(x − 1)(x − 3) + (x − 1)(x − 2)
2 2

Therefore,

3x2 + x + 1 f (x)
=
x3 − 6x2 + 11x − 6 (x − 1)(x − 2)(x − 3)
5 1 15 31 1
= × − + × .
2 x−1 x−2 2 x−3

3. Using the Lagrange’s formula, prove that


1 1 1 1
y0 = (y1 + y−1 ) − [ (y3 − y1 ) − (y−1 − y−3 )].
2 8 2 2
Note: yi = y(xi ) = f (xi ).

Answer:

For the arguments -3, -1, 1, 3, Lagrange’s formula is

(x + 1)(x − 1)(x − 3) (x + 3)(x − 1)(x − 3)


yx = y−3 + y−1
(−3 + 1)(−3 − 1)(−3 − 3) (−1 + 3)(−1 − 1)(−1 − 3)
(x + 3)(x + 1)(x − 3) (x + 3)(x + 1)(x − 1)
+ y1 + y3
(1 + 3)(1 + 1)(1 − 3) (3 + 3)(3 + 1)(3 − 1)
(x + 1)(x − 1)(x − 3) (x + 1)(x − 1)(x − 3)
= y−3 + y−1
(−48) (16)
(x + 1)(x − 1)(x − 3) (x + 1)(x − 1)(x − 3)
+ y1 + y3
(−16) (48)

Given x = 0, we get
1 9 9 1
y0 = − y−3 + y−1 + y1 − y3
16 16  16 16 
1 1 1 1
= (y1 + y−1 ) − (y3 − y1 ) − (y−1 − y−3 ) .
2 8 2 2

4. Compute the value of following integral


Z 1.4
(sin x − ln x + ex )dx
0.2

2
using trapezoidal rule with 6 equal subintervals.

Answer:

Here n = 6.
b−a 1.4−0.2 1.2
nh = b − a =⇒ h = n = 6 = 6 = 0.2

x y
0.2 y0 = 3.0296
0.4 y1 = 2.7975
0.6 y2 = 2.8975
0.8 y3 = 3.1661
1.0 y4 = 3.5598
1.2 y5 = 4.0698
1.4 y6 = 4.7042

Then,
Z 1.4
I= (sin x − ln x + ex ) dx
0.2
h
= [(y0 + y6 ) + 2 (y1 + y2 + y3 + y4 + y5 )]
2
0.2
= [7.7338 + 2(16.4907)]
2
= 4.07152

5. A car laps a racetrack in 84 seconds. The speed of the car at each 6 seconds interval is
determined using a radar gun and is given from the beginning of the lap, in feet/second,
in the entries in the following table:

Time 0 6 12 18 24 30 36 42 48 54 60 66 72 78 84
Speed 124 134 148 156 147 133 121 109 99 85 78 89 104 116 123

How long is the track?


Note: use trapezoidal formula

Answer:

The estimated distance is Z 84


s(t) dt,
0
where s = speed and t = time.

84−0
We have 14 intervals, so h = 14 = 6.

3
Therefore,
Z 84
h
s(t) dt = [124 + 123 + 2(134 + 148 + 156 + 147 + 133 + 121 + 109 + 99 + 85 + 78
0 2
+ 89 + 104 + 116)]
= 9855 feet.

6. How big should the spacing h be so that the computation of


Z 1
ex dx
0

by trapezoidal rule will be correct to five decimal places.

Answer:

Divide the interval [0, 1] into n subintervals each of length h by the points x0 = 0, x1 , x2 , · · · , xn =
1.
Then xr − xr−1 = h.
∴ nh = 1 − 0 = 1 =⇒ h = n1 .

Here f (x) = ex .

Error, E = − (b−a) 2 ′′
12 h f (ξ), ξ ∈ (a, b)
For f (x) = ex , f ′′ (x) = ex .

Therefore,

(1 − 0) 2 ξ
E=− h e
12
h2 ξ
=− e .
12

Max error,
h2 1 h2
|Emax | = e = e.
12 12

4
The result that gives 5 decimal place accuracy is
1
× 10−5
|Emax | ≤
2
h2 1
=⇒ e ≤ × 10−5
12 2
6 × 10−5
=⇒ h2 ≤
e
60 × 10−6
=⇒ h2 ≤
r e
60
=⇒ h ≤ × 10−3 = 0.0047.
e

7. Let
y = ax2 + bx + c
be the equation of the parabola passing through the points (−h, y0 ), (0, y1 ), (h, y2 ). Find
the area underlying the parabola bounded by the x-axis and the two ordinates x = −h, x = h
using Simpson’s 1/3rd rule. What conclusion do you draw from the result.

Answer:

The parabola y = ax2 + bx + c passes the points (−h, y0 ), (0, y1 ), (h, y2 ).

Therefore,

y0 = ah2 + b(−h) + c = ah2 − bh + c


y1 = c
y2 = ah2 + bh + c.

By Simpson’s 1/3rd rule, the area between the curve y = ax2 + bx + c, the ordinates
x = −h, x = h and x−axis is
Z h
h
y dx = [y0 + 4y1 + y2 ]
−h 3
h 2
ah − bh + c + 4c + ah2 + bh + c

=
3 
ah2

= 2h +c .
3

5
Further,
Z h
Actual area = y dx
−h
Z h
= (ax2 + bx + c) dx
−h
Z h
=2 (ax2 + c) dx
0
h
ax3

= 2h + cx
3
 2 0
ah
= 2h +c .
3
which is same as obtained from Simpson’s 1/3rd rule.
Hence Simpson’s 1/3rd rule can be represented geometrically the area underlying the
parabola and the x−axis and the given ordinates.

8. Calculate the value of the integral


Z 5.2
ln x dx
4

using Simpson’s 1/3rd rule with 6 equal subdivisions of the interval.

Answer:

Here n = 6, a = 5.2, b = 4.
nh = b − a =⇒ h = b−a n =
5.2−4
6 = 1.2
6 = 0.2

x y
4.0 y0 = 1.3862944
4.2 y1 = 1.4350845
4.4 y2 = 1.4816045
4.6 y3 = 1.5260563
4.8 y4 = 1.5686159
5.0 y5 = 1.6049379
5.2 y6 = 1.6486586

Then,
Z 5.2
I= ln x dx
4
h
= [(y0 + y6 ) + 4 (y1 + y3 + y5 ) + 2 (y2 + y4 )]
3
0.2
= [3.034953 + 18.232315 + 6.1004408]
3
0.2
= [27.417709]
3
= 1.8278472

6
9. Determine the number of subintervals, n, required to approximate
Z 2
1
f (x) = dx,
0 x+4

with the total error |E| < 10−4 using

(a) Trapezoidal rule,


(b) Simpson’s 31 rd rule.

Answer:

(a) In case of Trapezoidal rule, we have

(b − a) 2
|E| ≤ h M, where b = 2, a = 0, & M = Max{|f ′′ (x)|} ∀ x ∈ [a, b].
12
According to question

(b − a) 2 1
h M ≤ 10−4 , where f (x) =
12 x+4
2
=⇒ f ′′ (x) = .
(x + 4)3

So the maximum value of |f ′′ (x)| on the interval [0, 2] is 1


32 , that is, M = 1
32 .

 
(2 − 0) 2 1
∴ h ≤ 10−4
12 32
1 2
=⇒ h ≤ 10−4
192
=⇒ h2 ≤ 192 × 10−4
=⇒ h ≤ 0.138564 (truncating after 6 decimal places)
b−a 2
Since, h = =⇒ h =
n n
2 2
∴ ≤ 0.138564 =⇒ n ≥
n 0.138564
∴ n ≥ 15

7
(b) In case of Simpson’s 1/3rd rule, we have
(b − a) 4
|E| ≤ h M, where M = Max{|f ′′′′ (x)|} ∀ x ∈ [a, b].
180
3 1
M= for given f (x) = .
 128  4
x +
24
∵ f ′′′′ (x) =
(x + 4)5
 
(2 − 0) 4 3
∴ by Question, h ≤ 10−4
180 128
10−4 × 180 × 128
=⇒ h4 ≤
3×2
2 1
=⇒ h ≤ × 15 4
5
b−a 2−0 2 1
∴h= = ≤ (15) 4
n n 5
2×5
∴n≥ 1 = 2.54066
2 × 15 4
∴ n ≥ 4 in case of Simpson’s 1/3rd rule.
R2 2
10. Evaluate the integral 0 x3x+1 dx using Simpson’s 1/3 rd rule (Taking h=0.25). Compare
the error with the exact value.

Answer:

Let us divide (0, 1) into 4 equal parts so that h = 0.25.


2
Taking y = x3x+1 ; we have,

x y
0 y0 = 0
0.25 y1 = 0.06513
0.50 y2 = 0.22222
0.75 y3 = 0.39560
1.00 y4 = 0.5

By Simpson’s 1/3rd rule we have,

1
x2
Z
h
dx = [(y0 + y4 ) + 2y2 + 4(y1 + y3 )]
0 x3 + 1 3
0.25
= [(0 + 0.5) + 2 × 0.22222 + 4 × (0.06153 + 0.3956)]
3
= 0.23108

Also,
Z 1
x2 1 1
3
dx = [log(x3 + 1)]10 = log2
0 x +1 3 3
= 0.23108

8
Thus the error is 0.23105 − 023108 = −0.00003.

**********

You might also like