Sei sulla pagina 1di 46

Subject: Numerical Computing

Code: C-09/T-09 (June 2003)


1. (a) Let x = N or x 2 = N.
We take f ( x ) = x 2 N , f ( x ) = 2 x. Newton-Raphson method becomes
f (xn )
x n2 N x n2 + N
1
N
x n +1 = x n
= xn
=
= xn +
f ( x n )
2 xn
2 xn
2
xn
(b) f [x 0 , x1 ] = [ f ( x1 ) f ( x0 )] / (x1 x0 ) = f 0 / h
f [x1 , x 2 ] = [ f ( x 2 ) f ( x1 )] / ( x 2 x1 ) = f 1 / h
f [x 0 , x1 , x 2 ] = [ f [ x1 , x 2 ] f [ x 0 , x1 ]] /( x 2 x0 )
= [f1 f 0 ] /(2h 2 ) = 2 f 0 /(2h 2 )

Answer: A

Answer: C

(c) Iteration matrix associated with the Gauss-Jacobi iteration method is

H = - D-1 (L + U). From the given matrix A, we get


0 0
4 0
- 4
1
H=
=

1 2
0 - 2
0
0
Eigen values of H are 2 2 .
Since the spectral radius of H is 2 2 >1, the method diverges.

Answer: D

(d) We first construct the forward difference table from the given data. We have
x
f(x)
f
2 f
3 f
1
-1
2
-1
0
3
1
2
2
4
5
4
2
0
Using Newton forward difference interpolation and the given data, we get for h = 1
(x 1)(x 2) (2) = x2 3x + 1
p ( x) = 1 + ( x 1)(0) +
Answer: B
2

(e) For the Simpsons rule

x2
x0

f ( x)dx = h[ f ( x 0 ) + 4 f ( x1 ) + f ( x 2 )] / 3

we obtain h = 1/2, x0 = 0, x2 = 1, x1 = 1/2 ,


I = [1 + 4 (4/5) + 1/2]/6 = 47/60

f0 = 1, f1 = 4/5, f2 = 1/2

Answer: D

(f) We need the approximation f(x) = ax + b, where a and b are to be determined so that
4

I (a, b) = [ f ( xi ) axi b ] = minimum. We obtain the normal equations


2

i =1

4
I
= 2 ( f ( xi ) axi b )xi = 0
a
i =1

or

x f (x ) a x

4
I
= 2 ( f ( xi ) axi b ) = 0
b
i =1

or

f (x ) a x

We have

= 10, f ( xi ) = 8,

2
i

= 30,

2
i

b xi = 0

4b = 0

x f (x ) = 30
i

Substituting in the normal equations, we get


30a + 10b = 30, 10a + 4b = 8

Answer : A

Solving, we get a = 2, b = -3

(g) The truncation error associated with the given method is given by

TE = f ( x ) [ f ( x + h ) + af ( x) f ( x h)] /(2h)

= f ( x ) af ( x ) + 2hf ( x ) + h 3 f ( x ) / 3 + ............. /(2h)


= af ( x) 2 h h 2 f ( x ) / 6 + .........
The method will be of the highest order, if the coefficient of f(x) is zero.
We get a = 0.
Answer: B
(h) Make the method exact for f(x) = 1 and x. We get

f (x ) = 1 :
f (x ) = x :

dx = 1 / 2 + 3 / 2

2 = 2 which is true

x dx = 1 / 2 + 3a / 2

0 = 1 2 (3 a 1)

1
1

a = 1/ 3 .
Answer: C

2. (a) We have f ( x ) = x 2 2 x 3 cos x. We find that f(-2) = 9.2484, f (-1) = 1.3791,


f(0) = - 3 , f(1) = -2.6209, f(2) = 1.2484.
Hence, the smallest root in magnitude lies in the interval (- 1, 0).

x x n 1
Using the secant method x n +1 = x n n
f n , n = 1,2,........ , we get for
f n f n 1
x0 = 1, x1 = 0,

f 0 = f ( x0 ) = 1.3791, f1 = f ( x1 ) = 3

x x0
n = 1 : x 2 = x1 1
f 1 = 0.6851, f 2 = f ( x 2 ) = 0.4836
f

f
0
1
x x1
n = 2 : x3 = x 2 2
f 2 = 0.8167, f 3 = f ( x3 ) = 0.2468
f 2 f1
x x2
n = 3 : x 4 = x3 3
f 3 = 0.7723, f 4 = f ( x 4 ) = 0.0081
f3 f 2

x x3
n = 4 : x5 = x 4 4
f 4 = 0.7737, f 5 = f ( x5 ) = 0.0001
f4 f3
x x4
n = 5 : x6 = x5 5
f 5 = 0.7737 , which is correct to three decimal places.
f5 f4
(b) We have x = N . Take f(x) = x4 N = 0. Let be the exact root. Therefore, 4 = N.
Substituting x n +1 = + n +1 , x n = + n , N = 4 in the given formula, we get

+ n +1 = a( + n ) + b 4 / ( + n )3 + c 8 / ( + n )7
= a( + n ) + b [1+ n / ] + c [1+ n / ]
3

Expanding in binomial series and simplifying, we get


n +1 = (1 + a + b + c) + (a 3b 7c) n + (6b + 28c) n2 / (10b + 84c) 3n / 2 + ....
For the method to be of highest order, we have
a + b + c = 1, a 3b 7c = 0, 6b + 28c = 0
Solving these equations, we get a = 21/32, b = 14/32, c = -3/32 and

( )

( )

n +1 = (10b + 84c) 3n / 2 + O 4n = 7 3n /(2 2 ) + O 4n


Hence, the method is of third order.

3. (a) We have f ( x, y ) = x 2 + 3 y 2 + 2 xy 2.51, g ( x, y ) = 2 x 2 + y 2 5 xy 12.83 .


We obtain the Jacobian matrix

f / x
J n =
g / x
J n1 =

f / y
2 x + 2 y n
= n
g / y n 4 x n 5 y n

1 2 y n 5 x n

D ( 4 x n 5 y n )

6 yn + 2 xn
and
2 y n 5 x n

( 6 y n + 2 x n )
2 x n + 2 y n

D = (2 x n + 2 y n )(2 y n 5 x n ) (6 y n + 2 x n )(4 x n 5 y n )

x n +1 x n
f ( x n , y n )

= J n1
, n = 0,1,....... , we get
y n +1 y n
g (xn , y n )
y 0 = 1, f 0 = 0.26, g 0 = 0.17, D = 23.5

Using Newtons method


n = 0:

x0 = 1.5,

x1 1.5
1 9.5 3 0.26 1.3732
=

y1 1 23.5 - 11 1 0.17 1.1289


(b) We write the given coefficient matrix A as

A = LLT where

l11
L = l 21
l31

0
l 22
l 32

0
0 .
l 33

We obtain

4
0

1 l11
3 = l 21
37/2 l31

0
4
3

l112

= l11l 21
l l
11 31

0 l11
0 0
l 33 0

0
l 22
l 32

l 21
l 22
0

l 31
l 32
l 33

l 21l 31 + l 22 l 32
l312 + l322 + l 332

l11l 21

l11l 31

l 212 + l 222
l 31l 21 + l32 l 22

Comparing element by element, we get,


First row: l112 = 4 l11 = 2 ,
l11l 21 = 0 l 21 = 0, l11l 31 = 1 l31 = 1/2
Second row:

2
2
l 21
+ l 22
= 4 l 222 = 4 l 22 = 2 ,
l 21l 31 + l 22 l 32 = 3 l32 = 3/2

Third row:

l 312 + l 322 + l 332 = 37 / 2 l 332 = 16 l 33 = 4


2
L = 0
1/2

Hence, we obtain

0
0
4

0
2
3/2

Write the given system of equations A x = b as L L T x = b


or

LT x = z,

Lz=b

2
0

1/2

From L z = b, that is

0
2
3/2

0 z1 5
0 z 2 = 13
4 z 3 59

we obtain using forward substitution z1 = 5 / 2,

0
2

From L x = z, that is
2
0
0
0
we obtain using back substitution x3 = 3,
T

z 2 = 13 / 2,

1/2 x1 5 / 2
3/2 x 2 = 13 / 2
4 x3 12
x 2 = 1, x1 = 1 / 2

4. (a) We obtain from the augmented matrix


1
-3
2
3
4
[A b] =
2
6
8
-1 R1 R3 2
4
-3
1
4.25
1

4
0
0

-3
15/2
-9/4

1
15/2
7/4

17/4
-25/8
31/16

z 3 = 12

-3
6
-3

1
8
2

4.25
-1
R2 R1/2
3
R3 R1/4

R3 + 3R2/10

4
-3
1
17/4

0
15/2 15/2 -25/8
0
0
4
1
Using back substitution, we get x3 = 1 / 4, x 2 = 2 / 3, x1 = 1 / 2
(b) We obtain from the augmented matrix
[ A I] =

2
1
2

1
2
4

2
-1
3

1
0
0

0
1
0

0
0
1

R2 R1/2
R3 R1

2
0
0

1
3/2
3

2
-2
1

1
-1/2
-1

0
1
0

0
0
1

R1 2R2/3
R3 2R2

2
0
0

0
3/2
0

10/3
-2
5

4/3
-1/2
0

-2/3
1
-2

0
0
1

R1 2R3/3
R2 + 2R3/5

2
0
0

0
3/2
0

0
0
5

4/3
-1/2
0

2/3
1/5
-2

-2/3
2/5
1

R1/2, 2R2/3, R3/5

1
0
0

0
1
0

0
0
1

2/3
-1/3
0

1/3
2/15
-2/5

-1/3
4/15
1/5

2/3

1/3

-1/3

Hence, A-1 =

-1/3

2/15

4/15

-2/5

1/5

1
=
15

10

-5

-5

-6

5. (a) From the given system of equations, we obtain

