0% found this document useful (0 votes)
2 views20 pages

Probability

The document outlines various experiments related to statistical analysis and queuing theory, including mean and variance of discrete distributions, fitting Poisson distributions, correlation and regression analysis, and single/multiple server queue models. Each section includes aims, required software, theoretical background, procedures, and sample Python programs for implementation. The results from these experiments provide insights into the behavior of systems modeled by these statistical methods.

Uploaded by

rohithrohith4414
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)
2 views20 pages

Probability

The document outlines various experiments related to statistical analysis and queuing theory, including mean and variance of discrete distributions, fitting Poisson distributions, correlation and regression analysis, and single/multiple server queue models. Each section includes aims, required software, theoretical background, procedures, and sample Python programs for implementation. The results from these experiments provide insights into the behavior of systems modeled by these statistical methods.

Uploaded by

rohithrohith4414
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

S. No Date Experiment Pg.

Marks Sign
No
1. Mean and Variance of a Discrete Distribution

2. Fitting Poisson Distribution

3. Correlation and Regression for Data Analysis

4. Single Server With Infinite Capacity-(𝑀/𝑀/1):(∞/ 𝐹𝐼𝐹𝑂)

5. Multiple Server With Infinite Capacity-(𝑀/𝑀/𝑐):(∞/ 𝐹𝐼𝐹𝑂)

6. Series Queues with Infinite Capacity- Open Jackson Network


11/19/24, 5:52 PM Mean-and-Variance/[Link] at main · Rohithravi333/Mean-and-Variance

Mean and variance of a discrete distribution


Aim :
To find mean and variance of arrival of objects from the feeder using probability distribution

Software required :
Python and Visual components tool

Theory:
The expectation or the mean of a discrete random variable is a weighted average of all possible
values of the random variable. The weights are the probabilities associated with the corresponding
values. It is calculated as,

The variance of a random variable shows the variability or the scatterings of the random variables. It
shows the distance of a random variable from its mean. It is calcualted as

Procedure :
1. Construct frequency distribution for the data
2. Find the probability distribution from frequency distribution.
3. Calculate mean using

4. Find

5. Calculate variance using

Experiment :

[Link] 1/3
11/19/24, 5:52 PM Mean-and-Variance/[Link] at main · Rohithravi333/Mean-and-Variance

Program :
/* Name : Rohith R
Reg No : 212222230121 */

import numpy as np
L=[int(i) for i in input().split()]
N=len(L); M=max(L)
x=list();f=list()
for i in range (M+1):
c = 0
for j in range(N):
if L[j]==i:
c=c+1
[Link](c)
[Link](i)
sf=[Link](f)
p=list()
for i in range(M+1):
[Link](f[i]/sf)
mean=[Link](x,p)
EX2=[Link]([Link](x),p)
var=EX2-mean**2
SD=[Link](var)
print("The Mean arrival rate is %.3f "%mean)
print("The Variance of arrival from feeder is %.3f "%var)
print("The Standard deviation of arrival from feeder is %.3F "%SD)

Output :

[Link] 2/3
11/19/24, 5:52 PM Mean-and-Variance/[Link] at main · Rohithravi333/Mean-and-Variance

Results :
The mean and variance of arrivals of objects from feeder using probability distribution are
calculated.

[Link] 3/3
11/19/24, 5:56 PM Poisson_distribution/[Link] at main · Rohithravi333/Poisson_distribution

Fitting Poisson distribution


Aim :
To fit poisson distribution for the arrival of objects per minute from the feeder

Software required :
Python and Visual component tool

Theory:
The Poisson distribution is the discrete probability distribution of the number of events occurring in
a given time period, given the average number of times the event occurs over that time period.

Conditions for Poisson Distribution:


1. An event can occur any number of times during a time period.
2. Events occur independently. I
3. The rate of occurrence is constant.
4. The probability of an event occurring is proportional to the length of the time period.

Procedure :

Experiment :

[Link] 1/3
11/19/24, 5:56 PM Poisson_distribution/[Link] at main · Rohithravi333/Poisson_distribution

Program :
##Name: Rohith R
##Register Number:212222230121

