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

Part B

solutions

Uploaded by

f20220787
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)
32 views6 pages

Part B

solutions

Uploaded by

f20220787
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

Compre-Sol (2024-2025) - PART-B

1. For the following system of equations, compute y (0:2) and z (0:2) by using RK-4 method (take
h = 0:2):
dy
= yz + x;
dx
dz
= xz + y;
dx
with the initial conditions y (0) = 1; z (0) = .
1

Sol. We have

k1 hf1 (x0 ; y0 ; z0 ) = 0:2f1 (0; 1; 1) = 0:2;


= [1]
m1 = hf2 (x0 ; y0 ; z0 ) = 0:2f2 (0; 1; 1) = 0:2; [1]
h k1 m1
k2 = hf1 (xn + ; yn + ; zn + ) = 0:2f1 (0:1; 0:9; :
0 9) = :
0 142 ; [1]
2 2 2
h k1 m1
m2 = hf2 (xn + ; yn + ; zn + : f
) = 0 2 2 (0 1 0 9 : ; : ; : :
0 9) = 0 162 ; [1]
2 2 2
h k2 m2
k3 = hf1 (xn + ; yn + ; zn + ) = 0 1508 : ; [1]
2 2 2
h k2 m2
m3 = hf2 (xn + ; yn + ; zn + ) = 0 1674: ; [1]
2 2 2

k4 = hf1 (xn + h; yn + k3 ; zn + m3 ) = 0:1014; [1]


m4 = hf2 (xn + h; yn + k3 ; zn + m3 ) = 0:1365: [1]

Thus
1
y1 = y0 + k
[ 1 + 2( 2 + k k3 ) + k4 ] = 0:8522; [1]
2
1
z1 = z0 + m1 + 2(m2 + m3 ) + m4 ] =
[ :
0 8341 : [1]
2
2. Use Adams-Moulton’s method to approximate the value of y (1:4) as a solution of

y0 = x2 (1 + y ); y (1) = 1;

with h = 0:1. Given y (1:1) = 1:233; y (1:2) = 1:548; y (1:3) = 1:979.


Sol. The starting values for Adams-Moulton’s method are given in the table: The predictor formula

xi yi fi
1 0 2
1.1 1.233 2.702
1.2 1.548 3.669
1.3 1.979 5.035

gives
h
y4 = y3 + [55 3f f
59 2 + 37 1 f f
9 0] [2]
24
:
0 1
:
= 1 979 + :
[55(5 035) :
59(3 669) + 37(2 702) : 9(2)]
24

:
= 2 573 [3]

So f4 = f (x4 ; y4 ) = f (1:4; 2:573) = 7:004. Now the corrector formula gives
h
y4 = y3 + f
[9 4 + 19 3 f f
5 2 + f1 ] [2]
24
:
0 1
:
= 1 979 + :
[9(7 004) + 19(5 035) : : :
5(3 669) + 2 702]
24

:
= 2 575 [3]

Page 2
3. Consider the boundary-value problem

x2 y 00 + 2xy 0 6 y = x; y (0) = 0; y (1) = 0:

Find a trial function in the form y (x) = c1 1 (x) + c2 2 (x), where 1 (x) and 2 (x) are appropriate
linearly independent functions satisfying the given boundary conditions. Hence solve the boundary
value problem by using Rayleigh-Ritz method. Find the maximum absolute error in the approximate
solution within the interval [0; 1].
Sol. The given equation can be written as (x2 y 0 )0 + 6y = x. On comparing with (p(x)y 0 )0 +
q (x)y = f (x), here p(x) = x2 ; q (x) = 6 and f (x) = x. Thus the corresponding functional I [y ] can
be derived as
Z 1 Z 1

x2 y 0 (x))2 + 6y (x)] dx +
1
I [y ] = [( xy (x) dx: [1]
2 0 0

Since the boundary conditions are homogeneous, we have to take 1 and 2 satisfying zero BCs.
Thus, take 1 (x) = x(1 x) and 2 (x) = x2 (1 x). Then, we have

y (x) = c1 x(1 x) + c2 x2 (1 x): [2]

On substituting y (x) in I [y ], we get


Z 1

x2 (fc1 (1 x2 )g)2 + 6fc1 x(1 x)g2


1
I [y ] = [ 2x) + c2 (2x 3 x) + c2 x2 (1
2 0

+2 xfc1 x(1 x) + c2 x2 (1 x)g] dx


1 2 1 1 1 1
= c1 + c22 + c1 c2 + c1 + c2 : [2]
6 14 5 12 20

For the minimum of I [y ], we have

@I 1 1 1
= c1 + c2 + = 0 [1]
@c1 3 5 12

@I 1 1 1
= c1 + c2 + = 0 : [1]
@c2 5 7 20

The solution gives c1 =


1
4
; c2 = 0 and so y (x) = 1
4
x(1 x) as the first approximate solution. [2]
Note that this is same as exact solution and hence error is zero. [1]

Page 3
4. Using the nodal points x = 0;  generates Hermite’s interpolation formula to find a cubic polynomial
approximating f (x) = cos x. Then, use it to approximate f (x) at x = =2. Also, compute an error
bound for the approximation.
Sol. Given f (x) = cos x, so f 0 (x) = sin x and

x f (x) f 0 (x)
0 1 0

 1 0

Hence

Table 1: 4 M for table


x f (x) f[,] f[„] f[„ ,]
0 1

0 1
2
2 = :
0 2026

2
 :
= 0 2026
4
3 :
= 0 1290

 1
2
2
0

 1

Hence,
 

P3 (x)  f (x) = 1 + x  0 + x 2 2 4
+ x2 (x )
 2 3
x
6
2
x
4
3
= 1 + = 1 :
0 6079 x2 + 0:03225x2 x3 [2]
2 3
 

 
2 3
)P 3
2
= 1
6

2 4 3
+
4

8
= 0 [2]

x2 (x  )2 f iv ( ) x2 (x  )2 cos( )
Error: = =
4! 24

 2 2 4
Error at
2
=
4
 4
 1 =24 =
384
= 0 2537 : : [2]

Page 4
5. Consider the following boundary value problem

x2 y 00 + 2xy 0 y = 1+ x; y (0) = 0; y (1) + y 0 (1) = 0:

Using central difference formulae for the derivatives given in the equation and backward difference
formula for the boundary condition, compute y (1=3); y (2=3) and y (1). Take the uniform stepsize
h = 1=3.
Sol.
x2 y 00 + 2xy 0 y = 1 + x:
Applying second order formula
yi+1yi + yi 2 1 yi+1 yi 1
x2i +2 xi yi = 1 + xi for i = 1; 2
 
h2 
2 h
 
) yi 1 x2i hxi + yi 2x2i h2 + yi+1 x2i + hxi = (1 + xi ) h2 for i = 1; 2 [2]

       

