Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Roll No.
Model Answer
AS-2340
M.C.A. (First Semester) EXAMINATION, 2013
Programming Based Numerical Analysis
(MCA-102)
[Maximum Marks: 60
Note:
Question Number 1 is Compulsory. Answer any four from the remaining. Scientific calculators
are allowed.
Q.1
(a)
(10X2=20 Marks)
Solution.
If x is the exact root and 0 x is its approximate value of the equation
fx
fx = 0. we know that x = x
f x
fx
(c)
(e)
Solution.
Let the function y = f (x) be a function takes the values , , , , corresponding to the
values , , , , where the values of are equally spaced
Then the Newtons forward difference interpolation formula is given by
1
1 2
= + +
+
+ .
1!
2!
3!
=
(f) What are the advantages of Lagranges formula over Newtons formula?
Solution.
The forward and backward interpolation formulae of Newton can be used only when the
values of the independent variable x are equally spaced and can also be used when the
differences of the dependent variable y become smaller ultimately. But Lagranges
interpolation formula can be used whether the values of x, the independent variable are
equally spaced or not and whether the difference of y become smaller or not.
(g)
1
1
1
1
= + + .
2
3
4
1
11
= = + + .
12
1
3
= = + .
(i)
(j)
(4X10=40 Marks)
Q.2
Solution- let = 1 = 0
Since 1 = 1 3 1 + 10.6 = 8.6,
2 = 2 3 2 + 10.6 = 12.6
3 = 3 3 3 + 10.6 = 28.6
0 = 0 3 0 + 10.6 = 10.6
1 = 1 3 1 + 10.6 = 12.6
2 = 2 3 2 + 10.6 = 8.6
3 = 3 3 3 + 10.6 = 7.4
Therefore, 2 3 negative , so at least one real root will lie between -2 and -3.
2 + 3 5
=
= 2.5
2
2
First Iteration- now using Bisection Method, we can take first approximation
=
2.5 + 3 5.5
=
= 2.75
2
2
2.75 + 2.5.
= 2.625
2
2.625 + 2.75
= 2.6875
2
2.6875 + 2.625
= 2.65625
2
2.65625 + 2.625
= 2.640
2
2.640 + 2.65625
= 2.648
2
2.648 + 2.640
= 2.644
2
2.644 + 2.648
= 2.646
2
2.646 + 2.648
= 2.647
2
2.647 + 2.646
= 2.6465
2
2.6465 + 2.647
= 2.64675
2
From the above iteration, in eleventh and twelfth approximation the root matches , = 1 =
0 up to three places of decimal is -2.646, which is of desired accuracy.
Q.3
1
44 2
10
1
51 2
=
10
1
61 2
=
10
=
1
44 0 0 = 4.4
10
1
51 8.8 0 = 4.22
10
1
61 4.4 2 4.22 = 4.816
10
1
44 2
10
1
51 2
=
10
1
61 2
=
10
=
= 4.0105
= 3.0148
= 5.0955
1
44 2
10
1
51 2
=
10
1
61 2
=
10
=
= 3.0794
= 3.9746
= 4.9971
= 3.00
= 4.00
= 5.00
Q.4
+ = ,
+ = .
Let =
Solution1
So that
Since =
Writing = ,
i.e.
0
1
0
0 0
0
1
= 2,
2 1
4
= 8 3 2
4 11 1
= 1, = 4
8
= 8 = = = 4
2
4
= 4 = = = 2
2
+ = 3
= 3 4 1 = 7
+ = 2
= 2 4 4 = 14
+ = 11
11 2 1
9
=
=
7
7
+ + = 1
9
= 1 2 4 14 = 27
7
1
4
0
1
9
0
12
0
= 20
1
33
= 12
4 + = 20
= 20 4 12 = 28
9
2 + = 33
7
9
= 33 2 12 + 28
7
= 27
Hence the original system = becomes
2 1
4
12
0 7 14 = 28
0 0 27
27
2 + + 4 = 12
7 14 = 28
27 = 27
=1
28 + 141 14
=
=
=2
7
7
=2
12 2 4 1 6
=
= =3
2
2
=3
Hence the solution is = 3 = 2 = 1 Ans.
Q.5
+
.
by (i) Trapezoidal rule(ii) Simpsons 1/3 Rule (iii) Simpsons 3/8 Rule?
Solution- Solution.
Suppose in this case we divide the range of integration into 12 equal parts by taking h=1.40.2/12=0.1 now the values of the given functiom computed for each point of subdivision are as
follows:
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
1.1
1.2
1.3
1.4
(i)
Trapezoidal rule
0.19867
0.29552
0.38942
0.47943
0.56464
0.64422
0.71736
0.78333
0.84147
0.89121
0.93204
0.96356
0.98545
(ii)
f (x)dx
1.2214
1.34986
1.49182
1.64872
1.82212
2.01375
2.22554
2.4596
2.71828
3.004171
3.32012
3.6693
4.0552
3.02951
2.84935
2.79753
2.8213
2.89759
3.01464
3.16604
3.34829
3.55975
3.800071
4.06984
4.3705
4.70418
{ + 2 + + + . } + }
2
(iii)
-1.60944
-1.20397
-0.91629
-0.69315
-0.51083
-0.35667
-0.22314
-0.10536
0
0.09531
0.18232
0.26236
0.33647
0.1
81.12349 = 4.05617
2
1
h y + 4 y 2 + 2y 3 + 4 y 4 + 2y 5 + ... + 4 y 2 n + y 2 n +1
3 1
0.1
121.53251 = 4.05108
3
Q.6
3 0.1
108.03098 = 4.05116
8
Solution = x 9x + 1 = 0
1
Then differentiating with respect to x we get
2
= 3 9
Newtons iterative formula is
3
=
Since = 2 = 2 9 2 + 1 = 9 < 0
4
= 3 = 3 9 3 + 1 = 1 < 0
There exists a root of = 0 in the interval , = 2,3 . clearly the root lies
closer to = 3. taking = 2.5 as an initial approximation to the root, we
9 + 1
=
5
3 9
9 + 1
2 5 9 2.5 + 1
=
= 2.5
= 3.1026
3 2.5 9
3 9
9 + 1
3.1026 9 3.1026 + 1
=
=
3.1026
= 2.9546;
3 3.1026 9
3 9
9 + 1
2.9546 9 2.9546 + 1
=
=
2.9546
= 2.9429;
3 2.9546 9
3 9
9 + 1
2.9429 9 2.9429 + 1
=
=
2.9429
= 2.9428;
3 2.9429 9
3 9
9 + 1
2.9428 9 2.9428 + 1
=
=
2.9428
= 2.94282;
3 2.9428 9
3 9
Since = up to five decimal places, the approximate value of the root is
2.9428.
Or
= x 9x + 1 = 0
1
Then differentiating with respect to x we get
= 3 9
2
Newtons iterative formula is
3
=
Since = 2 = 2 9 2 + 1 = 9 < 0
4
= 3 = 3 9 3 + 1 = 1 < 0
There exists a root of = 0 in the interval , = 2,3. clearly the root lies
closer to = 3. taking = 3 as an initial approximation to the root, we
9 + 1 2 1
=
5
3 9
3 9
2 1 2 3 1 53
=
=
=
= 2.94
3 9 3 3 9 18
2 1 50.05521262
=
=
= 2.94282142;
3 9 17.00925925
2 1 49.97083229
=
= 2.942820058
=
3 9 16.98059389
Since = up to five decimal places, the approximate value of the root is
2.94282.
=
Note- for the above solution, check the following algorithm for minimum approximations.
Algorithm
The steps of the Newton-Raphson method to find the root of an equation f ( x ) = 0 are1. Evaluate f ( x ) symbolically.
2. Use an initial guess of the root, xi , to estimate the new value of the root, xi +1 , as
f ( xi )
xi +1 = xi
f ( xi )
xi +1 xi
100
xi +1
4. Compare the absolute relative approximate error with the pre-specified relative error
tolerance, s . If a > s , then go to Step 2, else stop the algorithm. Also, check if the
number of iterations has exceeded the maximum number of iterations allowed. If so, one
needs to terminate the algorithm and notify the user.
3. Find the absolute relative approximate error a as a =
Q.7
Here the range of integration 3,3 is subdivided into six equal parts by seven
Solution-
equidistant ordinates. So =
= 3
= + = 2
= + 2 = 1
= + 3 = 0
= + 4 = 1
= + 5 = 2
= + 6 = 3
= 81
= 16
= 1
= 0
= 1
= 16
= 81
Total
Simpsons
3/8
Rule
= 81
2 = 32
2 = 2
2 = 0
2 = 2
2 = 32
= 81
230
1
= 294 = 98
= 1
3
= = 3 3 = 97.2
5 5
{ = + 2 + + + . } + }
2
1
= 230 = 115
2
= , = = . .
Q.8
= 0, = 1, = 0.5 , =
= 0 , 0 = 0.5
1
= 0.5
0+1
1
+
1
= 0.5 0.25,1.25
2
2
1
1
= 0.5
= 0.5
= 0.33333
0.25 + 1.25
1.5
2
7
= 0 + , 0 + = 0.5 0.25,
2
2
6
= 0 + , 0 +
1
= 0.5
= 0.35294
7
0.25 +
6
= 0.5 is given by
1
= 0.26984
0.5 + 1.35294
= + +2 + 2 + )
1
= 1 + 0.5 + 0.6667 = 0.7058 + 0.2698
6
1
= 1 + 2.1423
6
= 1 + 0.35705 = 1.35705
= 0.5, = 1.35705.
Sushma Jaiswal
Assistant Professor,
Department of Computer Science & Information Technology
References1. Numerical Methods By V. Rajaraman, 3rd Edition, Prentice-Hall India Pvt. Ltd.
2. Numerical Methods By S.S. Shastri, 4th edition, 2005,PHI publications.
3. Numerical Methods in Engineering and Science, 36th Edition, Khanna Publishers,
Delhi.
4. Computer Based Numerical and Statistical techniques, P.K.Mittal and Mukesh
B.,Galgotia Publication.