Linked Questions
19 questions linked to/from Why is there no PositionFunction in Mathematica?
608 votes
19 answers
161k views
Where can I find examples of good Mathematica programming practice?
I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
47 votes
3 answers
2k views
Why is the new PositionIndex horribly slow?
This issue has largely been mitigated in 10.0.1. New timings for the final test below are: ...
21 votes
4 answers
3k views
Accessing list elements by name
First, a bit of a long introduction to my problem: I only have a few weeks of Mathematica experience. I am creating a mathematica application that calculates some material properties of steel based ...
19 votes
7 answers
1k views
How to search Dataset to find all keys share same Value
If I have the following Dataset ...
10 votes
7 answers
1k views
intersection between two 2D arrays with labeled data is slow
Here is how to Generate data the function is below with two images to generate data img1 img2 ...
7 votes
6 answers
602 views
Total by a criteria
I am developing a weighted KNN algorithm. In a step, I need to do the sum of weights of each class. For example: ...
10 votes
5 answers
933 views
Is there a faster way to find the positions of specific elements in a very large list?
Is there a faster way to find the position of certain elements (referred to as target below) from a list (referred to as myList ...
15 votes
3 answers
617 views
Head of a MatrixForm expression?
An example in http://www-zeuthen.desy.de/theory/capp2005/Course/hahn/mathematica.pdf amounts to the following ...
8 votes
4 answers
3k views
efficient way to give nearest neighbour and next nearest neighbour of every point in a point set
Suppose we have a point set, the points are labeled 1,2,3,....n. And p[i] is the coordinate of the point. Now I want the label of nearest and next nearest point (...
9 votes
6 answers
530 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: ...
3 votes
7 answers
429 views
Change sublist based on position
Supposed that: list = {2, 3, 5, 7, 9}; sublist = {{3, 3, 5}, {2, 2, 2, 7, 9}}; I want to change each sublist in sublist as following: Find the positions of ...
11 votes
2 answers
602 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: ...
3 votes
3 answers
2k views
Use map on a different level
I have just started to get used to Mathematica's Map, Apply, and related functions, and I can't figure out how to do maps that require working "one level down". For example, I am currently trying to ...
11 votes
1 answer
351 views
Dispatch not behaving like a normal expression in Mathematica 10
In Mathematica 9, I used to be able to do rules = Dispatch[{'a' -> 1, 'b' -> 2}] rules[[1]] to extract the rules from ...
6 votes
2 answers
355 views
What is the fastest way to get a list of subexpressions and their positions?
I have spent quite some time trying to figure out what the fastest way is to get a list lists of all subexpressions and their positions. I have tried things with MapIndexed, which seems ideal in cases ...
9 votes
1 answer
772 views
Performance of Dispatch and lists of Rules
The issue outlined here seems to be no longer present in version 10, if you use a Dispatch table! This because a Dispatch table ...
2 votes
4 answers
241 views
Substitution and replacement in a matrix according to the position of an item in another matrix
I have the following problem and obviously I need help 1) a list of choices --- in fact journals but this doesn't matter ...
3 votes
2 answers
213 views
Replacing members of a list with elements sampled without replacement from another list
I have a list of element pairs: pairList = {{1,2}, {2, 3}, {3, 4}, {4, 5}}; I'd list to pick a subset of the elements in this list: ...
2 votes
2 answers
132 views
Delete duplicate elements in a list from a master list [closed]
This question has been addressed adequately for pattern matching. However, I have a similar task with floating point data. I am looking for an efficient way to delete duplicates within a tolerance ...