MCSE-004
Dec 2013 Solutions
Manual
IGNOUUSER
1
ignouuser@gmail.com
1. (a) Verify the distributive property of floating point numbers i.e. prove :
a(b-c) ab – ac
a=.5555E1, b=.4545E1, c=.4535E1
Define : Truncation error, Absolute Error and Relative Error.
{
Addition/Subtraction of floating point numbers
To add/subtract 2 floating point numbers, the exponents of the two numbers must be
equal. If not the mantissa is shifted appropriately . Then the Mantissas are added
or subtracted. After that the result is normalized and the exponent is appropriately
adjusted.
Multiplication of floating point numbers
To multiply 2 floating point numbers, the mantissas are multiplied and exponents
are added. After that the resulting mantissa is normalized and the exponent is
appropriately adjusted.
}
LHS
(b-c) = .0010E1 = .1000E-1
a(b-c) = .5555E1 * .1000E-1 = .05555E0 = .5555E-1
RHS
ab = .5555E1 * .4545E1 = .2524E2
ac = .5555E1 * .4535E1 = .2519E2
ab – ac = .0005E0 = .5000E-3
Clearly LHS RHS
For definitions, please refer block.
1. (b)Find the real root of the equation x = e-x using Newton-Raphson Method. List the cases
where Newton’s Method fail.
Given x=e-x
multiplying both sides by ex and arranging, we get
xex – 1 = 0
f(x) = xex – 1
f’(x) = (1 + x)ex
Numerical and Statistical Computing Solutions Manual – Dec 2013
2
ignouuser@gmail.com
Let x0 = 1
By Newton Raphson method we have,
xn+1 = xn -
x1 = 1 - = 0.6839397
f(x1) = 0.3553424, f’(x1) = 3.337012
x2 = 0.6839397 - = 0.5774545
f(x2) = 0.028733951, f’(x2) = 2.810232
x3 = 0.5774545 - = 0.5672297
f(x3) = 0.000238786, f’(x3) = 2.763614
x4 = 0.5672297 - = 0.567143297
Since x3 and x4 are same upto 3 decimal places, 0.567 is the required root.
Method fails in the cases listed below –
i) Division by zero occurs in some cases.
let f(x) = x3 – 2x2 + 3 = 0
f’(x) = 3x2 – 4x
By Newton Raphson method we have
xn+1 = xn -
If we choose initial value x0 = 0 then we get division by zero error.
ii) Infinite loop case
In some cases, say x0 is the initial value and 1st approximation gives x1 which inturn gives
2nd approximation as x0 again and the loop continues.
Numerical and Statistical Computing Solutions Manual – Dec 2013
3
ignouuser@gmail.com
1. (c) Solve by Gauss-Seidel method.
2x1 – x2 + x3 = -1
x1 + 2x2 – x3 = 6
x1 – x2 + 2x3 = -3
correct to 3 decimal places
The given system of equations can we written as
x1 = (1/2)(-1 + x2 - x3)
x2 = (1/2)(6 - x1 + x3)
x3 = (1/2)(-3 - x1 + x2)
Let initial approximation x0, y0, z0 is 0,0,0
First approximation
x1(1) = (1/2)(-1 + 0 + 0) = - 0.5
x2(1) = (1/2)(6 + 0.5 + 0) = 3.25
x3(1) = (1/2)(-3 + 0.5 + 3.25) = 0.375
Second approximation
x1(2) = (1/2)(-1 + 3.25 – 0.375) = 0.9375
x2(2) = (1/2)(6 – 0.9375 + 0.375) = 2.71875
x3(2) = (1/2)(-2 - 0.9375 + 2.71875) = -0.60938
Similarly, we have
[x1(3), x2(3), x3(3)] = [1.164063, 2.113281, -1.02539]
[x1(4), x2(4), x3(4)] = [1.069336, 1.952637, -1.05835]
[x1(5), x2(5), x3(5)] = [1.005493, 1.968079, -1.01871]
[x1(6), x2(6), x3(6)] = [0.993393, 2.001721, -0.99972]
[x1(7), x2(7), x3(7)] = [0.996836, 2.001721, -0.99756]
[x1(8), x2(8), x3(8)] = [0.999639, 2.001402, -0.99912]
[x1(9), x2(9), x3(9)] = [1.00026, 2.00031, -0.99997]
[x1(10), x2(10), x3(10)] = [1.000143, 1.999941, -1.0001]
[x1(11), x2(11), x3(11)] = [1.000021, 1.999939, -1.00004]
Since last 2 approximations are same upto 3 decimal places.
Hence the required solution is
x1 = 1.000
x2 = 1.999
x3 = -1.000
Numerical and Statistical Computing Solutions Manual – Dec 2013
4
ignouuser@gmail.com
1. (d)Let f(x) = ln(1+x), x0 = 1 and x1 = 1.1. Use linear interpolation to calculate an approximate
value of f(1.04) and obtain a bound on the truncation error.
We have x0 = 1, x1 = 1.1
f(x0) = ln(1+x0) = 0.693147
f(x1) = ln(1+x1) = 0.741937
Lets compute Lagranges fundamental polynomials,
l0(x) = (x-x1) / (x0 – x1) = (x – 1.1)/(1 – 1.1) = (x – 1.1)/(-0.1)
l1(x) = (x-x0) / (x1 – x0) = (x – 1)/(1.1 – 1) = (x – 1)/( 0.1)
Hence Lagranges Interpolating polynomial is given by
P1(x) = l0(x)* f(x0) + l1(x)* f(x1) =- 10(x – 1.1)* 0.693147 + 10(x – 1)* 0.741937
f(1.04) = P1(1.04) = -10(1.04 – 1.1)* 0.693147 + 10(1.04– 1)* 0.741937
= 0.712663
The truncate error in linear interpolation is given by
E1(f;x) = (1/2)(x-x0)(x-x1)f”( ) where lies between 1 and 1.1
= (1/2)(x – 1)(x – 1.1)(-1/(1+x)2)
The max value of | | is 0.892857
and maximum value of (x-1)(x-1.1) occurs at (1+1.1)/2=1.05
| | | – – | * (0.892857) = 0.0011160
1. (e) Consider initial value problem
= x+y; y(0) = 1
Find y(0.2) using Runge-Kutta Method of fourth order. Also compare it with exact solution
y = -(1+x) + 2ex to find the error.
We have, x0=0, y0=1, h=0.2
Then we get,
k1=hf(x0,y0) = 0.2(0+1) = 0.2
k2 = hf(x0 + h/2,y0 + k1/2) = 0.2(0.1+ 1.1) = 0.24
k3 = hf(x0 + h/2,y0 + k2/2) = 0.2(0.1+1.12) =0.244
k4 = hf(x0 + h,y0 + k3) = 0.2(0.2+1.244) = 0.2888
Therefore
y = y0 + 1/6(k1 +2 k2 + 2 k3 + k4)
= 1 + 0.2428= 1.2428
Numerical and Statistical Computing Solutions Manual – Dec 2013
5
ignouuser@gmail.com
Given, y = -(1+x) + 2ex
Putting x = 0.2, we get y = -1.2 + 2.442806 = 1.242806
Error = 1.242806 – 1.2428 = 0.000006
2. (a) Find the interval in which the smallest positive root of the following equation
lies using Bisection Method
x3 – x – 4 = 0
Given f(x) = x3 – x – 4
f(0) = 0 – 0 – 4 = -4
f(1) = 1 – 1 – 4 = -4
f(2) = 8 – 2 – 4 = 2
Clearly f(1)*f(2)<0, hence root lies between 1 and 2
First approximation of root, x1 = (1+2)/2 = 1.5
f(1.5) = -2.125
Clearly f(1.5)*f(2)<0, hence root lies between 1.5 and 2.
Second approximation of root, x2 = (1.5+2)/2 = 1.75
f(1.75) = -0.39063
Clearly f(1.75)*f(2)<0, hence root lies between 1.75 and 2.
Third approximation of root, x3 = 1.875
f(1.875) = 0.716797
Now, f(1.875)*f(2) > 0,
Hence the interval in which smallest root lie is [1.75,2] and the root is 1.875.
2. (b) Solve the following linear system of equations using Gauss Elimination Method.
x1 + x2 + x3 = 3
4x1 + 3x2 + 4x3 = 8
9x1 + 3x2 + 4x3 = 7
Numerical and Statistical Computing Solutions Manual – Dec 2013
6
ignouuser@gmail.com
Given system of equations
x1 + x2 + x3 = 3
4x1 + 3x2 + 4x3 = 8
9x1 + 3x2 + 4x3 = 7 ..........(1)
Eliminate x1 from second equation of (1), multiply first equation by 4 and subtract it from
second equation
(3 – 4) x2 + (4 – 4) x3 = 8 – 4*3
- x2 = 8 – 12
x2 = 4
Eliminate x1 from third equation of (1), multiply first equation by 9 and subtract it from third
equation.
(3 – 9) x2 + (4 – 9) x3 = 7 – 9*3
-6 x2 + (-5 x3) = 7 - 27
6 x2 + 5 x3 = 20
Hence given system of equations become
x1 + x2 + x3 = 3
x2 = 4
6 x2 + 5 x3 = 20 .............(2)
Substituting value of x2 in third equation we get,
x3 = -4 /5 = -0.8
Substituting value of x2 , x3 in the first equation we get,
x1 = 3 – 4 –(-0.8) = -0.2
Hence the required solution is
x1 = - 0.2
x2 = 4
x3 = -0.8
2. (c) Give properties of polynomial equations.
i) A polynomial equation of degree n has n solutions.
ii) Non-real complex solution with real coefficient, if exist, occur in conjugate pairs.
iii) Descarte’s rule of signs
The number of positive real solutions of the given polynomial equation is equal to the
number of variations in signs of the polynomial.
Numerical and Statistical Computing Solutions Manual – Dec 2013
7
ignouuser@gmail.com
3. (a) The table below gives the values of tanx for 0.10 x 0.30.
x 0.10 0.15 0.20 0.25 0.30
y=tanx 0.1003 0.1511 0.2027 0.2553 0.3093
Find i) tan0.12 ii) tan0.26
First lets construct the difference table
x y=tanx Δ Δ2 Δ3 Δ4
0.1 0.1003
0.0508
0.15 0.1511 0.0008
0.0516 0.0002
0.2 0.2027 0.001 0.0002
0.0526 0.0004
0.25 0.2553 0.0014
0.054
0.3 0.3093
i) tan0.12
here, h=0.05, a=0.10, x=0.12
u=(0.12-0.10)/0.05 = 0.4
By Newton’s Forward Interpolation formula we have
tan(0.12) = f(a) + u Δ f(a) + Δ 2f(a) + Δ 3f(a) + ...
= 0.1003 + 0.4*0.0508 + 0.0008 + 0.0002
+ 0.0002
= 0.1003 + 0.02032 – 0.000096 + 0.0000128 – 0.00000832
= 0.1205
ii) tan0.26
here, h=0.05, a=0.10, x=0.26
u=(0.26-0.10)/0.05 = 3.2
By Newton’s Forward Interpolation formula we have
tan(0.26) = f(a) + u Δ f(a) + Δ 2f(a) + Δ 3f(a) + ...
= 0.1003 + 3.2*0.0508 + 0.0008 + 0.0002
+ 0.0002
= 0.1003 + 0.16256 + 0.002816 + 0.0002816 + 0.00001408
= 0.2659
Numerical and Statistical Computing Solutions Manual – Dec 2013
8
ignouuser@gmail.com
3. (b) Evaluate I = ∫ dx, correct to three decimal places using
i) Trapezoidal, and
ii) Simpson’s rule with h=0.5 and h=0.25
Here, f(x) =
The value of f(x) at x=0,0.25,0.5,0.75,1 are tabulated below.
x 0 0.25 0.50 0.75 1
f(x) 1 0.8 0.67 0.57 0.5
f0 f1 f2 f3 f4
i) Trapezoidal rule
Taking h=0.25, we have
I = (0.25/2)[ f0 + f4 + 2(f1 + f2 + f3 )]
= 0.125*(1.5 + 2*2.04) = 0.6975
ii) Simpsons rule
h = 0.25,
I = (0.25/3)[ f0 + f4 + 4(f1 + f3 ) + 2 f2]
= 0.0833 * (1.5 + 4*1.37 + 2*0.67) = 0.6930
h=0.5
we have to consider only f0, f2, f4
I = (0.5/3)[ f0 + f4 + 4* f2]
= 0.16667*(1.5 + 4*0.67) = 0.6967
3. (c) Determine the value of y when x=0.1 given that y(0) = 1 and y’ = x2 + y.
let h = 0.1/5 = 0.02
x0 = 0, y0 = 1
By Euler’s method we have
y1 = y0 + hf(x0,y0) = 1 + 0.1*(0+1) = 1.1
y2 = y1 + hf(x1,y1) = 1.1 + 0.1*(0.02*0.02 + 1.1) = 1.21004
y3 = y2 + hf(x2,y2) = 1.21004 + 0.1*(0.04*0.04 + 1.21004) = 1.331204
Numerical and Statistical Computing Solutions Manual – Dec 2013
9
ignouuser@gmail.com
y4 = y3 + hf(x3,y3) = 1.331204 + 0.1*(0.06*0.06 + 1.331204) = 1.464684
y5 = y5 + hf(x4,y4) = 1.464684 + 0.1*(0.08*0.08 + 1.464684) = 1.611792
Hence the value of y at 0.1 is 1.611792
4. (a) A problem in statistics is given to the three students A,B and C whose chances of
solving it are 1/2, 3/4 and 1/4 respectively. What is the probability that the problem will be
solved.
Given, probability that A will solve the problem P(A) = 1/2
probability that B will solve the problem P(B) = 3/4
probability that C will solve the problem P(C) = 1/4
Hence, probability that A will not solve the problem P( ̅) = 1 – 1/2 = 1/2
probability that B will not solve the problem P( ̅ ) = 1 – 3/4 = 1/4
probability that C will not solve the problem P( ̅ ) = 1 – 1/4 = 3/4
Since all events are independent, so
P(no one will solve the problem) = P( ̅)* P( ̅ )* P( ̅ ) = (1/2)*(1/4)*(3/4) = (3/32)
P(that prob will be solved) = 1 – (3/32) = 29/32.
4. (b) Calculate the correlation coefficient for the following heights (in inches) of fathers (x) and
their sons (y) :
x: 65 66 67 67 68 69 70
y: 67 68 65 68 72 72 69
The various calculations on the given data are tabulated below.
x y x-x' y-y' (x-x')*(y-y') (x-x')*(x-x') (y-y')*(y-y')
65 67 -2.42857 -1.71429 4.16326531 4225 4489
66 68 -1.42857 -0.71429 1.02040816 4356 4624
67 65 -0.42857 -3.71429 1.59183673 4489 4225
67 68 -0.42857 -0.71429 0.30612245 4489 4624
68 72 0.571429 3.285714 1.87755102 4624 5184
69 72 1.571429 3.285714 5.16326531 4761 5184
70 69 2.571429 0.285714 0.73469388 4900 4761
14.8571429 31844 33091
Numerical and Statistical Computing Solutions Manual – Dec 2013
10
ignouuser@gmail.com
where
x’ = mean value of x = 67.42857
y’ = mean value of y = 68.71429
We have the correlation coefficient
∑
r= = = 0.000457
√∑ ∑ √
4. (c) Three identical bags have the following proportion of balls.
First bag: 2 black 1 white
Second bag: 1 black 2 white
Third bad: 2 black 2 white
One of the bag is selected and one ball is drawn. It turns out to be white. What is the
probability of drawing a white ball again. The first one not been returned.
Let E = event of selection of ith bag(i=1,2,3)
A = event of drawing white ball
Then P(E1) = P(E2) = P(E3) = 1/3
Also, P(A | E1) = C(1,1)/C(3,1) = 1/3
P(A | E2) = C(2,1)/C(3,1) = 2/3
P(A | E3) = C(2,1)/C(4,1) = 1/2
Let C denote the further event of drawing another white ball.
P(C | E1 A) = 0/2 = 0
P(C | E2 A) = 1/2
P(C | E3 A) = 1/3
Hence by Bayes theorem
| | | | | |
P(C|A) = | | |
= = = 1/6
Numerical and Statistical Computing Solutions Manual – Dec 2013
11
ignouuser@gmail.com
5. (a) Evaluate ∫ [ ( √ )] using Simpsons rule with 11 points.
Here, h = (6-1)/11 = 5/11
x f(x)
1 2.0349
1+(5/11) 2.04209
1+(10/11) 2.04821
1+(15/11) 2.05364
1+(20/11) 2.05857
1+(25/11) 2.06311
1+(30/11) 2.06734
1+(35/11) 2.07132
1+(40/11) 2.07509
1+(45/11) 2.07868
1+(50/11) 2.08211
6 2.0854
By Simpsons one-third rule,
∫ [ ( √ )] = (5/33) [(2.0349 + 2.0854) + 4(2.04209 + 2.05364 + 2.06311 + 2.07132 +
2.07868) + 2(2.04821 + 2.05857 + 2.06734 + 2.07509 + 2.08211 )]
= (5/33) [4.1203 + 4(10.30884) + 2(10.33132) ]
= 10.003
Numerical and Statistical Computing Solutions Manual – Dec 2013
12
ignouuser@gmail.com
5. (b) Estimate the sale of a particular quantity for 1966 using the following table.
Year 1931 1941 1951 1961 1971 1981
Sale in 12 15 20 27 39 52
thousands
First lets construct the difference table.
Year Sale ∇ ∇2 ∇3 ∇4 ∇5
1931 12
3
1941 15 2
5 0
1951 20 2 3
7 3 -10
1961 27 5 -7
12 -4
1971 39 1
13
1981 52
here, h=1981-1971=10
a=1981
x=1966
hence, u=(1966 – 1981)/10 = - 1.5
By Newton’s Backward Interpolation formula we have
f(1966) = f(a) + u∇f(a) + ∇2f(a) + ∇3f(a) + ∇4f(a) + ...
= 52 + (-1.5)*13 + 1+ +
(-7) + (-10)
= 52 - 19.5 + 0.375 - 0.25 – 0.164 – 0.117
= 32.344
Numerical and Statistical Computing Solutions Manual – Dec 2013
13
ignouuser@gmail.com
For more solutions keep visiting
www.googledrive.com/host/0B3kSUnlvgaY4bEFVc25oNnRaVU0
or contact me at
ignouuser@gmail.com
Numerical and Statistical Computing Solutions Manual – Dec 2013