To find mean , standard deviation and frequency distribution of an actual data set (Python Program)
Python Program:
# ---------------------------------------------------------------------
# Exp -1: To find mean , standard deviation and frequency distribution
# of an actual data set from any physics experiment
# ---------------------------------------------------------------------
import numpy as np # numpy related numerical python
import statistics
import matplotlib . pyplot as plt
x = [102 , 104 , 107 , 112 , 108 , 110 , 103 , 101 , 100 , 104 , 103 , 104 , 101 , 105]
print("-------------------------------------------------------")
print(" Results from Statistics Library ")
print("-------------------------------------------------------")
print (" Mean of the given data is : ", statistics . mean (x) )
print (" standerd deviation of the given data is : ", statistics . stdev (x))
print (" mode of the given data is : ", statistics.mode(x) )
print (" median of the given data is : ", statistics . median (x) )
print("-------------------------------------------------------")
print(" Results from Numpy Library ")
print("-------------------------------------------------------")
print (" mean of the given data is : ", np . mean (x))
print (" avearge of the given data is : ", np . average (x) )
print (" std . dev of the given data is : ", np . std (x ))
print (" variance of the given data is : ", np . var (x) )
print (" median of the given data is : ", np . median (x ))
print("-------------------------------------------------------")
print(" Frequency Distribution ")
print("-------------------------------------------------------")
print("________________________")
list==x
frequency=[]
smallest=min(list)
largest=max(list)
print(" X frequency ")
print("________________________")
for i in range(smallest, largest+1):
frequency=list.count(i)
print(" ",i," ", frequency)
Output:
Comments
Post a Comment