MC0074 Sem3 Smu 2011

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 17

MC0074 – Statistical and Numerical methods using C++

Book ID: B0812

1. A box contains 74 brass washers, 86 steel washers and 40 aluminum washers,


Three washers are drawn at random from the box without replacement. Determine
the probability that all three are steel washers.

Ans:

Total number of washers in the box=74+86+40=200


The number of elements in the sample space S=n(S)=the number of ways in which three washers are
drawn together at random out of the these 200 washers
200
C3=200x199x198/3x2x1

Let E be the event of drawing one brass, one steel, one aluminum washer, then the number of element
in E=n(E)=the number of ways in which 3 steel washer can be drawn out of 86 steel washers
=86x85x84/3x2x1

The required probability= P(E)=n(E)/n(S)=86x85x84/200x199x198=0.07792

2. Discuss and define the Correlation coefficient with the suitable example.

Ans:

Correlation coefficient

Correlation is one of the most widely used statistical techniques. Whenever two variable are so
related that a change in one variable result in a direct or inverse change in the other and also
greater the magnitude of change in one variable corresponds to greater the magnitude of change
in the other, then the variable are said to be correlated or the relationship between the variables is
known as correlation.

We have been concerned with associating parameters such as E(x) and V(X) with the distribution
of one-dimensional random variable. If we have a two-dimensional random variable (X,Y), an
analogous problem is encountered.

Definition

Let (X, Y) be a two-dimensional random variable. We define ρxy, the correlation coefficient,
between X and Y, as follows:

ρxy =

The numerator of ρ, is called the covariance of X and Y.


MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

Example

Suppose that the two-dimensional random variable (X, Y) is uniformly distributed over the
triangular region

R = {(x, y) | 0 < x < y < 1}

The pdf is given as

f(x, y) = 2, (x, y) R,

= 0, elsewhere.

Thus the marginal pdf’s of X and of Y are

g(x) =

2 (1 – x), 0 x 1

h(y) =

= 2y, 0 y 1

Therefore

E(X) = , E(Y) =

E(X2) = , E(Y2) =

V(X) = E(X2) – (E(X))2 = V(Y) = E(Y2) – (E(Y))2 =

E(XY) =

Hence
MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

ρxy = =

3. If x is normally distributed with zero mean and unit variance, find the expectation
2
and variance of σ .

Ans:

Solution

The equation of the normal curve is

If mean is zero and variance is unit, then putting m=0 and ,the above equation reduced to

Expectation of x2 i.e.

= (i)
MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

Integrating by parts taking x as first function and remembering that

Putting

Hence

=1 (ii)
MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

Integrating by parts taking x3 as first function

=3

=3(1) with the help of (ii)

Variance of x2 =

= 3-(1)2

=2
MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

4. The sales in a particular department store for the last five years is given in the
following table

Years 1974 1976 1978 1980 1982


Sales (in 40 43 48 52 57
lakhs)

Estimate the sales for the year 1979.

Ans:

Newton’s backward difference table is

We have

   p =

2 3 4
yn = 5, yn = 1, yn = 2, yn = 5

Newton’s interpolati0on formula gives

y1979 = 57 + (-1.5) 5 +
MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

         = 57 – 7.5 + 0.375 + 0.125 + 0.1172

 y1979 = 50.1172

5. Find out the geometric mean of the following series

Class 0-10 10-20 20-30 30-40 40-50

Frequency 17 10 11 15 8

Ans:

Here we have

Class Frequency(f) Mid value(x) Log x f.(Logx)

0-10 17 5 .6990 11.883

10-20 10 15 1.1761 11.761

20-30 11 25 1.3979 15.3769

30-40 15 35 1.5441 23.1615

40-50 8 45 1.6532 13.2256

N=61 Sum=75.408

If F be the required geometric mean, then

Log G =

           = 1/61(75.408)

           = 1.236197
MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

       G = antilog 1.23

           = 16.28

6. Find the equation of regression line of x on y from the following data

x 0 1 2 3 4

y 1 12 27 10 30
0

Ans:

sum(X) = 0+1+2+3+4 = 10
sum(X²) = 0²+1²+2²+3²+4² = 30
sum(Y) = 10+12+27+10+30 = 89
sum(Y²) = 10²+12²+27²+10²+30² = 1973
sum(XY) = 0.10 + 1.12 + 2.27 + 3.10 + 4.30 = 10.89

n =5
Xbar = sumX / n = 10 / 5 = 2
Ybar = sumY / n = 89 / 5 = 17.8

gradient m = [ n sumXY - sumX sumY ] / [ n sumX² - (sumX)² ]


= (5.10.89 - 10.89) / (5.30 - 10²)
= (54.45 - 890) / (150 - 100)
= -835.55 / 50
= -16.711

Equation is y = mx + c
Ybar = m.Xbar + c
17.8 =-16.711(2) + c
c = 17.8 +33.422 = 51.222
MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

Therefore the equation of the regressed line is y = (-16.711)x + 51.222

Set 2

1. Briefly explain the concept of Bernoulli’s process


Ans:

Consider a sequence of independent Bernoulli trials and let the discrete random variable
Yi denote the result of the ith trial, so that the event [Yi =1] denotes a success on the ith
trial and the event[Yi = 0] denotes a failure on the ith trial. Further assume that the
probability of success on the ith trial, P[Yi = 1], is p, which is independent of the index i.
then {Yi|i=1,2…n} is a discrete state, discrete parameter, stochastic process, which is
stationary in the strict sence. Since the Yi’s are mutually independent, the above process
is an independent process known as the Bernoulli process. Since Yi is a Bernoulli random
variable, we recall that

