Part B
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
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;
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
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
@I 1 1 1
= c1 + c2 + = 0 [1]
@c1 3 5 12
@I 1 1 1
= c1 + c2 + = 0 : [1]
@c2 5 7 20
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
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
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
Page 6