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 : SHAVEDHA Y
Reg. No. : 212221230095
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
f.append(c)
x.append(i)
sf=np.sum(f)
p=list()
for i in range(M+1):
p.append(f[i]/sf)
mean=np.inner(x,p)
EX2=np.inner(np.square(x),p)
var=EX2-mean**2
SD=np.sqrt(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)
![image](https://private-user-images.githubusercontent.com/93427376/280508781-f0866ed6-214f-4e89-86cd-9d86103aacad.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyOTEwNTQsIm5iZiI6MTcyNTI5MDc1NCwicGF0aCI6Ii85MzQyNzM3Ni8yODA1MDg3ODEtZjA4NjZlZDYtMjE0Zi00ZTg5LTg2Y2QtOWQ4NjEwM2FhY2FkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTAyVDE1MjU1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM5MTVjNjk3YjU5MzFlOGI4ZGJiMTc2ZGU2ZTk4MjA4NWEyNTYwMTJiZjE3OTc0MjEyMGUzOWI0NTgxMGZhNjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.TyzOrJvNYiMc0DrapV93uEsyPgkcleNEEUy9tMrZZBY)
The mean and variance of arrivals of objects from feeder using probability distribution are calculated.