import numpy as np
import math
import [Link]
L=[int(i) for i in input().split()]
N=len(L); M=max(L)
X=list();f=list()
for i in range (M+1):
c = 0
for j in range(N):
if L[j]==i:
c=c+1
[Link](c)
[Link](i)
sf=[Link](f)
p=list()
for i in range(M+1):
[Link](f[i]/sf)
mean=[Link](X,p)
p=list();E=list();xi=list()
print("X P(X=x) [Link] [Link] xi")
print("--------------------------")
for x in range(M+1):
[Link]([Link](-mean)*mean**x/[Link](x))
[Link](p[x]*sf)
[Link]((f[x]-E[x])**2/E[x])
print("%2.2f %2.3f %4.2f %3.2f %3.2f"%(x,p[x],f[x],E[x],xi[x]))
print("--------------------------")
cal_chi2_sq=[Link](xi)
print("Calculated value of Chi square is %4.2f"%cal_chi2_sq)
table_chi2=[Link](1-.01,df=M)
print("Table value of chi square at 1 level is %4.2f"%table_chi2)
if cal_chi2_sq<table_chi2:

[Link] 2/3
11/19/24, 5:56 PM Poisson_distribution/[Link] at main · Rohithravi333/Poisson_distribution

print("The given data can be fitted in poisson Distribution at 1% LOS")


else:
print("The given data cannot be fitted in Poisson Distribution at 1% LOS")

Output :

Results
The Poisson distribution is fitted for the objects arrived from feeder per minute and the data is
tested using Chi-square test.

[Link] 3/3
11/19/24, 5:58 PM Correlation_Regression/[Link] at main · Rohithravi333/Correlation_Regression

Correlation and regression for data


analysis
Aim :
To analyse given data using coeffificient of correlation and regression line

Software required :
Python

Theory:
Correlation describes the strength of an association between two variables, and is
completely symmetrical, the correlation between A and B is the same as the
correlation between B and A. However, if the two variables are related it means that
when one changes by a certain amount the other changes on an average by a certain
amount.
If y represents the dependent variable and x the independent variable, this
relationship is described as the regression of y on x. The relationship can be
represented by a simple equation called the regression equation. The regression
equation representing how much y changes with any given change of x can be used
to construct a regression line on a scatter diagram, and in the simplest case this is
assumed to be a straight line.

Procedure :

[Link] 1/3
11/19/24, 5:58 PM Correlation_Regression/[Link] at main · Rohithravi333/Correlation_Regression

Program :
/* Name : Rohith R
Reg No : 212222230121 */

