def p1(bins, mi=-9999, ma=-9999):
   """plots and evaluates various histograms for problem 2/1
   
   arguments:
   bins -- uniform bin width (required)
   mi   -- start of first bin (optional)
   ma   -- end of last bin (optional)
   """
   import numpy as np
   import matplotlib.pyplot as plt
   import scipy.stats as st
   import my_hist
   
   x=np.array(
   [79, 89, 77, 83, 76, 91, 87, 89, 84, 68, 
    77, 73, 71, 77, 76, 77, 64, 82, 65, 46, 
    21, 77, 66, 72, 74, 65, 70, 70, 73, 76, 
    37, 63, 63, 50, 68, 64, 73, 44, 46, 33, 
    69, 61, 65, 54, 52, 77, 60, 65, 61, 26, 
    64, 49, 62, 53, 55, 62, 43, 50, 51, 54, 
    24, 37, 30, 41, 34, 31, 49, 43, 39, 48, 
    89, 33, 23, 35, 35, 14, 21, 30, 33, 26])

   mean=np.mean(x)   
   sig=np.sqrt(st.moment(x,moment=2))
   skew=st.moment(x,moment=3)/sig**3
   med=np.median(x)
   print('raw data:')
   print('mean  ',mean) 
   print('stdev ',sig)
   print('skew  ',skew)
   print('median',med)
#   print(np.sort(x))
   
   h,xx=my_hist.hist(x,bins,mi,ma,ps=1)
   
   ntot1=x.size   
   ntot2=sum(h)
   if ntot1 != ntot2:
     print('problem with N:', ntot1, ntot2)
     return  
     
   meanhist=np.dot(h,xx)/ntot2
   print('mean       (binned) = ',meanhist)
   
   sigma_n=np.sqrt(np.dot(h,(xx-meanhist)**2)/ntot2)
   print('sigma_N    (binned) = ',sigma_n)
   
   gam1=np.dot(h,(xx-meanhist)**3)/ntot2/sigma_n**3
   print('gamma_1(N) (binned) = ',gam1)

# display plot
   plt.show()
   
   return
