[Numpy-tickets] [NumPy] #445: normed histogram returns incorrect results

NumPy numpy-tickets@scipy....
Mon Feb 5 14:30:28 CST 2007

#445: normed histogram returns incorrect results
 Reporter:  cvwright   |       Owner:  somebody
     Type:  defect     |      Status:  new     
 Priority:  normal     |   Milestone:          
Component:  numpy.lib  |     Version:  devel   
 Severity:  normal     |    Keywords:          
 The histogram() function, when called with normed=True, returns incorrect
 results for the bins' frequencies.  The frequencies should sum to 1.0 in
 order to be a real probability distribution, but usually with the current
 code they do not.

 Looking at the current version of the code in trac, I believe the problem
 is on lines 105 and 106 of function_base.py.  On line 105, we calculate
 the width of a bin, and on line 106, we divide the counts for each bin by
 the size of the input times the bin width.  I think the problem could be
 fixed by simply removing the bin width calculation and instead dividing
 the bin counts by only the number of samples in the input.

Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/445>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.

More information about the Numpy-tickets mailing list