# Log-scale histogram bug

Not really a question, more a solution to what I call a bug in mathematica v8(.0.0.4). I already sent a bug report to Wolfram.

### Problem

The documentation for the Histogram-function explains the following option.

{"Log",bspec}       apply binning bspec on log-transformed data.


When specifying the bins in the format {xMin, xMax, dx}, these values are not processed corretly which leads to insatisfying results.

In detail, the lower and upper bounds are transformed to the logarithmic scale using the natural logarithm. From there on, the bin widths are determined using dx and these bin coordinates are transformed back using the common logarithm. One would expect that the routine uses either the natural or the common logarithm for both operations, but not a mixture of the two.

### Example

Imagine, that data is a list of real values.

(* binning settings *)
binMin = 0.01;
binMax = 100;
binWidthLog = 1;
Histogram[data, {"Log", {binMin, binMax, binWidthLog}}] The minimum and maximum x values clearly don't follow the wanted behaviour. Using custom bin limits, this result can be reproduced as follows with a mixture of common and natural logarithms.

bins = {10^Range[Log[E, binMin], Log[E, binMax], binWidthLog]};
Histogram[data, {"Log", bins}] • Might I suggest splitting off the "Solution" portion into an honest-to-goodness answer? After all, answering your own questions is kosher here... – J. M.'s technical difficulties Nov 14 '12 at 13:26
• I followed your advice, thanks. – mincos Nov 14 '12 at 13:34
• should the question be tagged as "bug"? – Mike Honeychurch Nov 14 '12 at 22:10

bins = {10^Range[Log[10, binMin], Log[10, binMax], binWidthLog]}; 