[
)
= [5.5 3 x

x1(k +1) = 4 + 2 x 2( k ) x3( k ) / 4 ,


x3(k +1

( k +1)
1

We have x1( 0) = 0.6,


k = 0:

x 2(k +1) = 0.75 x1( k +1) x3( k ) / 2

+ 3 x 2( k +1) / 5, k = 0,1,..........

x 2( 0) = 0.2,

x3( 0) = 0.5 . From the above equations, we obtain

x1(1) = (4 0.4 0.5) / 4 = 0.775, x 2(1) = (0.75 0.775 0.5) / 2 = 0.2625,

x3(1) = [5.5 3(0.775) + 3( 0.2625)] / 5 = 0.4775

x1( 2 ) = [4 + 2(0.2625) (0.4775)] / 4 = 0.749375,

k = 1:

x 2( 2) = [0.75 (0.749375) 0.4775] / 2 = 0.238438,


x3( 2) = [5.5 3(0.749375) + 3(0.238438)] / 5 = 0.507313
x1(3) = [4 + 2(0.238438) (0.507312)] / 4 = 0.753953,

k = 2:

x 2(3) = [0.75 (0.753953) 0.507312] / 2 = 0.255633,


x3(3) = [5.5 3(0.753953) + 3(0.255632)] / 5 = 0.494248
x1( 4) = [4 + 2(0.255632) (0.494249)] / 4 = 0.748621,

k = 3:

x 2( 4) = [0.75 (0.748622) 0.494249] / 2 = 0.246435,


x3( 4) = [5.5 3(0.748622) + 3(0.246436)] / 5 = 0.502966
After four iterations, we obtain the solution
x1 = 0.748621, x 2 = 0.246435,

x3 = 0.502966

The iteration matrix associated with the Gauss-Seidal method is given by


H = - (D + L)-1 U . We have
4
1
3

D+L=

1/4 0
-1/8 1/2
-9/40 3/10

-1

(D + L) =

H= -

0
2
-3

1/4
0
-1/8 1/2
-9/40 3/10

0
0
1/5

0
0
5
0
0
1/5
0
0
0

U=

0
0
0

-2
0
0

1
1
0

0
0
0

1/2
-1/4
-1/4 -3/8
-9/20 -3/40

. We obtain

-2
0
0

1
1
0

Characteristics equation of the matrix H is given by

H I = 0
0

1/2

1/4

(1/4)
9 / 20

3/8
= 0 = (402 + 13 6)
(3/40) -

The eigen values of H are 0, 0.2575, 0.5825


Since spectral radius is (H ) = 0.5825 < 1, the method converges.
Rate of convergence = v = log10 ( (H )) = 0.2347
(Note that rate of convergence can also be written as v = ln( (H )) = 0.5404)

(b) The largest off diagonal element in magnitude in A is a13 = 2. We obtain


tan 2 = 2a13 /(a11 a 33 ) = = / 4

cos
Define S1 = 0
sin
1 / 2

A 1 = S AS1 = 0
1 / 2

1
0
0

T
1

1 / 2

0
1 / 2

1
0

1/

1/

sin 1 / 2
0
- 1/ 2

0 = 0
1
0 and
cos 1/ 2
0
1/ 2
2
2 1 / 2
1 / 2 2
0
1/ 2

0
4
2 0
1
0
2

1 / 2 2
2
2 1 / 2
0
1 / 2
2 2 2
2
0 4
2
0


4
0 = 2
4
0
2
0
0
2 2 2
2
0 0

Now the largest off-diagonal element in magnitude in A1 is a12 = 2. We obtain

tan 2 = 2a12 /(a11 a 22 ) = = / 4


cos
Define S2 = sin
0

0 1 / 2

0 = 1/ 2
1 0

sin

cos
0

1 / 2
1/

A 2 = S T2 A 1S 2 = 1 / 2 1 /
0
0

1 / 2
1/ 2
0 3

= 1 / 2 1 / 2
0 3
0
0
1 0

2
2

0 4

0 2
1 0

2
0

0 and
1

1/ 2

1/ 2
0
0 1 / 2

0 1 / 2
0 0

2
4
0

0 6

0 = 0
0 0

0
2
0

1/ 2
0
0
1

1/ 2

0
0
0

Hence, the eigen values of A are 6, 2 and 0.


6. (a) We have
4
A=

and

1
A-1 =
40

11

-4

-4

16

-4

-4

11

V0 = [0.4, - 0.9, 0.4]T

We have Yk +1 = A 1Vk , and

Vk +1 = Yk +1 / mk +1 ,

( mk +1 is largest element in magnitude in Yk +1 )

We obtain
1
40

k = 0 : Y1 =

11

-4

0.4

0.21

-4

16

-4

-0.9

-4

11

0.4

-0.44
0.21

m1 = 0.44 and V1 = Y1/m1 = [0.4773, - 1, 0.4773]T

1
k = 1 : Y2 =
40

11

-4

0.4773

-4

16

-4

-1

-4

11

0.4773

0.2432
=

-0.4955
0.2432

m2 = 0.4955 and V2 = Y2/m2 = [0.4908, - 1, 0.4908]T

k = 2 : Y3 =

1
40

11

-4

0.4908

-4

16

-4

-1

-4

11

0.4908

0.2472
=

-0.4982
0.2472

After three iterations, we obtain the ratios as

= (Y3 )r / (V2 )r = [0.5037, 0.4982, 0.5037]


Therefore, 0.5

and = 1/ = 2

Hence, the smallest eigen value in magnitude of A is 2.


(b) From the given matrix, we obtain tan 2 = a13 / a12 = 1 = / 4

1
Define S1 = 0
0
1

A 1 = S AS1 = 0
0

T
1

0
0

= 4 2
0

0
cos
sin
0
1/ 2
1/ 2

1/ 2
4 2
1

1/ 2 and
1/ 2

1/ 2
1/ 2

1
4

1/ 2 4
1

1/ 2 4 2

4 1

2 0
1 0

8/ 2
1

1/ 2 4
1/ 2

1/ 2 4
1/ 2
0 b1
c1

0 = c1
b2

3 0
c2

1/ 2

sin = 0
cos 0
0

0
1/ 2
1/ 2

1/ 2
1/ 2
0

3/ 2

3/ 2
0

0
c 2
b3

This is the required tri-diagonal form. We obtain the sturm sequence as

f 1 = b1 = 1

f0 = 1,

f 2 = ( b2 ) f1 c12 f 0 = ( + 1)( 1) 32 = 2 33 ,
f 3 = ( b3 ) f 2 c 22 f 1 = ( 3)(2 33)
Eigen values are the roots of f3 = 0. Hence, the eigen values are = 3, 33.
Therefore, the smallest eigen value in magnitude is = 3 .
7. (a) The maximum error in linear interpolation is given by h 2 M 2 / 8, where
3
M 2 = max f ( x ) = max 20(1 + x ) = 540

1 x 2

We choose h such that h 2 (540 / 8) < 5 10 4 . We get h < 0.00272


Hence, the largest step size that can be used is h 0.0027.
(b) Let the polynomial be

f ( x ) = a 0 x 3 + a1 x 2 + a 2 x + a 3

From f(0) = 1, we get a3 = 1; f(1) = 5, we get a0 + a1 + a2 + a3 = 5


f (0) = 2, we get a2 = 2; f (1) = 4, we get 3a 0 + 2a1 + a 2 = 4
Solving the above equations, we get a0 = - 2, a1 = 4, a2 = 2, a3 = 1
and the polynomial is
f ( x ) = 2 x 3 + 4 x 2 + 2 x + 1
1
8. (a) We have f [x 0 , x1 ] =
[ f (x1 ) f (x0 )] = 1 [u (x1 )v(x1 ) u (x0 )v(x0 )]
x1 x0
x1 x0
=

1
[v(x1 ){u (x1 ) u (x0 )} + u (x0 ){v(x1 ) v(x0 )}]
x1 x0

u (x ) u (x0 )
v( x1 ) v(x 0 )
= v( x1 ) 1
+ u ( x0 )

x1 x0
x1 x0
= v( x1 )u [x0 , x1 ] + u ( x0 )v[x0 , x1 ].
(b) We have = E 1 and = 1 E-1. We get
L.H.S. = + = E 1 + 1 E-1 = E E-1

E 1 1 E 1 E (1 E 1 ) E 1 (E 1)
R.H.S. = =

= E E 1 = L.H.S.
1
1
1 E
E 1
E 1
1 E
(c) Since the points are equispaced with h = 0.1, we can use Newton difference
interpolation. We first construct the forward difference table. We have
x
f(x)
f(x)
2 f(x)
3 f(x)
0.1
0.93
0.2
0.92 - 0.01
0.3
0.97 0.05
0.06
0.4
1.08 0.11
0.06
0
0.5
1.25 0.17
0.06
0
0.6
1.48 0.23
0.06
0

using the Newton forward difference interpolation and the given data, we obtain
f ( x ) = 0.93 +

(x 0.1)(x 0.2 ) (0.06) = 3x 2 x + 1


x 0 .1
(0.01) +
0 .1
2(0.01)

9. (a) We need an approximation of the form y + a + (b/x). We determine a and b such that
5

I (a, b) = [ y i {a + (b / xi )}] = minimum. We obtain the normal equations


2

i =1

I
b
= 2 y i a = 0
a
xi

or

5a b

1
=0
xi

b 1
I
= 2 y i a = 0
xi x i
b

or

From the given data, we obtain


yi = 16.7, (1 / xi ) = 2.2833,

(1 / x ) = 1.4636, ( y

yi

1
1
b 2 = 0
xi
xi

2
i

/ xi ) = 8.925

Hence, we have the normal equations


5 a + 2.2833 b = 16.7,

2.2833 a + 1.4636 b = 8.925

Solving these equations, we obtain a = 1.9305 and b = 3.0863


(b) Using the given formula and the given data, we get for x = 0.4 and
h = 0.2 : y (0.4) = [ y (0.2) 2 y (0.4) + y (0.6)] /(0.2) 2 = 4.0825
y (0.4) = [ y (0.3) 2 y (0.4) + y (0.5)] /(0.1) 2 = 4.1600

h = 0 .1 :

Using the Richardson extrapolation scheme, we obtain the improved value of


y (h ) as
[4 y (h / 2) y (h)] / 3 . We get

y (0.4) = [4(4.1600) (4.0825)] / 3 = 4.1858


10. (a) The method is exact for f(x) = 1 and f(x) = x. Making the method exact for f(x) = x2,
we get

x1
x0

x 2 dx = x13 x03 / 3 = h x02 + x12 / 2 + ph 2 [2 x0 2 x1 ]

Writing x1 = x0 + h, we obtain
1
h
3hx02 + 3h 2 x0 + h 3 = 2 x02 + 2hx1 + h 2 2 ph 3 , which gives p = 1/12.
3
2

We write the integral

f (x ) dx as
a

xn

x1

x2

x0

x0

x1

f (x ) dx = f (x ) dx = f (x ) dx +

f ( x ) dx + ....... +

xn
xn 1

f ( x ) dx

Replacing each integral on the right side by the given formula, we get

10

xn
x0

2
h

h2
( f 0 f1) + h ( f1 + f 2 ) + h ( f1 f 2 )
f ( x ) dx = ( f 0 + f1 ) +
12
12
2
2

h2
( f n1 f n )
+ ......... + ( f n 1 + f n ) +
12
2

2
h
h
= [ f 0 + 2( f 1 + f 2 + .......... f n 1 ) + f n ] +
( f 0 f n )
2
12
which is the required composite rule.
(b) Using x = (t + 5) / 2 we change the limits of integration from [2, 3] to [-1, 1]. Hence,
1

we get I = f (t )dt ,
1

where f (t ) =

Using Gauss two-point formula

1 cos 2(t + 5)
2 1 + sin((t + 5) / 2)

f (x )dx =
1

f (1 / 3 ) + f (1 / 3 )

we get I = [0.117755 0.464401] / 2 = 0.173323


Using Gauss three-point formula

f (x )dx =[5 f (
1

3 / 5 + 8 f ( 0) + 5 f

)]

3/5 / 9

we get I = [5(0.302693) + 8(0.524921) + 5(0.420090)] / 18 = 0.200688


11. (a) Taylor series second order method is given by
y n +1 = y n + hy n + h 2 y n / 2
y n +1 = y n + hy n + h 2 y n / 2, n = 0,1,...........
We have

y = cos x 3 y 2 y, y = sin x 3 y 2 y and h = 0.2. We get

n = 0 : x0 = 0, y 0 = 1, y 0 = 1, y 0 = 4,

y 0 = 10 and

y1 y (0.2) = y 0 + (0.2) y 0 + (0.2) 2 y 0 / 2 = 1.12


y1 y (0.2) = y 0 + (0.2) y 0 + (0.2) 2 y 0 / 2 = 0.4

n = 1 : x1 = 0.2, y1 = 1.12, y1 = 0.4, y1 = 2.4599, y1 = 6.3811 and


y 2 y (0.4) = y1 + (0.2) y1 + (0.2) 2 y1 / 2 = 1.1508
y 2 y (0.4) = y1 + (0.2) y1 + (0.2) 2 y1/ 2 = 0.0356
(b) We have x0 = 1, y0 = 2, h = 0.2 and f(x, y) = (y + 2x) / (y + 3x).
Using the given method, we get for
n = 0 : k1 = hf ( x 0 , y 0 ) = 0.2 f (1, 2) = 0.16
k 2 = hf ( x0 + h / 2, y 0 + k1 / 2 ) = 0.2 f (1.1, 2.08) = 0.1591
k 3 = hf ( x0 + h, y 0 k1 + 2k 2 ) = 0.2 f (1.2, 2.1582 ) = 0.1583
y1 y (1.2) = y 0 + (k1 + 4k 2 + k 3 ) / 6 = 2.1591

11

Subject

NUMERICAL COMPUTING

Code

C-09 / T-09 (December 2003)

1. (a) Absolute error = true value - approximate value


= 3.1415926 3.1428571 = 0.0012645
Relative error =

Absolute error
= 0.000402
true value

Answer: A

(b) The rate of convergence of Newton-Raphson method is 2. Hence s = 2


Answer: A
(c) Using Gerschgorin theorem, we find that

7 5 3 5
, , = < 1 , Hence, ( A ) < 1
12 6 4 6

max

Answer: D

(d) The maximum error in linear interpolation is h 2 / 8 M 2


where M 2 = max f ( x ) = max sin x = 1 / 2 .
I

0 x / 4

We choose h such that


h2 1

< 0.00000005 or h < 0.00075


8 2
Hence, largest value of h is 0.00075
f1 / y 2 x 1
f 1 / x
(e) Jacobian matrix =
=
f 2 / y 2 x
f 2 / x
1
At the point (1, 1), we get, Jacobian matrix =
2

Answer: D

2y 1
2 y 1
1
- 3

Answer: B

(f) Since f is a polynomial of degree k, all the divided differences of order k are equal and
divided differences of order greater than k are zeros.
Answer: C

Answer: C

(g) Trapezoidal rule is exact for polynomials of degree upto one.


(h) Mid-point rule is given by : y n +1 = y n 1 + 2hf ( x n , y n )
For n = 1, we get y 2 = y 0 + 2h f ( x1 , y1 )

We calculate y1 = y (0.2 ) from the exact solution y ( x) = 1 / 1 + x 2

We obtain y1 = 1 /(1 + (0.2) 2 ) = 0.9615


Hence, from the given formula, we get for h = 0.2, y 0 = 1 and x1 = 0.2
y 2 y (0.4) = y 0 + 2h(2 x1 y12 ) = 0.8520

Answer: B

12

2 (a) Substituting x n = A n , we obtain the characteristic equation

2 + 0.2 0.99 = 0 or 100 2 + 20 99 = 0


The roots of the characteristic equation are -1.1 and 0.9
The general solution is written as x n = c1 (1.1) n + c 2 (0.9) n
Using the given conditions, we obtain
n = 0:
c1 + c 2 = 1 ,
n = 1:

1.1c1 + 0.9c 2 = 0.9

Solving, we get c1 = 0 and c 2 = 1 and x n = (0.9) n


Since one root of the characteristic equation is greater than 1 in magnitude,
computation will not be stable.
(b) We have f ( x) = 3 x cos x 1 , we find the f (x) < 0 for all x < 0. We obtain
f(0) = -2 < 0 and f(1) = 3 cos1 - 1 = 1.46 > 0.

Therefore, the smallest root in magnitude lies in (0, 1).


Using the Newton-Raphson method, we obtain
f (xn )
3 x cos x n 1
x n +1 = x n
= xn n
, n = 0,1,...........
f ( x n )
3 + sin x n
n = 0 : x0 = 0.5, f ( x0 ) = 0.377583, f ( x0 ) = 3.479426 and x1 = 0.608519
n = 1 : x1 = 0.608519, f (x1 ) = 0.005060, f (x1 ) = 3.571653 and

x 2 = 0.607102

3. (a) Without pivoting


(A

b) =

1-1/

2-1/

Using back substitution, we get


2 1 2 1
1
1
=
, x1 = [1 x 2 ] =
11
1

1
With pivoting
x2 =

(A

b) =

1- 1-2

Using back substitution, we get


x2 =

1 2
1
1
, x1 = 2 x 2 =
=
1
1
1

Results in both cases are same, since we are using exact arithmetic.

13

(b) The iteration matrix in the Jacobi method is given by M = D(L + U ). We obtain

1
from the given matrix A, M =
0

0 0
1 2k

k 0 - k
=
.
0 - 2k 0

The eigen values of M are obtained from

k
M I =
= 2 2k 2 = 0 or = 2k .
2k
For convergence of Jacobi method, we have
(M ) = 2 k < 1 . Hence, k < 1 2
4. (a) We obtain from the augmented matrix

(A b) =

4
2

1
5

1
-2

5
9

13

R2 R1/2
R3 R1/2

4
0
0

1
9/2
5/2

1
-5/2
11/2

5
13/2
21/2

R3 5R2/9

4
0
0

1
9/2
0

1
-5/2
62/9

5
13/2
62/9

Using back substitution, we get


2 13 5
1
1
z = 1, y = + z = 2, x = [5 y z ] =
92 2
4
2
(b) The Gauss-seidel iteration method in matrix form is given by

x n +1 = (D + L ) U x n + (D + L ) b = H x n + c
From the given system of equations, we have
4
0
0
0
0
D+L=
0
5
0
U= 0
0
5
4
10
,
0
0
We obtain
50 0 0 0 0 2
0 0

1
1
H = (D + L ) U =
40 0 0 0 2 = 0 0
0
200
0 0

- 25 - 16 20 0 0 0
1

2
2
0
- 1/2
- 2/5
41/100

Now eigen values of H are = 0, 0, 0.41


Since (H ) = 0.41 < 1, the method converges. The rate of convergence is given by

14

v = log10 ( (H )) = 0.3872 or

v = l n( (H )) = 0.8916

Q5. (a) We have f (x1 , x 2 ) = 4 x12 x 22 , g (x1 , x 2 ) = 4 x1 x 22 x1 1


2x 2
f / x 2 8 x1

= 2
g / x 2 4 x 2 1 8 x1 x 2

f / x1
J = Jacobian matrix =
g / x1

J 1 =

1 8 x1 x 2

D 1 4 x 22

2 x2
2
2
, D = 64 x1 x 2 + 2 x 2 4 x 2 1
8 x1

(
(

x1 (n +1) x1 (n )
f x1 (n ) , x 2 (n )
=
J n 1
x 2 (n +1) x 2 (n )
g x1 (n ) , x 2 (n )

Using Newtons method :

), n = 0,1,.......
)

we obtain
n = 0 : x1 (0 ) = 0, x 2 (0 ) = 1, f 0 = 1, g 0 = 1, D = 6

x1 (1) 0 1 0

=
x (1) 1 6 3
2
n = 1 : x1

(1)

= 1 / 3, x 2

2 1 1 / 3
=

0 1 1 / 2
(1)

= 1 / 2, f 1 = 7 / 36, g1 = 1, D = 32 / 9

x1 (2 ) 1 / 3 9 4 /3

=

x (2 ) 1 / 2 32 0
2

1 7 / 36 0.541667

8/3 1 1.25

l11 0
where L = l 21 l 22
l 31 l 32

(b) We write A = L L ,

0
0
l 33

We obtain

2
3

- 1

-1
2 =
- 1

3
1
2

l11 0
l
21 l 22
l 31 l 32

l11 2

0
0 =
l 33

l11l 21
l11l 31

l 21
l 22
0

l 31
l 32
l 33

l11 l 31

l11l 21
2
l 21

l11
0

2
+ l 22

l 21 l 31 + l 22 l 32

l 21l 31 + l 22 l 32

2
2
2
l 31
+ l 32
+ l 33

Comparing element by element, we obtain


first row: l11 = 2 l11 = 2 ; l11l 21 = 3 l 21 = 3 2 / 2,
2

l11l 31 = -1 l 31 = 2 / 2

second row: l 21 + l 22 = 1 l 22 = 7 / 2 which is not possible.


2

Hence, we cannot use the Choleski method.

15

Note: For the use of Choleski method, the given coefficient matrix must be positive
definite. The given matrix A is not positive definite matrix since first leading
2
3
minor = 2 > 0 and second leading minor =
= 7 < 0
3
1

Q6. (a) The largest off-diagonal element in magnitude in A is a13 = 2. We obtain


2a13

tan 2 =
= , or =
4
a11 a33

cos
Now define S1 = 0
sin
and

0
1
0

1 / 2 1

0
2

1 / 2 2

1 / 2
0

T
A 1 = S 1 A S 1 = 0
1
- 1 / 2 0

1 / 2
0

= 0
1
- 1 / 2 0

- sin 1 / 2

0 = 0
cos 1/ 2

1/ 2

1 / 2

3 / 2

2
3 / 2

2
3
2

1
0

2 1 / 2

2 0

1 1 / 2

2
3
2

- 1/ 2

0
1/ 2

1 / 2 3

0
= 2
- 1 / 2 0

0 -1/ 2

1
0

0 1 / 2
0
0
- 1

2
3
0

Now, largest off diagonal element in A1 is a12 =2. We obtain


2a12

tan 2 =
= , or =
a11 a 22
4

cos
Now define S 2 = sin
0

- sin
cos
0

0 1 / 2

0 = 1 / 2
1 0

-1/ 2

0 3

0 2
1 0

0 1 / 2

0 1 / 2
- 1 0

1/ 2
0

0
1

and

1 / 2

T
A 2 = S 2 A 1 S 2 = - 1 / 2
0

1/ 2
1/ 2
0

2
3
0

1 / 2
1/ 2
0 5 / 2 - 1/ 2
0
0
5

= - 1 / 2 1 / 2
0 5 / 2 1/ 2
0 = 0
1
0

0
0
1 0
0
-1
0

which is the diagonal matrix. The eigen values of A are 5, 1, -1.

-1/ 2
1/ 2
0

0
1

0
0
- 1

16

The eigen vectors are obtained from


1 / 2
0
- 1/ 2 1 / 2

S = S 1S 2 = 0
1
0 1 / 2

1/ 2
0
1/ 2 0

0 1 / 2
- 1/2

0 = 1 / 2 1 / 2
1 1/2
- 1/2

- 1/ 2
1/ 2
0

Hence, eigen vectors are


1 / 2, 1 / 2 , 1 / 2 T , 1 / 2, 1 / 2 , 1 / 2 T , 1 / 2 , 0, 1 / 2

] [

] [

- 1/ 2

1 / 2

respectively.

(corresponding to = 5, = 1, = 1 )
.
6. (b) We obtain using Givens method and the given matrix A
a

tan = 13 = 1, or =
a12
4
1
Define S1 = 0
0

- sin = 0
cos 0

0
cos
sin

- 1/ 2
1/ 2

1/ 2
1/ 2

and

A 1 = S 1 A S 1 = 0
0

= 0
0

0
1/ 2
-1/ 2

1/ 2
-1/ 2

1 / 2 2

1 / 2 2
0

1 / 2 2
1 / 2 2
0

2
1
2

2 1

2 0
1 0

1

1 / 2 = 2 2

- 1 / 2 0

4/ 2

3/ 2
3/ 2

0
1/ 2
1/ 2
2 2
3
0

- 1/ 2
1 / 2
0

0
- 1

which is the required tridiagonal form

1
2 2

From A 1 = 2 2 3
0
0

we obtain the Strums sequence

0 b1

0 = c1
- 1 0

c1
b2
c2

0
c 2 ,
b3

f0 = 1
f 1 = b1 = 1

f 2 = ( b2 ) f1 c12 f 0 = ( 3)( 1) 8 = 2 4 5

f 3 = ( b3 ) f 2 c 22 f 1 = ( + 1) 2 4 5 = ( + 1)( + 1)( 5)
The eigen values of A are -1, -1 and 5. The largest eigen values in magnitude of A is 5.

17

7. (a) We are given that f ( x ) = x 9 x . We obtain


x
0
0.5
1
f(x)
-1
1/6
8/9
We now construct the Newtons forward difference table
x
f(x)
f
2f
0
-1
0.5
1/6
7/6
1
8/9
13/18 -4/9
Using Newtons forward difference interpolation
x x0
(x x0 )(x x1 ) 2
f (x ) = f (x0 ) +
f 0 +
f0
h
2!h 2
we obtain for h = 1/2
8
25
1 4
7
x 1
f ( x) p ( x ) = 1 + 2 x + 2 x ( x) = x 2 +
9
9
2 9
6
Setting p(x) = 0, we obtain the solutions x = 2.7098 and x = 0.4152
(b) Let p(x) = 2 ( x + 1) + x( x + 1) 2 x( x + 1)( x 1) + a x( x + 1)( x 1)( x 2)
This polynomial interpolates the first four points in the given table. We determine a
so that this polynomial interpolates at the last point also. We get
p(3) = 2 4 + 12 48 + 24a = 10, or a = 2

Hence, the required polynomial is


p(x) = 2 ( x + 1) + x( x + 1) 2 x( x + 1)( x 1) + 2 x( x + 1)( x 1)( x 2)

8. (a) We want an approximation of the form y = a + (b / x ) where a and b are constants to


be determined such that
5

I (a, b) = ( y i a b / xi ) = minimum
2

i =1

We obtain the normal equation

I
b
1
= 2 y i a = 0, or y i 5a b = 0
a
xi
xi

y
I
b 1
1
1
= 2 y i a = 0, or i a b 2 = 0
b
xi x i
xi
xi
xi

From the given data, we obtain


yi = 65, 1 / xi = 2.2833, 1 / xi2 = 1.4636, yi / xi = 31.5333
Hence, we obtain the normal equations
5a + 2.2833b = 65
2.2833a + 1.4636b = 31.5333
Solving these equations, we get a = 10.9918 and b = 4.3972.

18

(b) We have
TE = y ( x0 + sh ) ay ( x0 ) by ( x0 + h ) ch 2 y ( x0 ) dh 2 y ( x0 + h)

s2h2
s 3h3
s 4 h 4 iv
y ( x0 ) +
y ( x0 ) +
y ( x0 ) + .......
2
6
24

h2
h3
h 4 iv
b y ( x0 ) + hy ( x0 ) +
y ( x0 ) +
y ( x0 ) +
y ( x0 ) + ...........
2
6
24

= y ( x0 ) + s hy ( x0 ) +
a y (x 0 )

h 2 iv
ch 2 y ( x0 ) dh 2 y ( x 0 ) + hy ( x0 ) +
y ( x0 ) + ..........
2

2
s b

= (1 a b ) y ( x0 ) + (s b )hy( x0 ) + c d h 2 y( x0 )
2 2

s3 b

s4 b d
+ d h 3 y( x0 ) + h 4 y iv ( x0 ) + ........
6 6

24 24 2
(r)
Setting the coefficients of y ( x0 ) , r = 0, 1, 2, 3, equal tozero, we obtain
1 a b = 0,
s -b=0
2
s
b
s3 b
c d = 0,
d =0
2 2
6 6
Solving these equations, we get

a = (1 s ), b = s, c = s (s 1)(s - 2 )/6 and d = s s 2 1 / 6.

9. (a) Let g ( x) = f ( x )dx be the quantity which is to be obtained and g h / 2 r denote the
a

approximate value of g ( x) obtained by using the given method with step length
h/2r, r = 0, 1, 2, . Thus we have
g (h) = g ( x) + c1h 4 + c 2 h 6 + c3 h 8 + ............

c1 h 4 c 2 h 6 c3 h 8
h
g = g (x ) +
+
+
+ .............
16
64
256
2
c3 h 8
c1 h 4 c 2 h 6

=
g
(
x
)
+
+
+
+ ............

256 4096 65536

M
Eliminating c1 from the above equations, we get

h
g 2
2

g (1) (h) =

4 2 g ( h / 2) g ( h )
2

4 1

= g ( x)

1c 2 6 1
h c 3 h 8 ..........
20
16

1c
4 2 g ( h / 2 2 ) g ( h / 2)
h
1
g (1) ( ) =
= g ( x) 2 h 6
c 3 h 8 ..........
2
2
1280
4096
4 1

M
Eliminating c2 from the above equations, we get

19

g ( 2) ( h) =

4 3 g (1) (h / 2) g (1) (h)


3

4 1

= g ( x) +

1
c 3 h 8 + ..................
1344

M
Thus successive higher order results can be obtained from the formula
4 m+1 g (m1) (h / 2) g (m 1) (h)
+ O h 2 m+ 4 , g ( 0) (h) = g (h )
m +1
4 1

g ( m ) (h) =

I =

Now we evaluate the given integral

x dx
01+ x + x2
1

Using Simpsons rule, we get


h = 1/ 2 :

x0 = 0,

x1 = 1 / 2,

x 2 = 1,

f 0 = 0,

f 1 = 2 / 7,

f 2 = 1/ 3

h
[ f 0 + 4 f1 + f 2 ] = 1 0 + 8 + 1 = 0.246032
3
6
7 3
h = 1 / 4 : x0 = 0, x1 = 1 / 4, x 2 = 2 / 4, x3 = 3 / 4, x 4 = 1,
I (h) =

f 0 = 0,

f 1 = 4 / 21, f 2 = 2 / 7, f 3 = 12 / 37, f 4 = 1 / 3
h
I ( h / 2) = [ f 0 + 4( f 1 + f 3 ) + 2 f 2 + f 4 ]
3
1
4 12 2 1
= 0 + 4 + + 2 + = 0.246997
12
21 37 7 3
16 I (h / 2) I (h)
Using Romberg integration, we obtain I =
= 0.247061
15

9. (b) The method is exact for f (x) = 1 and x. Making the method exact for f (x) = x2, we get
x1
h 2
2
2
2
x0 x dx = 2 x0 + x1 + ph (2 x0 2 x1 )
1 3
h
or
x1 x03 = x02 + x12 + 2 ph 2 ( x0 x1 )
3
2

Since x1 = x0 + h, we get

) (

1
h
3hx 02 + 3h 2 x 0 + h 3 = 2 x 02 + 2hx 0 + h 2 2 ph 3
3
2

Simplifying, we obtain 1 4 p = 2 / 3. Therefore, p = 1 / 12.


c
The error of integration is given by :Error = f ( ), x0 < < x1
3!
2
x1
h
h
where, c = x 3 dx x03 + x13
3 x02 3 x12 = 0
x0
2
12

Therefore error is written as :Error =


x1

where c = x 4 dx
x0

c
f
4!

iv

( )

h 4
h2
h5
x0 + x14
4 x03 4 x13 =
.
2
12
30

20

Hence, Error =

h 5 1v
f ( ) .
720
b

x1

x2

x0

x1

We can now write I = f ( x )dx = f ( x )dx +

f ( x )dx +........... +

xN
x N 1

f ( x )dx

Replacing each integral by the above integration formula, we get


h
h

h2
h2

(
)
(
)
(
)
( f1 f 2 ) + ........
I = f 0 + f1 +
f 0 f1 + f 1 + f 2 +
12
12
2
2

h2
+ ( f N 1 + f N ) +
( f N 1 f N )
12
2

2
h
[ f 0 + 2( f1 + f 2 + ........ + f N 1 ) + f N ] + h ( f 0 f N )
2
12

which is the required composite rule.


10. (a) TE = f ( x0 ) 0 f ( x0 ) 1 f ( x0 + h ) 2 f ( x0 + 2h )
Expanding each term in Taylor series about x0 and collecting terms of various order
derivatives we get
TE = ( 0 + 1 + 2 ) f 0 + [1 h( 1 + 2 2 )] f 0

3
h2

( 1 + 4 2 ) f 0 h ( 1 + 8 2 ) f 0..........
..
2
6

We choose 0 , 1 , 2 such that

0 + 1 + 2 =0

1 + 2 2 = 1 / h
1 + 4 2 = 0
Solving the above system of equations ,we get

0 = 3 /(2h), 1 = 2 / h, 2 = 1 /(2h)
Hence, we obtain the differentiation method
f ( x0 ) =

1
[ 3 f ( x0 ) + 4 f ( x1 ) f ( x 2 )]
2h

The error term is given by TE =


(b) We write I =

1
1

x 1 x 2 sin x
1 x

2
h3
( 1 + 8 2 ) f ( ) = h f ( ), x0 < < x2
6
3

dx =

1
1

f (x )
1 x

dx , where f (x) = x (1 x2) sin x

Using Gauss-Chebyshev two point method

21

f (x )

1 x2

I=

dx =

1
1
+ f
,
f
2
2
2

we get

1
1 1 1 1 1 1
1
sin
+
=
= 0.7215652
sin
sin

2
2 2 2
2
2 2 2
2 2

Using Gauss-Chebyshev three point formula

f (x )

1
1

1 x2

I=

dx =

3

3
+ f (0 ) + f
, we get
f

3 1 3
3 1
3
+0+
sin

2 4 sin 2
3 2 4 2

3
= 0.345420
sin

3 4
2

11. (a) Eulers method is given by : yi +1 = y i + hf i = y i 2hxi y i2 , i = 0,1,2,3,4


We obtain for h = 0.2
i=0

x0 = 0,

y0 = 1,

y1 y (0.2 ) = y 0 2(0.2) x0 y 02 = 1
i=1

x1 = 0.2, y1 = 1,
y 2 y (0.4 ) = y1 2(0.2) x1 y12 = 0.92

i=2

x2 = 0.4, y2 = 0.92,
y3 y (0.6 ) = y 2 2(0.2) x 2 y 22 = 0.784576

i=3

x3 = 0.6, y3 = 0.784576,
y 4 y (0.8) = y 3 2(0.2) x3 y 32 = 0.636842

i=4

x4 = 0.8, y4 = 0.636842,
y5 y (1.0 ) = y 4 2(0.2) x 4 y 42 = 0.507060

(b) Expanding in Taylor series about the point ( x n , y n ), we get


k1 = hf ( x n , y n ) = hf n
k 2 = hf ( x n + c 2 h, y n + a 2 k1 ) = hf ( x n + c 2 h, y n + a 2 hf n )

= h f n + h c2 f x + a 2 f f y

)n + h2 (c 22 f xx + 2c 2 a 2 f

f xy + a 22 f 2 f yy

+ ............

Substituting in the given method, we get

y n +1 = y n + (w1 + w2 )hf n + h 2 w2 c 2 f x + w2 a 2 f f y

22

h3
w2 c 22 f xx + 2c 2 a 2 ff xy + a 22 f 2 f yy
2

+ .........

(1)

We also have,
h2
h3

y n +1
yn +
y n + ............
2
6
h2
= y n + hf n +
fx + f fy n
2
h3
+
f xx + 2 f f xy + f 2 f yy + f y ( f x + f f y ) n + ............
6
= y n + hy n +

[(

(2)

Comparing the coefficients of h and h2 in (1) and (2), we get,


1
1
, w2 a 2 =
2
2
Solving these equations, we get
w1 + w2 = 1, w2 c 2 =

a 2 = c 2 , w2 =

2c 1
1
and
, w1 = 2
2c 2
2c 2

c 2 0 is arbitrary.

Hence, we obtain the method

1
y n +1 = y n + 1
2c 2

1
k1 +
k2
2c 2

k1 = hf ( x n , y n )
k 2 = hf ( x n + c 2 h, y n + c 2 k1 )
The truncation error is given by
TE = y ( x n +1 ) y n +1

1 c

1
= h 3 2 f xx + 2 f f xy + f 2 f yy + f y ( f x + f f y )n + O(h 4 )
6
6 4

Hence, the method is of second order for all values of c2.

23

Subject: Numerical Computing


Code: C-09/T-09 (June 2004)

1. (a) For one application of Simpsons rule, we require three nodal points. Since we have
2n +1, (odd) nodal points, the number of sub-intervals n must be even. Answer: A

(b) We have (dy / y ) = x dx. Integrating, we get ln y = x 2 / 2 + c. Using the given


condition, we obtain c = 0. Hence, y = e

x2 / 2

1+ x / 2 .

Answer: C

(c) The method produces exact results for polynomials of degree upto 1. The order of
convergence is 2.
Answer: D

) (

)(

(d) p( x ) = x 4 2 x 3 + 2 x 2 2 x + 1 = x 2 2 x + 1 x 2 + 1 = 0. Hence roots are x = 1, 1


and x = i. These roots form a complex pair.
Answer: C
(e) Using Gerschgorin theorem, we find that
7 5 3 5
max , , =
12 6 4 6
Hence, spectral radius < 1.

Answer: D

(f) An n-point Gauss-Legendre method is exact for polynomials of degree upto 2n 1.


Hence, for n = 4, the method will produce exact results for polynomials of degree
Answer: D
upto 7.
(g) The error term of the method is given by
TE = y ( x n + h ) y ( x n h ) 2h y ( x n )

= h 3 y ( x n ) / 3 + O (h 4 )
Answer: A

Hence, order of the method is 2.


(h) We have f ( x ) = f ( x + h ) f ( x ) = Ef ( x ) f ( x ) = (E 1) f ( x )
Hence, = E 1. The result = E + 1 is wrong.

Answer: B

2. (a) We obtain from the augmented matrix

(A b) =

1
2
-3

1
1
-1

2
-3
8

1
0
A

1
0
0

1
-1
2

2
-7
14

1
-2
R3 + 2R2
A+3

1
0
0

1
-1
0

2
-7
0

1
-2
A-1

R2 2R1
R3 + 3R1

24

For consistency of the system A = 1. For other values of A, the system is


inconsistent.
(b). We obtain from the augmented matrix

(A b) =

1
1/2
1/3

1/2
1/3
1/4

1/3
1/4
1/5

1
0
0

1
0
0

1/2
1/12
1/12

1/3
1/12
4/45

1
-1/2
-1/3

1
0
0

1/2
1/12
0

1/3
1
1/12 -1/2
1/180 1/6

R2 R1/2
R3 - R1/3

R3 - R2

Using back substitution, we obtain x3 = 30, x2 = -36, x1 = 9.


3.

Gauss-Legendre two-point method is written as


1

f (x ) dx = f (x ) + f (x )
0

-1

where 0 , 1 , x0 , x1 are to be determined. Making the method exact for

f ( x ) =1, x, x2 and x3, we get


1

f ( x ) =1 :

-1

f ( x ) =x :

-1

f ( x ) =x2 :

f ( x ) =x3 :

1
-1
1
-1

dx = 0 + 1 ,
x dx = 0 x0 + 1 x1 ,

or
or

x dx = 0 x02 + 1 x02 , or
3

x dx = 0 x03 + 1 x03 , or

0 + 1 = 2
0 x0 + 1 x1 = 0

(1)
(2)

0 x02 + 1 x02 =2/3 (3)


0 x03 + 1 x03 = 0

From (2) and (4) we obtain on eliminating 0 ,

(4)

1 x0 ( x02 x12 ) = 0

Since 1 0, x0 0, x 0 x1 (system becomes inconsistent).


we get x0 = -x1. From (3) we obtain ( 0 + 1 ) x02 =2/3 or x02 =1/3
We obtain x0 = 1 / 3, x1 = 1 / 3, 0 = 1 = 1.
Hence, the method becomes

f (x ) dx = f (1 / 3 ) + f ( 1 / 3 )
1

-1

To evaluate the given integral using this method, we first change the limits of
integration from [-2, 2] to (-1, 1). Using the substitution x =2t, we obtain

25

I = e x / 2 dx = 2 e t dt = 2 e1 /

+ e 1 /

] = 4.685392

4. (a) We have x0 = 1, x1 = 3, f ( x ) = x 2 x 2, f 0 = f ( x0 ) = 2, f1 = f ( x1 ) = 4.
Since f 0 f 1 < 0, ( x0 , x1 ). Using the method of false position, we get

x2 =

First iteration:

x1 f 0 x0 f 1
= 1.6667,
f 0 f1

f 2 = f ( x 2 ) = 0.8888

Since f1 f 2 < 0, ( x1 , x 2 ). we get


Second iteration: x3 =

x 2 f 1 x1 f 2
= 1.9091, f 3 = f ( x3 ) = 0.2644
f1 f 2

Since f1 f 3 < 0, ( x1 , x3 ). we get

x4 =

Third iteration:

x3 f 1 x1 f 3
= 1.9767
f1 f 3

After three iterations, we obtain the root as 1.9767.


(b) Using Lagrange interpolation and the given data, we obtain
f (x ) p3 (x ) =

+
=

(x 1)(x 2)(x 3) (0) + (x 0)(x 2)(x 3) (1.7183)


(0 1)(0 2)(0 3)
(1 0)(1 2 )(1 3)

(x 0)(x 1)(x 3) (6.3891) + (x 0)(x 1)(x 2) (19.0855)


(2 0)(2 1)(2 3)
(3 0)(3 1)(3 2)

1 3
1
1
x 5 x 2 + 6 x (1.7183) x 3 4 x 2 + 3 x (6.3891) + x 3 3 x 2 + 2 x (19.0855)
2
2
6

= 0.8455 x3 1.0603 x2 + 1.9331 x


We obtain f (1.5) 3.3675 .
5 (a) We have f ( x, y ) = x + y 2 , x0 = 1, y 0 = 2, h = 0.1
Using the classical fourth order Runge-Kutta method, we get
k1 = hf (x 0 , y 0 ) = 0.1 f (1, 2 ) = 0.5
k 2 = hf ( x 0 + h / 2, y 0 + k1 / 2 ) = 0.1 f (1.05, 2.25) = 0.61125
k 3 = hf ( x0 + h / 2, y 0 + k 2 / 2 ) = 0.1 f (1.05, 2.305625) = 0.636591
k 4 = hf ( x0 + h, y 0 + k 3 ) = 0.1 f (1.1, 2.636591) = 0.805161
y1 y (1.1) = y 0 + (k1 + 2k 2 + 2k 3 + k 4 ) / 6 = 2.633474
Now, x1 = 1.1, y1 = 2.633474. We get

k1 = hf ( x1 , y1 ) = 0.1 f (1.1, 2.633474) = 0.803518


26

k 2 = hf (x1 + h / 2, y1 + k1 / 2) = 0.1 f (1.15, 3.035233) = 1.036264


k 3 = hf ( x1 + h / 2, y1 + k 2 / 2 ) = 0.1 f (1.15, 3.151606) = 1.108263
k 4 = hf ( x1 + h, y1 + k 3 ) = 0.1 f (1.2, 3.741737 ) = 1.520060
y 2 y (1.2) = y1 + (k1 + 2k 2 + 2k 3 + k 4 ) / 6 = 3.735579
(b) We first write the given method in the form

x k x0

x k +1 = x k
f (x k )
f (x k ) f (x0 )
Substituting x k = + k and x0 = + 0 , we get

k 0
k +1 =k
f ( + k )
f ( + k ) f ( + 0 )

[k 0 ] [k f ( )+ k2 f ( ) / 2 + .............]
(k 0 ) f ( ) + (k2 02 ) f ( ) / 2 + .....
since f ( ) = 0. Cancelling (k 0 ), we get
1
k +1 =k [k +C 2 k2 +...............][1 + {(k + 0 )C 2 + ........}]
= k [k +C 2 k2 +...............] [1 (k + 0 )C 2 + .........]
=k

where C2 = f ( ) /(2 f ( ))

[
+ )

Therefore, we get k +1 = k k C 2 0 k +O (k2 0 + k 02 )


= C 2 0 k +O (2k 0

2
0

Hence, k +1 = c k , where c = C 2 0
Therefore, the method has linear rate of convergence.
6. (a) We have f ( x ) = x / sin x and f (0 ) = lim( x / sin x) = 1.
x 0

From the trapezoidal rule, we get


h = 1/2 :
x0 = 0, x1 = 1/2,

f0 = 1, f1 = 1.042915 and

I = h[ f 0 + f 1 ] / 2 = 0.510729
h = 1/4 :

x0 = 0, x1 = 1/4, x2 = 1/2, f0 = 1, f1 = 1.010493,

f2 = 1.042915 and

I = h[ f 0 + 2 f1 + f 2 ] / 2 = 0.507988
h = 1/8 : x0 = 0, x1 = 1/8, x2 = 2/8, x3 =3/8, x4 = 1/2, f0 = 1, f1 = 1.002609,
f2 = 1.010493, f3 = 1.023828, f4 = 1.042915 and
I = h[ f 0 + 2( f 1 + f 2 + f 3 ) + f 4 ] / 2 = 0.507298
Using Romberg integration
I (m ) (h ) =

4 m I (m 1) (h / 2 ) I (m 1) (h)
, m = 1,2,........., I (0 ) (h ) = I (h ).
4m 1

27

we obtain the following Romberg table:


0(h2), m=0

1/2
0.510729
1/4
0.507988
1/8
0.507298
Hence, I 0.507068.

0(h4), m=1

0(h6), m = 2

0.507074
0.507068

0.507068

f f
f
g f f i g i +1
(b) (i) i = i +1 i = i i +1
g i g i +1
g i g i +1 g i
1
[g i f i f i g i ]
=
g i g i +1

1
[g i ( f i +1 f i ) f i (g i +1 g i )]
g i g i +1

1
f f i +1
f fi
f i
1
1
(ii) =
= i
. = i +1
=
.
f
f
f
f
f
f
f
f
f
i
i
+
1
i
i
i
+
1
i
i
+
1
i
i
+
1

7. (a) If is an eigen value of a matrix A, then 1/ is an eigen value of A-1. Thus the
smallest eigen value in magnitude of A is the largest eigen value in magnitude of A-1.
Thus, we use the power method on A-1 to obtain its largest eigen value in
magnitude. Then = 1/ is the smallest eigen value in magnitude of A.
We take an arbitrary vector V0 (non-zero) and generate
Yk+1 = A-1 Vk
V k+1 = Yk+1/ mk+1,

(Yk +1 )r
k (V )
k r

Then = lim

(where mk+1 is the largest element in magnitude in Yk+1)


and = 1/

Since V0 = [0, 0, 0]T is zero vector, we cannot use V0 to obtain .


Hence, in this case solution cannot be obtained. However, if take any other vector
V0 say V0 = [1, 1, 1]T, solution can be found. (The question in the present form is
wrong).
8.

Let A be a given real symmetric matrix. The eigen values of A are real. There exists a
real orthogonal matrix S such that S-1 A S is a diagonal matrix D. The elements on the
diagonal of D are the eigen values of A. This diagonalization is done by applying a
sequence of orthogonal transformations, S1, S2, .., Sn, .. as follows:
Among the off diagonal elements, let a ik be the largest element in magnitude.
We define

28

1 0

cos

S =

sin

..

-sin
M
cos

ith row

0 ...

0
..
1
kth column
Thus S is an identity matrix in which the elements in positions (i, i) , (i, k) , (k, i) and
(k, k) are written as cos , - sin , sin and cos respectively. It can be verified that
S in an orthogonal matrix S11 = S 1T .

We consider the 2x2 matrix


S1 =

cos
sin

-sin
cos

Now obtain the matrix (since A is symmetric, aik = aki)


A1 = S11 AS1 =

cos
-sin

sin
cos

p11
p 21

aii
aik

-sin
cos

p12
p 22

where, p11 = aii cos 2 + akk sin 2 + 2aik sin cos

p12 = p 21 = (a kk a ii )sin cos + a ik cos 2 sin 2


2

cos
sin

aik
akk

p 22 = a ii sin + a kk cos 2aik sin cos


We choose such that the matrix A1 becomes the diagonal matrix.
Setting p12 =0, we get
tan 2 = 2a ik /(aii a kk )
where is called the angle of rotation. To obtain the smallest rotation, we take
/ 4 / 4. Now, we find the largest off-diagonal element in A1 and the
procedure is repeated. After r such rotations, we obtain
A r = S r1 S r11 ....... S11 A S1S 2 .......S r = S 1 AS

where, S = S1S 2 Sr.


As r , A r tends to a diagonal matrix D having eigen values on its diagonal.
The columns of S give the eigen vectors corresponding to the elements on the
diagonal of D in that order.

29

In the given matrix, the largest off-diagonal element in magnitude is either a12 or a23.
We take this element as a23 (since a22 = a33 and exact arithmetic can be performed).
From
tan 2 = 2a 23 /(a 22 a33 ) = , we get = / 4. Now define

S1 =

1
0
0

0
cos
sin

0
-sin
cos

1
0
0

0
0
1/ 2 -1/ 2
1/ 2 1/ 2

A1 = S11 AS1 0

1/ 2 1/ 2

1/ 2 -1/ 2

-1/ 2 1/ 2

1/ 2 1/ 2

1
0
0

0
0
1/ 2 1/ 2
-1/ 2 1/ 2

2
1
0

1/ 2 -1/ 2
5/ 2 -3/ 2
5/ 2 3/ 2

2
1/ 2 -1/ 2
1/ 2 5 0
-1/ 2 0 3

Now, the largest off-diagonal element in magnitude in A1 is a12 (or a13). We find
tan 2 = 2a12 /(a11 a 22 ) = 2 / 3 = 0.2203
We obtain sin = -0.2184, cos = 0.9758. Now, define

S2 =

cos
sin
0

-sin 0
cos 0
0
1

0.9758
- 0.2184
0

0.2184
9578
0

0
0
1

A2 = S 21 A 1S 2

0.9758
0.2184
0

-0.2184
0.9758
0

0.9758
0.2184
0

-0.2184
0.9758
0

2
1/ 2 -1/ 2
1/ 2 5
0
-1/ 2 0
3

0
0
1

0
0
1

1.7971
-0.4020
-0.6900

1.1268
5.0334
-0.1544

0.9758
-0.2184
0

0.2184
0.9758
0

0
0
1

-1/ 2
0
3

30

1.8414 0.0002
0.0002 5.1577
-0.6900 -0.1544

-0.6900
-0.1544
3

Since A2 is not a diagonal matrix, we need more iterations. If we neglect the off-diagonal
elements, then eigen values after two iterations are obtained as

= 1.84,

= 5.16,

= 3.

9. (a) We need an approximation of the form y = a + bx + cx2. We determine a, b, c such


that
6

I (a, b, c ) = y i a bxi cxi2

= minimum

i =1

We get the normal equations as


I
I
= 2 y i a bxi cxi2 = 0 ,
= 2 y i a bxi cxi2 xi = 0
a
b
I
= 2 y i a bxi cxi2 xi2 = 0
c
Hence, we obtain

y
x

6a b xi c xi2 = 0 ,

x y

2
i

y i a xi2 b xi3 c xi4 = 0

a xi b xi2 c xi3 = 0

From the given data, we obtain

x
y

i
i

x = 91, x
= 3060, x y = 6450

= 21,

2
i

3
i

= 441,

and

x
x y

4
i

= 2275,

= 17950

2
i

Substituting these values in the normal equations, we get


6a + 21b + 91c = 3060
21a + 91b + 441c = 6450
91a + 441b + 2275c = 17950
We write these equations as
a + 3.5b + 15.66667c = 510
a + 4.333333b + 21c = 307.142857
a + 4.846154b + 25c = 197.252747
Subtracting, we obtain
0.833333b + 5.833333c = -202.857143
0.512821b + 4c = -109.890110
Solving these equations, we obtain
b = -498.434243, c = 36.429357 and

a = 1702.007924

31

(b) We have y = 1 2 xy. Differentiating, we get y = 2 y 2 xy , y = 4 y 2 xy ,


y 1v = 6 y 2 xy . Taylors series method of order four is given by
y n +1 = y n + hy n + h 2 y n / 2 + h 3 y n / 6 + h 4 y v n / 24, n = 0,1,...........
We have h= 0.1. We obtain
n =0
:
x0 = 0,
y0 = 0,

y 0 = 1,

y 0 = 0,

y iv = 0

y 0 = 4,

y1 y (0.1) = y 0 + hy 0 + h 2 y 0 / 2 + h 3 y 0 / 6 + h 4 y 0iv / 24 = 0.099333

n =1 :
x1 = 0.1,
y1 = 0.099333,
y1 = 0.980133, y1 = 0.394693,
y1 = 3.841593,

iv

y1 = 3.841593

y 2 y (0.2) = y1 + hy1 + h 2 y1 / 2 + h 3 y1/ 6 + h 4 y11v / 24 = 0.194746


10. (a) Taking the limit as n and noting that
lim x n = , lim x n +1 = , where is the exact root. We get
n

(i) =

1
a
(1 + 2 ) 2 = a ,
2

2
1
(ii) = (3 ) 2 = a
2
a

Hence, both the methods determine

a , where a is a positive real constant.

1
2
(i) + n +1 = ( + n ) 1 +
2
2
( + n )

1
= ( + n )
2


1 + 1 + n

2
1
( + n ) 1 + 1 2 n + 3 n2 ............ = 1 ( + n )
2
2

2
2 2 n + 3 n2 ...........

2
We obtain, n +1 =n /(2 ) + O (3n ). Error constant = c = 1 / 2
Hence, the method has second order convergence.
=

(ii) + n +1 =

1
( + n )3 12 ( + n )2
2

(1)

1
( + n )2 2 n n2

Simplifying, we obtain, n +1 = 3 2n /(2 ) + O (3n ).


Error constant = c * = 3 / 2

(2)

Hence, the method has second order convergence. Comparing (1) and (2), we find
that error in the first method is about one third of that in the second method. If we
multiply the fist method by 3 and add to the second method, we obtain the method

4 x n +1 =

xn
2

3a
x n2
3
+
+
3

a
x n2

or xn +1 =

xn
8

x n2
3a
6
+
3

a
x n2

(3)

32

The error of this method is given by


n+1 = 3 (error in first method) + (error in second method)
= ( 3 /(2 ) + 3 /(2 ) ) 2n +O (3n ) = O (3n )
Hence, the new method (3) has third order convergence.
11. (a) TE = f ( x0 ) [ 3 f ( x0 ) + 4 f ( x0 + h ) f ( x0 + 2h )] /(2h)
Expanding each term in Taylor series about x0 and simplifying, we get
TE = h 3 f ( ) / 3, x 0 < < x 2 . Therefore, TE M 3 h 3 / 3 where M 3 = max f ( x ) .

Let 0 , 1 , 2 be the round-off errors in evaluating f 0 , f1 , f 2 respectively. We obtain


RE = ( 3 0 +4 1 2 ) / 2h . If = max[ 0 , 1 , 2 ]

then

RE 8 / 2h = 4 / h. We choose h such that

RE = TE 4 / h = h 3 M 3 /3 which gives h = (12 / M 3 )

1/ 4

(b)
From A = LLT where L =

1
2
1

2
5
0

1
0
13

l112

l11
l21
l31

0
l22
l32

0
0
l33

l11
l21
l31

0
l22
l32

0
0
l33

l11
0
0

l11l21
2
21

we obtain

l21
l22
0

l31
l32
l33

l11l31
2
22

l11l21

l +l

l11l31

l31l21+l32l22

l21l31 + l22l32
l 312 + l 322 + l332

Comparing element by element, we get


First row:

l112 = 1 l11 = 1; l11l 21 = 2 l 21 = 2; l11l 31 = 1 l 31 = 1

Second row:

2
l 21
+ l 222 = 5 l 222 = 1 or l 22 = 1;

Third row:

l 313 + l 322 + l332 = 13 l 332 = 8 or l 33 = 2 2

l 21l 31 + l 22 l 32 = 0 l 32 = 2

Hence, we obtain

L=

1
2
1

0
1
-2

0
0
2 2

We write the given system of equations A x = b as


L L T x = b, or LT x = z and L z = b

33

From L z = b, that is,

1
2
1

0
1
-2

0
0
2 2

z1
z2
z3

0
-3
14

0
-3
2 2

We obtain using forward substitution


z1 = 0, z2 = -3, z3 = [ 14 - z1 + 2 z2]/2

From LT x = z , that is,

1
0
0

2
1
0

2 =2 2

1
-2
2 2

x
y
z

We obtain using back substitution z = 1, y = -3 + 2z = -1, x = - 2y z =1

34

Subject

NUMERICAL COMPUTING

Code

C-09 / T-09 (December 2004)

1. (a) We are given f ( x) = x 4 x 10, x0 = 1.8, x1 = 1.9


We obtain f 0 = f ( x0 ) = 1.3024, f1 = f ( x1 ) = 1.1321
Using the secant method, we obtain
x x0
First iteration : x 2 = x1 1
f 1 = 1.8535 , f 2 = f ( x 2 ) = 0.0511
f1 f 0

x x1
Second iteration : x3 = x 2 2
f 2 = 1.8555
f 2 f1

Answer: B

(b) The characteristic equation of the iteration matrix is

(1 / 4 ) 1 / 16 = 0, or 2 ( 1 / 2 ) = 0
2

The roots are = 0, 0, 1/2. Spectral radius is 1/2.

Answer: C

(c) Since the points are not equispaced, we use Newtons divided difference
interpolation. We have
x
-3
-1
0
1
2

f(x)
7
1
1
3
7

First d.d

Second d.d

-3
0
2
4

1
1
1

Third d.d

0
0

Using Newtons divided difference interpolation formula


f ( x ) = f ( x0 ) + ( x x0 ) f [x 0 , x1 ] + ( x x0 )(x x1 ) f [x 0 , x1 , x 2 ] , we get
f ( x ) = 7 + ( x + 3)( 3) + ( x + 3)( x + 1)(1) = x 2 + x + 1
Hence, f (-2) = 3

Answer: B

(d) We write the truncation error as


1
TE = f ( x k )
[ 30 f (xk ) + 16{ f (xk 1 ) + f (xk +1 )} { f (xk 2 ) + f (xk +2 )}]
12h 2
Expanding each term in Taylor series about xk and simplifying, we obtain
TE = h 4 f (6 ) ( ) / 90, x k 2 < < x k + 2 .

Hence, p = 4.

Answer:

(e) Make the method exact for f(x) = 1, x and x2. We get

35

dx = 2a + b
f ( x ) = x : xdx = a + 0 + a
f ( x ) = x : x dx = a + 0 + a

f (x ) = 1 :

or

2a + b = 2

or

0=0

or

2a = 2/3

Hence, we get a = 1 / 3, b = 4 / 3
(f) Write the integral as I =

Answer: D

f (x )

1
1

f (x )
1 x

dx =

dx, where f ( x) = 1 x 2 .

1 x
Using the Gauss-Chebyshev two-point method
1

1
1
1 1
+ f
, we get I = + =
f
2
2 4 4 4
2
2
Answer: A

(g) We need the approximation f ( x ) = ax + b. We determine a and b such that


1

I (a, b ) = x 1 3 (ax + b ) dx = minimum. We obtain the normal equations


0

1
I
= 2 x 1 3 ax b x dx = 0
0
a

3 a b
=0
7 3 2

or

1
I
3 a
= 2 x 1 3 ax b dx = 0
or
b = 0
0
4 2
b
Solving (1) and (2), we get a = 9 / 14, b = 6 / 14

(1)
(2)
Answer: A

(h) Eulers method y n +1 = y n + h f ( x n , y n ) when applied to the given problem gives


y n +1 = y n + h x n + y n , n = 0,1,..........
We have h =0.1. We obtain
n = 0:

x0 = 1, y 0 = 2 , y1 = y 0 + h x0 + y 0 = 2.1732

n = 1:

x1 = 1.1, y1 = 2.1732 , y 2 = y1 + h x1 + y1 = 2.3541

Answer: C

2. (a) Let be the exact root. Since is a root of multiplicity 3, we have

f ( ) = f ( ) = f ( ) = 0 and f ( ) 0
Writing x n +1 = + n +1 , x n = + n in the given method, we get

f ( + n )
+ n +1 = + n

f ( + n )
3 f ( ) / 6+ n4 f 1v ( ) / 24 + .......
or, n +1 =n n 2

3
1v
n f ( ) / 2+ n f ( ) / 6 + ......
1
=n n / 3+ n2 c 4 / 12 + ........ [1 + {n c 4 / 3 + .......}]

36

where c 4 = f iv ( ) / f ( ). Using binomial expansion, we obtain

n +1 =n n / 3+ n2 c 4 / 12 + ...... [1 n c 4 / 3 + ........]
1


=n n n2 c 4 + ......... = 1 n + n2 c 4 + O 3n
36
3
36
3

Setting the coefficient of n to zero, we get = 3.

( )

( )

The error becomes n2 c 4 / 12 + O 3n .


The method has second order rate of convergence and the error constant is 1/12.
(b) We have f ( x ) = x 3 + x 2 + x + 4,
n = 0:

x0 = 1.5,

f ( x ) = 3 x 2 + 2 x + 1 . We obtain

f 0 = 1.375,

f 0 = 4.75

( )

( )

( )

( )

x0* = x0 f 0 / f 0 = 1.7895, f x0* = 0.3177 , x1 = x0* f x0* / f 0 = 1.7226.


n = 1:
x1 = 1.7226,
f 1 = 0.1332,
f1 = 6.4569
x1* = x1 f 1 / f 1 = 1.7432, f x1* = 0.0016, x 2 = x1* f x 0* / f 1 = 1.7430.

3. (a) We have f ( x, y ) = 2 x 3 + 4 y 3 20, g ( x, y ) = 4 x 2 + 5 y 2 21 and


6 x n2
f / y

=
g / y n 8 x n

f / x
J n = Jacobian matrix =
g / x
J

1
n

1 10 y n
=
D 8 x n

12 y n2

10 y n

12 y n2
2
2
, D = 60 x n y n 96 x n y n .
2
6 x n

2 x n3 + 4 y n3 20
x n +1 x n
1
, we obtain
= J n
Using Newtons method
4 x 2 + 5 y 2 21
y
y
n +1 n
n
n

n = 0:

x0 = 1.9,

y 0 = 0.9,

x1 1.9
1 9
=

y1 0.9 47.196 15.2

n = 1:

x1 = 2.0249,

D = 47.196

9.72 3.366 2.0249


=
21.66 2.51 0.9678

y1 = 0.9678,

x 2 2.0249
9.678
1
=

y 2 0.9678 56.0184 16.1992


(b)

D = 56.0184
11.2396 0.2310 2.0019
=
24.6013 0.0841 0.9917

The iteration matrix associated with the Gauss-Jacobi iteration method is given by

H = D

(L + U )

3
0
0

0
1
0

0
0
7

0
- 4

-6
0
-3

2
- 1
0

37

1/3
= 0
0

0 0
0 4
1/7 - 1

0
1
0

- 2 0
1 = 4
0 - 1/7

6
0
3

0
3/7

- 2/3
1
0

The eigen values of H are obtained from H I = 4

3/7

- 1/7
We obtain 213 179 + 30 = 0

- 2/3
1 =0

( + 3)(212 63 + 10) = 0

or

The eigen values of H are -3, 2.8318, 0.1682


The spectral radius is (H ) = 3 > 1 . Hence, the method diverges.

u11

4. (a) Let U = 0
0
14
- 7

15

u13
u 23 . From A = U U T , we get
u 33

u12
u 22
0

15 u11
- 10 = 0
25 0

-7
5
- 10

u13 u11
u 23 u12
u 33 u13

u12
u 22
0

u112 + u122 + u132

= u12 u 22 + u13u 23
u u
13 33

u 22
u 23

u13u 33

u 23u 33

2
u 33

u12 u 22 + u13 u 23
2
22

u +u

0
0
u 33

2
23

u 23 u 33

Comparing element by element, we get


2
u 33
= 25 u 33 = 5 , u 23u 33 = 10 u 23 = 2

third column:

u13 u 33 = 15 u13 = 5
2
2
2
u 22
+ u 23
= 5 u 22
= 1 or u 22 = 1

second column:

u12 u 22 + u13u 23 = -7 u12 = -1


u112 + u122 + u132 = 14 u112 = 4 or u11 = 2

first column:

2
Hence, U = 0
0
Now,

1
0

3
- 2 and U 1 =
5

-1

A 1 = U U T

( )

= UT

1 / 2
0

1/2
1
0

- 1/10
2/5
1/5

( )

U 1 = U 1 U 1 . We obtain

38

1 / 2
= 1/2
- 1/10

0 1 / 2
0 0
1/5 0

0
1
2/5

1 / 4
= 1/4
- 1/20

1/2
1
0

- 1/10
2/5
1/5

25
1

7/20 =
25
100
- 5
21/100

1/4

- 1/20

5/4
7/20

-5
35
21

25
125
35

(b) From the augmented matrix, we have

[A b] =

1
2
3

1
3
2

-1
5
-3

2
-3
6

3
2
1

2
3
1

-3
5
-1

6
-3
2

R2 2R1/3
R3 R1/3

3
0
0

2
5/3
1/3

-3
7
0

6
-7
0

R3 R2/5

3
0
0

2
5/3
0

-3
7
-7/5

6
-7
7/5

R1 R3,

(pivoting)

Using back substitution, we get


x3 = 1, x 2 = 3[ 7 7 x3 ] / 5 = 0, x1 = [6 2 x 2 + 3 x3 ] / 3 = 1
5. (a) The largest off-diagonal element in magnitude in A is a13 = 4.
From tan 2 = 2a13 /(a 11 a33 ) = , we get = / 4

cos
S1 = 0
sin

Define

1 / 2
0

A 1 = S A S 1 = 0
1
- 1 / 2 0

T
1

1 / 2

= 0
- 1 / 2

0
1
0

1/ 2
0
1/ 2

- sin 1 / 2
= 0
0

cos 1/ 2

0
1
0
1/ 2
0
1/ 2

5 / 2

- 4/ 2
5 / 2

- 2
4

-2
5
-2

0
1
0

- 1/ 2

0
and
1/ 2

4 1 / 2
0

5
- 2 0
1

-2
1 1 / 2
0
5
3/ 2
-2 2

0
= - 2 2 5

0
3 / 2 0

-2

-1/ 2

1 / 2

0
3

39

Now the largest off-diagonal element in magnitude of A1 is a12 .


From tan 2 = 2a12 /(a 11 a 22 ) = , we get = / 4

cos
S 2 = sin
0

Define

1 / 2

A 2 = S T2 A 1 S 2 = 1 / 2
0

0 1 / 2

0 = 1 / 2
1 0

- sin
cos
0

-1/ 2
1/ 2
0

0 5
-2 2

0 - 2 2 5
1 0
0

(
(

0 and
1

1/ 2
1/ 2
0

0 1 / 2

0 - 1 / 2
- 3 0

1/ 2
0

)
)

1 / 2
-1/ 2
0 5 + 2 2 / 2
5 2 2 / 2 0 5 + 2 2


= 1 / 2
1/ 2
0 5 + 2 2 / 2 5 2 2 / 2 0 = 0
- 0
0
1 0
0
- 3 0


Hence, the eigen values of A are 5 + 2 2 , 5 2 2 and -3.

1
(b) We have A 3I = 1
0

0
0
1

1
1 and B = (A 3I ) = 1
- 1
1
1
T
Starting with V0 = [1,
- 1,
1] , we get
1

Y1 = B V0 = [ 2,

3,

Y2 = B V1 = [5 / 3,

- 7/ 3,

Y3 = B V2 = [ 12 / 7,

- 2] ; m1 = 3 ; V1 = Y1 / m1 = [ 2 / 3,
T

1
-1
1

0
3

0
5-2 2
0

- 1
1
0

1,

5/3] ; m 2 = 7 / 3 ; V2 = Y2 / m 2 = [5 / 7,

17/7,

0
1

1/ 2

- 2/3]

- 1,

5/7 ]

- 12/7 ] T

After three iterations, we obtain the ratios

(Y3 )r
(V2 )r

12 17 12
=
,
,
= [2.4, 3.4, 2.4]
5
5
5
We take 2.4 (we need more iterations for more accurate results.)

Hence, the largest eigen value in magnitude of B is = 2.4


The eigen value nearest to 3 of the matrix A is

= 3 (1 / ) = 3 (1 / 2.4 ) or

= 3.4167, = 2.5833

Since = 2.5833 satisfies the equation A I = 0, more accurately, the nearest


eigen value to 3 is 2.5833.
6. (a) We obtain from the given matrix

tan = a13 / a12 = 4 / 2 = 2 2

40

Therefore sin = 2 2 /3 and cos = 1 / 3


0
0

Define
cos - sin = 0
1/3
- 2 2 / 3 and
sin
cos 0
2 2 / 3 1/3
0
0
2
4 1
1
2

A 1 = S1T A S1 = 0
1 /3
2 2 / 3 2
6
2 0

0
-2 2 /3
1/3 4
2
2 0

0
0
3 2
0
1
2

= 0
1 /3
2 2 / 3 2
10 /3
- 11 2 / 3

0
-2 2 /3
1/3 4
5 2 /3
- 2/3

1
S1 = 0
0

= 3 2

3 2

b
1
- 5 2 / 3 = c1

14/3 0
0

10 /3
-5 2 /3

c1

b2

c2

c2

b3

1/3
- 2 2 / 3

2 2 / 3 1/3

which is the required tri-diagonal form. Using Sturms sequence, we obtain


f 0 = 1 , f 1 = b1 = 2
f 2 = ( b2 ) f 1 c12 f 0 = ( 10 / 3)( 2) 18 = 2 16 / 3 34 / 3

f 3 = ( b3 ) f 2 c 22 f 1 = ( 14 / 3)(2 16 / 3 34 / 3) 50( 2) / 9
= 3 102 + 8 + 64.
The characteristic equation of the given matrix is f 3 = 3 102 + 8 + 64 = 0
(b) From the given matrix, we write

[A I] =

4
1
3

1
4
2

1
-2
-4

1
0
0

0
1
0

0
0
1

R2 R1/4
R3 3R1/4

4
0
0

1
15/4
5/4

1
0
-9/4 -1/4
-19/4 -3/4

0
1
0

0
0
1

R1 4R2/15
R3 R2/3

4
0
0

0
15/4
0

8/5
-9/4
-4

16/15 -4/15 0
-1/4
1
0
-2/3
-1/3 1

R1 + 2R3/5
R2 9R3/16

41

4
0
0

1
= 0
0
Hence, A 1

0
15/4
0

0
1
0

1 / 5
= 1/30
1/6

0
0
-4

0
0
1

4/5
1/8
-2/3

1 / 5
1/30

1/6

-2/5 2/5
19/16 -9/16 R1/4, 4R2/15,
-1/3 1
-R3/4

- 1/10
19/60
1/12

1/10
- 9/60
- 1/4

1/10
12
1
2
- 9/60 =
60
10
- 1/4

- 1/10
19/60
1/12

-6
19
5

6
- 9
- 15

7. (a) We need to determine a and b such that


4

)]

I (a, b ) = x 2 a x + b / x dx = minimum. We obtain the normal equations


1

4
I
254 15a
= 2 x 2 a x b / x x dx = 0 or

2b = 0
1
a
7
2
4
15
3
I
b1
or
2a b = 0
= 2 x 2 a x dx = 0,
1
2
4
b
x x

Solving (1) and (2), we get a = 684 / 91, b = 914 / 91.

(1)
(2)

(b) Newtons backward difference interpolation is given by


f (x ) = f n +

(x xn )
h

Substituting

f n +

(x xn )(x xn 1 )
2!h

2 fn +

(x xn )(x xn 1 )(x xn 2 )
3!h

3 f n + ......

x x n = hs, we get

f ( x n + hs ) = f n + sf n +

s (s + 1) 2
s (s + 1)(s + 2 ) 3
fn +
f n + ...........
2!
3!

We obtain
df df dx
2s + 1 2
3s 2 + 6 s + 2 3
=
. = f n +
fn +
f n + .........
ds dx ds
2!
3!
Now dx/ds = h and for x = x n , we get s = 0. We obtain
df 1
1
1

(1)
= f n + 2 f n + 3 f n + ............
dx h
2
3

We now construct the backward difference table from the given data. We get for h
=1
f
x
f(x)
2 f 3 f
1
1
2
3
2
3
7
4
2
f ( x n ) =

42

4
13
6
2
0
5
21
8
2
0
Substituting in (1) for xn= 5, we obtain f (5) = [8 + (2 / 2)] = 9
8. (a) Using Lagrange interpolation formula and the given data, we get

(x + 1)x(x 1) (29) + (x + 3)x(x 1) (1)


( 3 + 1)( 3)( 3 1)
( 1 + 3)( 1)( 1 1)

p( x ) =
+
=

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


(3)(1)(1)

(1 + 3)(1 + 1)(1)

29 3
1
1
3
(
x x ) (x 3 + 2 x 2 3 x ) (x 3 + 3 x 2 x 3) + (x 3 + 4 x 2 + 3 x )
24
4
3
8

= x3 + x + 1
f (0.5) p (0.5) = (0.5) 3 + (0.5) + 1 = 1.625
(b) we have f [x 0 , x1 ] =

1
[ f (x1 ) f (x0 )] = 1
x1 x0
x1 x0

1
1
1
( 1)1
=

x0 x1
x0 x1
x1 x 0

We shall now show by induction that f [x 0 , x1 ......., x n ] = ( 1) /( x0 x1 ......x n )


n

The result is true for n = 1. Assume that the result is true for n = k, that is

f [x 0 , x1 ......., x k ] = ( 1) /( x0 x1 ......x k ) . Then for n = k + 1, we have


k

f [x 0 , x1 ......., x k , x k +1 ] =
=

1
x k +1 x0

1
{ f [x1 , x2 ,.........xk +1 ] f [x0 , x1 ,..........., x k ]}
x k +1 x0

( 1)k
( 1)k = ( 1)k +1

x1 x 2 ........x k +1 x 0 x1 ........x k x0 x1.......xk +1

Hence, the result is true for any k.


9. (a) We can write TE = f ( x0 ) [ f ( x0 + h ) f ( x0 )] / h

= f ( x 0 ) hf ( x0 ) + h 2 f ( x 0 ) / 2 + h 3 f ( x0 ) / 6 + ...........] / h
= hf (x 0 ) / 2 h 2 f ( x0 ) / 6 .........
Hence, we can write the error term as
TE = c1h + c 2 h 2 + .......... + c p h p + O h p +1 , where ci s are independent of h.

Let g ( x ) = f ( x0 ) be the exact quantity and g (h / 2 r ) denote the approximate value


of g ( x ) obtained by using the given method with step length h / 2 r , r =0, 1,
.
Thus we can write

43

g (h ) = g ( x ) + c1 h + c 2 h 2 + c3 h 3 + ..........
g (h / 2 ) = g ( x ) + c1h / 2 + c 2 h 2 / 4 + c3 h 3 / 8 + ..........
g (h / 2 2 ) = g ( x ) + c1 h / 4 + c 2 h 2 / 16 + c3 h 3 / 64 + ............

M
Eliminating c1 from the above equations, we obtain
g (1) (h ) =

c h2 3
2 g (h / 2 ) g (h )
= g ( x ) 2 c3 h 3 ............
2 1
2
4

M
g (1) (h / 2 ) =

c h2 3
2 g h / 2 2 g (h / 2 )
= g ( x ) 2 c3 h 3 ............
2 1
8
32

M
Eliminating c2 from the above equations, we get
4 g (1) (h / 2 ) g (h ) 2 2 g (1) (h / 2 ) g (1) (h)
(2 )
g (h ) =
=
+ O h3
2
4 1
2 1
Thus the successive higher order results can be obtained from the formula

( )

g (m ) (h ) =

2 m g (m 1) (h / 2 ) g (m 1) (h)
, m = 1, 2, ......... , g (0 ) (h ) = g (h )
m
2 1

Using the given formula and the given data, we obtain


h = 4:
f (1) = [ f (5) f (1)] / 4 = (125 1) / 4 = 31
h = 2:
f (1) = [ f (3) f (1)] / 2 = (27 1) / 2 = 13

h = 1:

f (1) = [ f (2) f (1)] = (8 1) = 7

We obtain the following Richardsons table


h
4
2
1

O(h)
31
13
7

O(h2)

O(h3)

-5
1

Hence, the best value of f (1) is 3.


(b). Truncation error of the given method is given by
TE = f ( x0 ) [ 3 f ( x0 ) + 4 f ( x0 + h ) f ( x0 + 2h )] /(2h)
Expanding each term in Taylor series about xo and simplifying, we get
TE =

h3
h2
f ( ), x0 < < x 2 . Hence TE
M 3 , where M 3 = max f ( x )
x x x2
3
3

If 0 , 1, 2 are round off errors in evaluating f ( x0 ), f ( x0 + h ), f ( x0 + 2h )


respectively,
then we get RE = ( 3 0 +4 1 2 ) / 2h

44

Let = max[ f 0 , 1 , 2 ] . Then RE 8 /(2h) = 4 / h


We choose h such that h 2 M 3 / 3 + 4 / h = min imum
Differentiating with respect to h and equating it to zero, we get
13
2hM 3 / 3 4 / h 2 = 0 or h = (6 / M 3 )
10. (a) Make the method exact for f ( x ) = 1, x and x 2 . We get

f ( x) = 1 :
f ( x) = x :

dx (0 + 1 + 2 ) = 0

[ (

xdx 0 3 / 5 + 2

x 2 dx 0 3 / 5

From the above equations, we obtain


f ( x) = x 2 :

)]

3/5 = 0

+ 2

2
3/5 = 0

0 + 1 + 2 = 2 , ( 0 2 ) = 0 , (0 + 2 ) = 10 / 9
Solving these equations, we get 0 = 2 = 5 / 9 and 1 = 8 / 9
It can be verified that the method produces exact results for f ( x ) = x 3 , x 4 and x 5 .
The error term is given by Error = cf vi ( ) / 6!,

1 < < 1, where

6
6
x 6 dx 0 3 / 5 + 2 3 / 5 =

2
27 2 10 27
8
(0 + 2 )
=
=
7
125 7 9 125 175
8 1 (6 )
1
Hence, Error =
f (6 ) ( ).

f ( ) =
175 720
15750

c=

(b). Using the Trapezoidal rule, we get


h = 1:

x0 = 1,

x1 = 2,

f 0 = f ( x0 ) = 1,

f 1 = f (x1 ) = 1/3

I = h[ f 0 + f 1 ] / 2 = 0.666667
h = 1/ 2 :

x0 = 1,

x1 = 3 / 2,

x2 = 2

f 0 = 1,

I = h[ f 0 + 2 f 1 + f 2 ] / 2 = 0.619048
h = 1/ 4 :
x 0 = 1, x1 = 5 / 4, x 2 = 6 / 4 x3 = 7 / 4
f 0 = 1,

f 1 = 0.571429,

f 2 = f (x2 ) = 1 / 3

x4 = 2

f 1 = 0.761905, f 2 = 0.571429
f 3 = 0.432432, f 4 = 1 / 3
I = h[ f 0 + 2( f 1 + f 2 + f 3 ) + f 4 ] / 2 = 0.608108
Using Romberg integration I (m ) (h ) =

4 m I (m 1) (h / 2 ) I (m 1) (h )
, m = 1, 2, .........
4m 1

45

we obtain the following Romberg table


h

o(h2)

o(h4)

o(h6)

0.666667
0.619048
0.608108

0.603175
0.604461

0.604547

The improved value of I is I = 0.604547


11. (a) We have y = x + y 2 , y = 1 + 2 y y , y = 2( y ) + 2 yy .
2

Third order Taylor series method is given by


y n +1 = y n + hy n + h 2 y n / 2 + h 3 y n / 6, n = 0, 1, ...........
We have h = 0.2, x0 =1, y0 =1. We obtain
n = 0 : y 0 = 1, y 0 = 2, y 0 = 5, y 0 = 18
y1 y (1.2) = y 0 + hy 0 + h 2 y 0 / 2 + h 3 y 0 / 6
= 1 + 0.2(2) + (0.2) 2 (5) / 2 + (0.2) 3 (18) / 6 = 1.524
Now x1 = 1.2, y1 = 1.524, y1 = 3.522576
y1 = 11.736812, y1 = 60.590886
y 2 y (1.4) = y1 + hy1 + h 2 y1 / 2 + h 3 y1/ 6
( 0 .2 ) 2
( 0 .2 ) 3
(11.736812) +
= 1.524 + 0.2(3.522576) +
(60.590886) = 2.544039
2
6
(b). We have x0 = 1, y 0 = 2,

f ( x, y ) = x + 2 y , h = 0.1

Using the classical fourth order Runge-Kutta method, we get


k1 = hf ( x 0 , y 0 ) = 0.1 f (1,2) = 0.223607
k 2 = hf ( x 0 + h / 2, y 0 + k1 / 2 ) = 0.1 f (1.05,2.111804) = 0.229643
k 3 = hf ( x0 + h / 2, y 0 + k 2 / 2 ) = 0.1 f (1.05,2.114822) = 0.229775
k 4 = hf ( x0 + h, y 0 + k 3 ) = 0.1 f (1.1,2.229775) = 0.235786
y1 y (1.1) = y 0 + (k1 + 2k 2 + 2k 3 + k 4 ) / 6 = 2.29705
Now, x1 = 1.1, y1 = 2.229705. we get
k1 = hf ( x1 , y1 ) = 0.1 f (1.1,2.229705) = 0.235784

k 2 = hf ( x1 + h / 2, y1 + k1 / 2 ) = 0.1 f (1.15,2.347597) = 0.241768


k 3 = hf ( x1 + h / 2, y1 + k 2 / 2 ) = 0.1 f (1.15,2.350589) = 0.241892
k 4 = hf ( x1 + h, y1 + k 3 ) = 0.1 f (1.2,2.471597) = 0.247855

46

Potrebbero piacerti anche