I have a strange problem I haven´t had so far. I have a list of 16 lists of Integers and Rationals and want to show the 16 Histograms. Problem: The Histogram for the second list is not shown, the computations hangs. The other ones compute in less than a second. The lists are of lengths 450.000+ and all values are between 0 and 1 (they are Jaccard coefficients of sets). At the moment I have no idea what I can do further. I make the data public accessible (File "histogram.m") via the following dropbox link: histogram.m.

Enclosed a screenshot of my "investigations". By the method "trial and error" I found that the second list of data is normally processed (histogram computed at a moment ) up to element number 131073 (the corresponding value is 3/8), the values surrounding this element are all "looking normal", i.e. all rationals between 0 and 1. It would be great if anyone has a hint for me what the source of the problem is. enter image description here

My machine: MacBookPro Late 2016, MacOS 10.12.6, Mathematica


The problems seems to reside in the way Histogramcomputes the bins. If I use Histogram[#,{0.1}]& everything is fine.

  • $\begingroup$ Works for me. $\endgroup$ – C. E. Aug 5 '17 at 21:41
  • $\begingroup$ @C.E.:Thank you for the fast response. I´m working on a MacBookPro Late 2016, latest OS, Mathematica $\endgroup$ – mgamer Aug 5 '17 at 21:50
  • $\begingroup$ I can reproduce the problem in Mathematica 11.1. Wrapping the list in Sort seems to resolve the problem, whatever it is. $\endgroup$ – C. E. Aug 5 '17 at 22:13
  • $\begingroup$ @C.E.: Thank you for this workaround ("Sort" I hadn't in my mind ;-) ) I´ll try this out immediately $\endgroup$ – mgamer Aug 5 '17 at 22:26
  • $\begingroup$ @C.E.In 11.1.1. Solve does not solve ( ;-) ) the problem. As a first step I´m going to report this to WR $\endgroup$ – mgamer Aug 5 '17 at 23:12

I reported this to Wolfram at 2017-09-20 and got the following answer:

"Thank you for providing the condensed information. I verified and confirmed that your issue was present in version 11.1.1. However, the issue has been resolved in version 11.2 as demonstrated in the attached notebook. Please install the latest 11.2 version and check if the issue persists for Histogram with your data."

Now in the "new" version 11.2 everything is fine. No problems so far

| improve this answer | |

Maybe not a solution to your problem (I am not able to replicate it with Mathematica 11.0.1 under macos 10.12.6 on a Macbook Pro 2015), but this may still be helpful:

Your data will be processed much faster if you turn it into a list of PackedArrays of Reals:

a = Import["histogram.m"];
b = Developer`ToPackedArray@*N /@ a;
Histogram[a[[2]]] // AbsoluteTiming // First
Histogram[b[[2]]] // AbsoluteTiming // First

On my machine, this yields the following timings:

(* 1.23312 *)
(* 0.069292 *)
| improve this answer | |
  • $\begingroup$ @Henrk Schumacher: Good for performance: list = DeleteCases[Range@16, 2] and Histogram /@ b[[list]] runs 0.75 seconds. But b[[2]] can still not be calculated. $\endgroup$ – mgamer Aug 6 '17 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.