import numpy as np
import math
import [Link] as plt
x=[ int(i) for i in input().split()]
y=[ int(i) for i in input().split()]
N=len(x)
Sx=0
Sy=0
Sxy=0
Sx2=0
Sy2=0
for i in range(0,N):
Sx=Sx+x[i]
Sy=Sy+y[i]
Sxy=Sxy+x[i]*y[i]
Sx2=Sx2+x[i]**2
Sy2=Sy2+y[i]**2
r=(N*Sxy-Sx*Sy)/([Link](N*Sx2-Sx**2)*[Link](N*Sy2-Sy**2))
print("The Correlation coefficient is %0.3f"%r)
byx=(N*Sxy-Sx*Sy)/(N*Sx2-Sx**2)
xmean=Sx/N
ymean=Sy/N
print("The Regression line Y on X is ::: y = %0.3f + %0.3f (x-%0.3f)"%(ymea
[Link](x,y)
def Reg(x):
return ymean + byx*(x-xmean)
x=[Link](20,80,51)
y1=Reg(x)
[Link](x,y1,'r')
[Link]('x-data')
[Link]('y-data')
[Link](['Regression Line','Data points'])

Result

[Link] 2/3
11/19/24, 5:58 PM Correlation_Regression/[Link] at main · Rohithravi333/Correlation_Regression

Output
The Correlation and regression for data analysis of objects from feeder using
probability distribution are calculated.

[Link] 3/3
11/19/24, 6:38 PM Single-server-infinite-capacity---Markov-Model/[Link] at main · Rohithravi333/Single-server-infinite-capacity---Markov-…

Single server with infinite capacity (M/M/1):


(oo/FIFO)
Aim :
To find (a) average number of materials in the system (b) average number of materials in the
conveyor (c) waiting time of each material in the system (d) waiting time of each material in the
conveyor, if the arrival of materials follow poisson process with the mean interval time 12 seconds,
serivice time of lathe machine follows exponential distribution with mean serice time 1 second and
average service time of robot is 7seconds.
Software required :
Visual components and Python
Theory:
Queuing are the most frequently encountered problems in everyday life. For example, queue at a
cafeteria, library, bank, etc. Common to all of these cases are the arrivals of objects requiring service
and the attendant delays when the service mechanism is busy. Waiting lines cannot be eliminated
completely, but suitable techniques can be used to reduce the waiting time of an object in the
system. A long waiting line may result in loss of customers to an organization. Waiting time can be
reduced by providing additional service facilities, but it may result in an increase in the idle time of
the service mechanism.

This is a queuing model in which the arrival is Marcovian and departure distribution is also
Marcovian,number of server is one and size of the queue is also Marcovian,[Link] server is one and
size of the queue is infinite and service discipline is 1st come 1st serve(FCFS) and the calling source
is also finite.
Procedure :

Experiment:

[Link] 1/3
11/19/24, 6:38 PM Single-server-infinite-capacity---Markov-Model/[Link] at main · Rohithravi333/Single-server-infinite-capacity---Markov-…

Program
Developed by: Rohith R
Register number: 21222220121
arr_time=float(input("Enter the mean inter arrival time of objects from Feeder (in secs)
ser_time=float(input("Enter the mean inter service time of Lathe Machine (in secs) : "
Robot_time=float(input("Enter the Additional time taken for the Robot (in secs) : "))
lam=1/arr_time
mu=1/(ser_time+Robot_time)
print("--------------------------------------------------------------")
print("Single Server with Infinite Capacity - (M/M/1):(oo/FIFO)")
print("--------------------------------------------------------------")
print("The mean arrival rate per second : %0.2f "%lam)
print("The mean service rate per second : %0.2f "%mu)
if (lam < mu):
Ls=lam/(mu-lam)
Lq=Ls-lam/mu
Ws=Ls/lam
Wq=Lq/lam
print("Average number of objects in the system : %0.2f "%Ls)
print("Average number of objects in the conveyor : %0.2f "%Lq)
print("Average waiting time of an object in the system : %0.2f secs"%Ws)
print("Average waiting time of an object in the conveyor : %0.2f secs"%Wq)
print("Probability that the system is busy : %0.2f "%(lam/mu) )
print("Probability that the system is empty : %0.2f "%(1-lam/mu) )
else:
print("Warning! Objects Over flow will happen in the conveyor")
print("---------------------------------------------------------------")

Output :

[Link] 2/3
11/19/24, 6:38 PM Single-server-infinite-capacity---Markov-Model/[Link] at main · Rohithravi333/Single-server-infinite-capacity---Markov-…

Result :
The average number of material in the sysytem and in the conveyor and waiting time are
successfully found.

[Link] 3/3
11/19/24, 6:42 PM Muttiple-capacity-with-infinite-capacity/[Link] at main · Rohithravi333/Muttiple-capacity-with-infinite-capacity

Multiple server with infinite capacity - (M/M/c):


(oo/FIFO)
Aim :
To find (a) average number of materials in the system (b) average number of materials in the
conveyor (c) waiting time of each material in the system (d) waiting time of each material in the
conveyor, if the arrival of materials follow poisson process with the mean interval time 10 seconds,
serivice time of two lathe machine follow exponential distribution with mean serice time 1 second
and average service time of robot is 7seconds.
Software required :
Visual components and Python
Theory:
Queuing are the most frequently encountered problems in everyday life. For example, queue at a
cafeteria, library, bank, etc. Common to all of these cases are the arrivals of objects requiring service
and the attendant delays when the service mechanism is busy. Waiting lines cannot be eliminated
completely, but suitable techniques can be used to reduce the waiting time of an object in the
system. A long waiting line may result in loss of customers to an organization. Waiting time can be
reduced by providing additional service facilities, but it may result in an increase in the idle time of
the service mechanism.

Procedure :

[Link] 1/3
11/19/24, 6:42 PM Muttiple-capacity-with-infinite-capacity/[Link] at main · Rohithravi333/Muttiple-capacity-with-infinite-capacity

Experiment:

Program:
/* Name : Rohith R
Reg No : 212222230121 */

import math
arr_time=float(input("Enter the mean inter arrival time of objects from Feeder (in secs)
ser_time=float(input("Enter the mean inter service time of Lathe Machine (in secs) : "
Robot_time=float(input("Enter the Additional time taken for the Robot (in secs) : "))
c=int(input("Number of service centre : "))
[Link] 2/3
11/19/24, 6:42 PM Muttiple-capacity-with-infinite-capacity/[Link] at main · Rohithravi333/Muttiple-capacity-with-infinite-capacity

lam=1/arr_time
mu=1/(ser_time+Robot_time)
print("--------------------------------------------------------------")
print("Multiple Server with Infinite Capacity - (M/M/c):(oo/FIFO)")
print("--------------------------------------------------------------")
print("The mean arrival rate per second : %0.2f "%lam)
print("The mean service rate per second : %0.2f "%mu)
rho=lam/(c*mu)
sum=(lam/mu)**c*(1/(1-rho))/[Link](c)
for i in range(0,c):
sum=sum+(lam/mu)**i/[Link](i)
P0=1/sum
if (rho<1):
Lq=(P0/[Link](c))*(1/c)*(lam/mu)**(c+1)/(1-rho)**2
Ls=Lq+lam/mu
Ws=Ls/lam
Wq=Lq/lam
print("Average number of objects in the system : %0.2f "%Ls)
print("Average number of objects in the conveyor : %0.2f "%Lq)
print("Average waiting time of an object in the system : %0.2f secs"%Ws)
print("Average waiting time of an object in the conveyor : %0.2f secs"%Wq)
print("Probability that the system is busy : %0.2f "%(rho))
print("Probability that the system is empty : %0.2f "%(1-rho))
else:
print("Warning! Objects Over flow will happen in the conveyor")
print("--------------------------------------------------------------")

Output :

Result :
Thus, the average number of materials in the system and conveyor, waiting time of each material in
the system and conveyor is found successfully.

[Link] 3/3
11/19/24, 6:45 PM Open-Jacson-Networks/[Link] at main · Rohithravi333/Open-Jacson-Networks

Series Queues with infinite capacity - Open


Jackson Network
Aim :
To find (a) average number of materials in the system (b) average number of materials in the each
conveyor of (c) waiting time of each material in the system (d) waiting time of each material in each
conveyor, if the arrival of materials follow Poisson process with the mean interval time 12 seconds,
service time of lathe machine in series follow exponential distribution with service time 1 second,
1.5 seconds and 1.3 seconds respectively and average service time of robot is 7 seconds.
Software required :
Visual components and Python
Theory

Procedure :

Experiment:

[Link] 1/4
11/19/24, 6:45 PM Open-Jacson-Networks/[Link] at main · Rohithravi333/Open-Jacson-Networks

Program
Name : Rohith R
Register Number : 212222230121
arr_time=float(input("Enter the mean inter arrival time of objects from Feeder (in secs)
ser_time1=float(input("Enter the mean inter service time of Lathe Machine 1 (in secs) :
ser_time2=float(input("Enter the mean inter service time of Lathe Machine 2 (in secs) :
ser_time3=float(input("Enter the mean inter service time of Lathe Machine 3 (in secs) :
Robot_time=float(input("Enter the Additional time taken for the Robot (in secs) : "))
lam=1/arr_time

[Link] 2/4
11/19/24, 6:45 PM Open-Jacson-Networks/[Link] at main · Rohithravi333/Open-Jacson-Networks

mu1=1/(ser_time1+Robot_time)
mu2=1/(ser_time2+Robot_time)
mu3=1/(ser_time3+Robot_time)
print("-----------------------------------------------------------------------")
print("Series Queues with infinite capacity- Open Jackson Network")
print("-----------------------------------------------------------------------")
if (lam < mu1) and (lam < mu2) and (lam < mu3):
Ls1=lam/(mu1-lam)
Ls2=lam/(mu2-lam)
Ls3=lam/(mu3-lam)
Ls=Ls1+Ls2+Ls3
Lq1=Ls1-lam/mu1
Lq2=Ls2-lam/mu2
Lq3=Ls3-lam/mu3
Wq1=Lq1/lam
Wq2=Lq2/lam
Wq3=Lq3/lam
Ws=Ls/(3*lam)
print("Average number of objects in the system S1 : %0.2f "%Ls1)
print("Average number of objects in the system S2 : %0.2f "%Ls2)
print("Average number of objects in the system S3 : %0.2f "%Ls3)
print("Average number of objects in the overall system : %0.2f "%Ls)
print("Average number of objects in the conveyor S1 : %0.2f "%Lq1)
print("Average number of objects in the conveyor S2 : %0.2f "%Lq2)
print("Average number of objects in the conveyor S3 : %0.2f "%Lq3)
print("Average waiting time of an object in the conveyor S1 : %0.2f secs"%Wq1)
print("Average waiting time of an object in the conveyor S2 : %0.2f secs"%Wq2)
print("Average waiting time of an object in the conveyor S3 : %0.2f secs"%Wq3)
else:
print("Warning! Objects Over flow will happen in the conveyor")
print("----------------------------------------------------------------------")

Output

[Link] 3/4
11/19/24, 6:45 PM Open-Jacson-Networks/[Link] at main · Rohithravi333/Open-Jacson-Networks

Result
The average number of material in the sysytem and in the conveyor and waiting time are
successfully found.

[Link] 4/4

You might also like