Linked Questions

596 votes
19 answers
154k 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: ...
Mr.Wizard's user avatar
  • 269k
20 votes
4 answers
2k 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 ...
ahhhh's user avatar
  • 305
18 votes
7 answers
1k views

How to search Dataset to find all keys share same Value

If I have the following Dataset ...
Basheer Algohi's user avatar
10 votes
7 answers
962 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 ...
Ali Hashmi's user avatar
  • 8,860
7 votes
6 answers
487 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: ...
BetterEnglish's user avatar
14 votes
3 answers
464 views

Head of a MatrixForm expression?

An example in http://www-zeuthen.desy.de/theory/capp2005/Course/hahn/mathematica.pdf amounts to the following ...
murray's user avatar
  • 11.7k
8 votes
4 answers
2k 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 (...
matheorem's user avatar
  • 16.9k
9 votes
6 answers
431 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: ...
GreenField's user avatar
3 votes
6 answers
296 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 ...
incognito007's user avatar
11 votes
2 answers
468 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: ...
Mr.Wizard's user avatar
  • 269k
3 votes
3 answers
1k 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 ...
soandos's user avatar
  • 1,030
11 votes
1 answer
315 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 ...
phantomas1234's user avatar
6 votes
2 answers
250 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 ...
Jacob Akkerboom's user avatar
9 votes
1 answer
620 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 ...
Jacob Akkerboom's user avatar

15 30 50 per page