Posts

Showing posts with the label geometric mean

Arithmetic, geometric, harmonic means calculation

# #    Mean_A is weighted arithmetic mean calculation. #    Mean_G is weighted geometric mean calculation. #    Mean_H is weighted harmonic average calculation. #    f[i] - weight data point x[i] #    x[i] - data point i in dataset #    Nr  - lenght dataset # Nr = int(input('Lenght dataset is:')) # # ********** Initialization list ************ # def Initialization_list(nr, string_mane):     termx = ['0']*nr     print(string_mane)     i = 0     while i < nr:         termx[i] = input('Term in dataset is:')         i = i + 1     return termx # # ********** Harmonic wighted mean calculation ************ # def Harmonic_mean(nr, termx, termf):     suma_xf = 0     suma_f = 0     i = 0     while i < nr:         suma_xf = suma_xf +  float(termf [i])/float(termx [i])   ...