To find mean and variance of arrival of objects from the feeder using probability distribution
Python and Visual components tool
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
-
Construct frequency distribution for the data
-
Find the probability distribution from frequency distribution.
-
Calculate mean using
-
Find
-
Calculate variance using
Developed By : Javith Farkhan S
Reg No : 212221240017
import numpy as np
L=[int (i) for i in input () .split ()]
N=1en (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
f.append(c)
x .append (i)
sf=np. sum(f)
p=list()
for i in range (M+1) :
p-append(f[il/sf)
mean=p-inner(x,p)
EX2=np-inner (np. square (x), P)
var=EX2-mean**2
SD=np.sqrt(var)
print("The Hean 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)