# Tag Info

Accepted

### Parallelize Map and ParallelMap

I did a bit of debugging to find the cause of the problem. After I found it, the problem no longer seems as outrageous as it looked at first sight. The root cause of the problem is the following ...
• 236k
Accepted

### Metropolis-Hastings Algorithm - Significantly slower than Python

Here a bit of inspiration for you. The following code should be approximately as fast as your Python code. Preparation: ...
Accepted

### Map vs. Table for index-specific operations on 2D arrays

Many index-specific operations can be implemented via MapIndexed with a level specificaton. Your Power example can be written as:...
• 7,876
Accepted

### Map every second element of a list

Edit Ok, so an incorrect answer producing arrays like: {{"0.", RGBColor["0.00000000000", "0.00000000000", "0.00000000000"]}} received +12 and an accept. Let's ...
• 137k

### Simplify the code

☺lookMaNoLetters☺ = 1 ## & @@@ # & /@ # &; ☺lookMaNoLetters☺ @ mylist {{y1 y2 y3, y3 y4 y5}, {w1 w2 w3, w4 w5 w6}} Further variations: ...
• 399k

### Monitoring Apply / @@@ over large lists

You can always transform an expression of the form Apply[f,list,level] to the (almost) equivalent Map[Apply[f],list,level]. You ...
• 34.4k
Accepted

### Determining moving ratios over a list

list = {5040, 1460, 280, 76, 16, 2, 1}; Ratios: 1 / Ratios @ list {252/73, 73/14, 70/...
• 399k
Accepted

• 31.7k
Accepted

### How do I map a function pairwise?

BlockMap[Apply[F], data, 2, 1]
• 31.7k
Accepted

### How can I create an atomic head or treat some head as atomic during Map?

Following this tutorial, tmp = atomicHead[1, 2, 3]; SystemPrivateSetNoEntry@tmp Map[g, {0, {tmp}}, {-1}] ...
• 62.1k
Accepted

### How to create a matrix of paired values from two matrices?

MapThread[List, {m1, m2}, 2] {{{a, w}, {b, x}}, {{c, y}, {d, z}}} More alternatives that yield the same answer: ...
• 16.4k
Accepted

### How can I "multiply" nested lists?

Times @@@ Tuples @ {alist, blist} {{a r, b s, c t}, {a x, b y, c z}, {d r, e s, f t}, {d x, e y, f z}}
• 399k
Accepted

### ParallelMap vs Map performance comparsion

The difference between the parallelized and the serial version is not due to auto-compilation. Auto-compilation will be used on the subkernels too. You can easily check that turning it off there ...
• 236k
Accepted

### Unexpected behavior with Map

As noted in comments, the standard ways to evaluate such result is to use Composition or pure function. Using Composition: <...
Accepted

### Simplify the code

Since you appear to want to multiply the list only when all of its elements are atomic, how about just mylist /. {s__?AtomQ} :> Times[s] It appears to be the ...
• 5,331
Accepted

### How can I apply a function only to even-index elements of a list?

I changed D to Dd: MapAt[Dd, A, 2 ;; ;; 2]
• 31.7k

### How can I apply a function only to even-index elements of a list?

You can use the new ApplyTo: A = {1, 2, 3, 4, 5}; Dd[P_] := P + 1 A[[2 ;; ;; 2]] //= Dd; A (* {1, 3, 3, 5, 5} *)
• 49.3k
Accepted

### Maps between finite sets

alist = {3, 4, 5}; blist = {"a", "b"}; mapfs = Tuples@Outer[Rule, blist, alist] \begin{array}{l} \{\text{a}\to 3,\text{b}\to 3\} \\ \{\text{...
• 56.2k

### How to create a matrix of paired values from two matrices?

Since particular use of Transpose is shown, let me show the particular use of Flatten: ...
• 67.7k

• 62.1k
Accepted

### How to make a matrix of derivatives?

See D (search for Hessian): D[f[x, y], {{x, y}, 2}]
• 241k
Accepted

### Map[Remove[#]] doesn't seem to do anything

As stated in the comments, a is evaluated before being fed into Remove. We can prevent this by using ...
• 36.4k
Accepted

### Combination of list elements

If you have to use Map and #1 + #2 + #3 & literally: ...
• 399k

### Map every second element of a list

If we define: rgb[s_] := RGBColor @@ StringReplace[s, Whitespace~~n:NumberString :> ToExpression[n]] then we can write any of the following expressions: <...
• 69.2k