Linked Questions

64
votes
8answers
8k views

How to efficiently find positions of duplicates?

Is there an efficient way to find the positions of the duplicates in a list? I would like the positions grouped according to duplicated elements. For instance, given ...
43
votes
5answers
1k views

Why is there no PositionFunction in Mathematica?

Too often I have seen the programs of inexperienced users greatly slowed by using Position in an iterative fashion, when far faster would have been to compute a ...
23
votes
4answers
3k views

Can Mathematica's random number generation be improved?

Performance on Random Number generation is intolerable. Whenever you need many deviates from the same distribution but with different parameters it takes forever. Here is a thread on Poisson deviates ...
15
votes
5answers
2k views

GroupBy several keys while keeping the Dataset as a Table (List of Associations)

Assume you import data from a Table source of the following format. ...
16
votes
4answers
832 views

Reproducing a ranking function that behaves like Excel's RANK

I tried to find a function or expression in Mathematica that produces the same output as the RANK function in Excel (see its description here), but unfortunately I ...
31
votes
2answers
789 views

Why is Query so much slower than Part?

Time for another of these(1),(2) as yet another new-in-10 function appears to have poor performance compared to older alternatives. This time: Query appears to be ...
29
votes
1answer
973 views

Why some built-in functions are slow

I just wonder why some built-in functions are slower compared to some other ways using more than one built-in functions for doing same job. consider this example: ...
8
votes
5answers
268 views

While partitioning the elements in a list using GatherBy, can I correspondingly partition the elements of an unrelated list?

If we have a list like the following: list1 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; And we use GatherBy to subpartition is ...
27
votes
1answer
666 views

In 10.1.0 BenchmarkPlot doesn't work?

Bug introduced in 10.1 This bug was resolved in 10.2.0, but another bug was introduced in 10.3.0 persisting through 10.3.1 and finally resolved in 10.4 In Mathematica 10.1.0 and 10.3.0 ...
9
votes
6answers
359 views

Truncating a list once all members of a set have appeared?

Consider if you would the case where we have some list of elements: list0 = {54, 4, 7, 9, 3, 54, 4, 20, 2, 456, 2, 3}; And we have some target list: ...
6
votes
3answers
293 views

Speed of ConvexHullMesh

Pick $N$ random points on the surface of the sphere, then use ConvexHullMesh[] to compute their convex hull. Empirically, this takes time quadratic time in $N,$ ...
10
votes
3answers
734 views

Extracting values with multiple keys

I want to extract sorted data from a huge database based upon two (or more) keys in a very timely manner. Here is a reproducible toy example for two keys only: ...
9
votes
2answers
216 views

Slicing an Association with named key span without normalizing?

Is there way to slice an Association with named key span? Span currently doesn't accept named keys: ...
11
votes
2answers
416 views

Held keys in associations

Bug introduced in 10.0 and persisting through 11.0.1 or later Bug introduced in 10.0 and fixed in 10.4 Association is new in 10.0. Bug still present: ...
7
votes
3answers
167 views

Multi-dimensional PositionIndex

I've noticed that PositionIndex does not take a level spec like most related functions. So while it's very useful on 1D lists, I can't really use it to get a index ...

15 30 50 per page