# Log transformed histogram distribution

Bug introduced in 11.0.1 or earlier and persisting through 11.3.0 or later

I try to get a Log transformed histogram data I get from a different program

examplefile =
{{0., 70.110492289066920}, {20., 6.80630499020644475}, {40.,
8.42161}, {60., 15.06519919414850448}, {80.,
8.2318220556770346}, {100., 87.478685125810497}, {120.,
4161.7690039964691}, {140., 84754.765836040083}, {160.,
532571.989049240777}, {180., 857574.30987846023}, {200.,
299164.78794849526}, {220., 21296.4007456827975}, {240.,
324.610011732739988}}


I convert this to a distribution by:

 \[ScriptCapitalD]exmp = HistogramDistribution[
WeightedData[examplefile[[;; , 1]], examplefile[[;; , 2]]], {20}];


And do a Log transform:

\[ScriptCapitalD]log = TransformedDistribution[Log[x],
x \[Distributed] \[ScriptCapitalD]exmp]


Now RandomVariate is working fine:

Histogram[RandomVariate[\[ScriptCapitalD]log, 10000]]


But PDF is showing nothing:

Plot[PDF[\[ScriptCapitalD]log, y], {y, 0, 10}]


Do I do something wrong, or can I just not use PDF?

• try Plot[Evaluate@PDF[\[ScriptCapitalD]log, y], {y, 0, 10}]?
– kglr
Commented Jul 9, 2018 at 13:51
• @kglr, thanks. I get the same resulting plot Commented Jul 9, 2018 at 13:53
• this must be version/os related. Plot[Evaluate@PDF[\[ScriptCapitalD]log, y], {y, 0, 10}] works in version 9 (windows 10) but not in version 11 (wolfram cloud).
– kglr
Commented Jul 9, 2018 at 13:57
• The PDF looks really weird in Mathematica 11.3. Look here i.sstatic.net/2G8QM.png Commented Jul 9, 2018 at 14:06

In version 9,

Plot[Evaluate@PDF[\[ScriptCapitalD]log, y], {y, 0, 10}] (* and *)
Plot[PDF[\[ScriptCapitalD]log, y], {y, 0, 10}, Evaluated -> True]


give

In version 11.3, there seems to be a bug in computation of the PDF

PDF[\[ScriptCapitalD]log, y]


The issue is that Boole[{...} <= E^y <{...}] doesn't thread.

The fix is easy: simply modify the piecewise expression by explicitly Threading the argument of Boole:

pdf = Function[y, PDF[\[ScriptCapitalD]log, y] /. Boole[a_] :> Boole[Thread[a]]];

Plot[Evaluate@pdf[ y], {y, 0, 10}]


• Plot[pdf[y], {y, Log[#[[1]]], Log[#[[2]]]}, PlotRange -> All, ImageSize -> Medium] & /@ {{1, 120}, {120, 260}} // Column shows additional data Commented Jul 9, 2018 at 15:22
• Do we agree that a bug tag is applicable? Commented Jul 11, 2018 at 10:07
• @Ruud3.1415, I think so. I suggest you report this to Wolfram.
– kglr
Commented Jul 11, 2018 at 10:13