For, i=1 y0
1

9
1

3
 1

3
+ y1
2

9
1

9
+ y2
1

9
+
1

9
= 1+
1

3
1

) 3

9
y1 + y2
2

9
=
4

3
 1

   
) 
y
9 1 +6 2 = 4 y
  
[2]

For, i=2 y1
4

9
1

3
 2

3
+ y2 2  4

9
1

9
+ y3
4

9
+
1

3
 2

3
= 1+
2

3
1

) y 2

9
1
9

9
y2 + y3
6

9
=
5

3
 1

) y 6 1 y
27 2 + 18 3 = 5 y [2]
Also; y (1) + y 0 (1) = 0
y3 y2
by applying Backward difference formula )y 3 +
h
= 0

) (1 + h) y3 y2 = 0 ) 4 3 y y
3 2 = 0 [2]
2 32 3 2 3
9 6 0y1 4
6 76 7 6 7
4 6 27 185 4y2 5 = 455

0 3 4 y3 0

)y 1 =
56
57
= :
0 9825 ; y2 =
46
57
= :
0 8070 ; y3 =
23
38
= :
0 6053 . [2]

Page 5
6. Use power method to find the numerically largest eigenvalue and associated eigenvector of the matrix
2 3
3 2 2
6 7
A = 42 2 05 ;
2 0 4

starting with X (0) = (1 1 1) ; ; T . Perform five iterations.


Sol. We have
2 32 3 2 3 2 3
3 2 2 1 7 1
6 76 7 6 7 6 7
X (1) = AX (0) = 42 2 05 415 = 445 = 7 40 57145 : [2]
2 0 4 1 6 0:8571
2 32 3 2 3 2 3
3 2 2 1 : 5 857 1
6 76 7 6 7 6 7
X (2) = AX (1) = 42 2 05 40:57145 = 43:1435 = 5:857 40:53665 [2]
2 0 4 0:8571 5:428 0:9268
2 32 3 2 3 2 3
3 2 2 1 : 5 927 1
6 76 7 6 7 6 7
X (3) = AX (2) = 42 2 05 40:53665 = 43:0735 = 5:927 40:51855 [2]
2 0 4 0:9268 5:707 0:9629
2 32 3 2 3 2 3
3 2 2 1 : 5 963 1
6 76 7 6 7 6 7
X (4) = AX (3) = 42 2 05 40:51855 = 43:0375 = 5:963 40:50935 [2]
2 0 4 0:9629 5:852 0:9814
2 32 3 2 3 2 3
3 2 2 1 : 5 981 1
6 76 7 6 7 6 7
X (5) = AX (4) = 42 2 05 40:50935 = 43:0195 = 5:981 40:50485 [2]
2 0 4 0:9814 5:926 0:9908

Page 6

You might also like