E[Yi] = p

E[Yi2] = p

Var[Yi] = p(1-p)

and GYi(z) = (1-p)+pz

based on the Bernoulli process, we may form another stochastic process by considering

the sequence of partial sums{Sn|n=1,2…}, where Sn=Y1+Y2+…+Yn. by rewriting Sn=Sn-


1+Yn, it is not difficult to see that {Sn} is a discrete state, discrete parameter Markov

process, since

P(Sn =k|Sn-1 = K) = P(Yn=0)


1-p
And
P(Sn=K|Sn-1 = K-1) = P(Yn =1)
=p
Clearly
P(Sn=K) = (n) pk(1-p)n-k
= (k)
MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

E[Sn]=np
Var[Sn]=np(1-p)
and
GSn(z) = (1-p+pz)n

Define the discrete random variable T1, called the first order interarrival time, to be the

number of trials up to and including the first success.

T1 is geometrically distributed so that

P(Ti=i) = p(1-p)i-1, i=1,2…

E(T1)=1/p

Var(T1) = 1-p/p2

and

[GT1(z) = zp/1-z(1-p)]

Similarly

[GTr(z) =[ zp/1-z(1-p)]r]

2
2. If 3 is approximated by 0.667, find the absolute and relative errors?
Ans –

Absolute, relative and percentage errors

An error is usually quantified in two different but related ways. One is known as absolute error
and the other is called relative error.

Let us suppose that true value of a data item is denoted by xt and its approximate value is
denoted by xa. Then, they are related as follows:

True value xt = Approximate value xa + Error

The error is then given by:

Error = xt - xa

The error may be negative or positive depending on the values of xt and xa. In error analysis,
what is important is the magnitude of the error and not the sign and, therefore, we normally
consider what is known as absolute error which is denoted by
MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

ea = | xt – xa |

In general absolute error is the numerical difference between the true value of a quantity and its
approximate value.

In many cases, absolute error may not reflect its influence correctly as it does not take into
account the order of magnitude of the value. In view of this, the concept of relative error is
introduced which is nothing but the normalized absolute error. The relative error is defined as

er =

absolute error of 2/3= 0.001666666...


relative error of 2/3 = 0.0024999 approx

3. If Δ , ∇ , δ denote forward, backward and central difference operator, E and μ are


respectively the shift and average operators, in the analysis of data with equal spacing h, show
that

2
δ2
(1) 1 + δ2 μ2 =
( ) 1+
2

(2) E1/2 =
( μ+ δ2 )
δ2 δ2
(3)
Δ= +δ 1+
2 4 √ ( )
Ans:

From the definition of operators, we have


MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

      =

Therefore

1+

              =                                                                                                    (1)

Also

=                                                                                                    (2)

From equation (1) and (2)

1 + δ2 μ2 =

(2)      Now

   

(3)      We have


MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

= +

                             =

                             =

                            = E – 1

Thus we get

 =

5. Find Newton’s difference interpolation polynomial for the following data:


x 0.1 0.2 0.3 0.4 0.5
f(x) 1.40 1.56 1.76 2.00 2.28
Ans:

Forward difference table

Here
MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

p=

We have Newton’s forward interpolation formula as

y=  

                                                                 (1)

From the table substitute all the values in equation (1)

y = 1.40 + (10x – 1) (0.16) +

y = 2x2 + x + 1.28

This is the required Newton’s interpolating polynomial.


MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

4. Find a real root of the equation x3 – 4x – 9 = 0 using the bisection method

Ans –
First Let x0 be 1 and x1 be 3
F(x0) = x3 – 4x -9

=1– 4– 9
= -12 < 0
F(x1) =27 – 12 – 9
=6> 0

Therefore, the root lies between 1 and 3


Now we try with x2 =2
F(x2) = 8 – 8 – 9

= -9 < 0
Therefore, the root lies between 2 and 3
X3

= (x1+x2)/2
=(3+2)/2
= 2.5

F(x3) = 15.625 – 10 – 9

= - 3.375 < 0
Therefore, the root lies between 2.5 and 3
X4

= (x1+x3)/2
= 2.75
MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

∫ 1+dxx2
6. Evaluate 0 using Trapezoidal rule with h = 0.2. Hence determine the value of π.

Ans:

,                                       

which is known as the trapezoidal rule.  

The trapezoidal rule uses trapezoids to approximate the curve on a subinterval. The area of a trapezoid
is the width times the average height, given by the sum of the function values at the endpoints, divided
by two.

Therefore:

0.2( f(0) + 2f(0.2) + 2f(0.4) + 2f(0.6) + 2f(0.8) + f(1) ) / 2


= 0.2( 1 + 2*(0.96154) + 2(0.86207) + 2(0.73529) + 2(0.60976) + 0.5) / 2
= 0.78373     

The integrand is the derivative of the inverse tangent function. In particular, if we integrate from 0 to 1,
the answer is pi/4 . Consequently we can use this integral to approximate pi.
MC0074 – Statistical and Numerical methods using C++
Book ID: B0812

Multiplying by four, we get an approximation for pi:


3.1349

You might also like