# Tagged Questions

Questions about applying functions or operators to expressions, especially constructs that take advantage of Map (/@) functionality.

43 views

### Mapping also for one element (or telling it how to do so if head got changed)

Some code generates a polynomial, and has the form: expr = Plus[a[i],b[i],c[i],d[i]] I need to apply f to each term. To do ...
73 views

Suppose that I have f[a_, b_, x_] := ... I'd like to create a list of n pure functions ...
370 views

### Operate over list of pure functions

I have list of pure functions (All functions are InterpolatingFunction) i.e {{a, b}, {c, d}, {e, f}, ...} and I would like ...
131 views

### MapAt a function at specific positions

I'm trying to solve for $p3$ in 3p3-5 = p1 + p2 at positions where p1*p2 == 0: ...
147 views

### Mapping over an association producing an unexpected result

The documentation for associations says that the keys of an association are transparent for many operations. Map is one such operation. However, I am confronted ...
233 views

### Mapping a function over the parts of a deeply nested Array

I have two tensors: tensorS = Array[Subscript[s, #1, #2, #3, #4] &, {2, 16, 16, 19}]; tensorR = Array[Subscript[r, #1, #2, #3] &, {2, 16, 19}]; ...
161 views

### Is there a built-in function to map a list of heads to a list of data?

Assume that this built-in function is called func. What I want is func[{f,g},{a,b,c}] will return the following result: <...
145 views

### Plot range of a 2-dimensional function as a function depending on one variable

I want to plot a function of 2 variables x and y, for discrete values of y, like: ...
215 views

### Map Elements of a list to be Index of matrix

I have a sublist from Tuples[{1, 2, 3}, 2], say for example L={{1,2},{2,1},{2,2}}, and a 3 x 3 matrix ...
524 views

### Apply function to every element of list regardless of depth

I want to apply a function to every element of a list without taking braces into account (depth level), but with the same form of output. Here is an example : ...
131 views

### ParallelMap returns incorrect results over Map

I've written a function to pull in the useful column of a large data file: ...
2k views

### Changing Values in an Association using Map

I am trying to change the value of one key in an association based on the value of another key in that association. So if my association starts as: ...
161 views

### Map 2 list to a function

Im playing around with CountryData and I want to pass it 2 lists as argument, listCountries = {...} and ...
559 views

### Why is there a huge performance gap using Map with more than 100 List entries

im using Map on a List like this: cube= {{1, 1, 1}, {1, 1, 2}, {1, 1, 3}, {1, 1, 4}, ... , {5, 5, 4}, {5, 5, 5}} Mapping the whole List with 125 entries takes ...
114 views

### Can I use Map here rather than Table?

I've got something that works, but it seems like it would be "nicer" if I didn't have to use Table (or For, etc.). I've got 3 Excel files, each with multiple sheets. Each file also has a sheet ...
172 views

### Correct slot assignment when mapping from different lists using pure function

Given expr = u == a1 + a2 x + a3 y; and uRep = {u1, u2, u3}; xyRep = {{x1, y1}, {x2, y2}, {x3, y3}}; I'd like to generate ...
49 views

### Testing a certain function over multiple levels

I regularly want to test if a certain function, here foo, gives the expected result when mapping it over n - level - matrices. My naive approach is to write: ...
232 views

### Loop in solving multiple matrix calculation

I am wondering is there a way to use loop, like Do, For, to rewrite the last line in the code. I tried to use ...
258 views

### Mapping a function over n levels

I want to map a function over a matrix of rank n, for example: ...
110 views

### How do you add options to a function that is being mapped?

Simple example: Normally: ListPlot[list, Joined->True] If I want to map ListPlot how do I keep the ...
88 views

### MapIndexed stops at levelspec 1 if only the index is passed?

If the function passed to MapIndexed references the first (or data) argument, the following performs as expected: ...
2k views

### Scan vs. Map vs. Apply

I cannot understand the difference between Apply, Scan, and Map. I have tried to play with ...
208 views

### Country borders and grids with CountryData plot?

I am coloring several countries in the manner of the following: ...
480 views

### Apply Eigenvalues to a list of matrices

I would like to apply Eigenvalues[] to a list of matrices as in the following ...
336 views

### Mapping multiple functions over an array

I am looking for an elegant way to Map multiple functions over an array. My problem looks something like this: Consider a list of functions: ...
38 views

### Using Map with functions that take a parameter [duplicate]

I have a list l={{0, 0, 0, 3}, {0, 0, 0, 3}, {0, 0, 1, 2}} And I would like to obtain the number of zeros in each sublist: ...
398 views

### How to apply a function of several arguments to a list?

I have a list of triplets: list = {{1, 3, 5}, {4, 5, 1}, {4, 9, 2}} How can I apply a function f to the last element of each triplet when f the last and second-...
34 views

### Use Map with OptionValue [duplicate]

Trying to map OptionValue to a list of option names doesn't work. ...
62 views

### Function output of two lists are only diagonal elements

I'm having a little crysis over here. What I basically want to do is some sort of 3D-Plot, but I'm only interested in the resulting values. I have two vectors x and p: ...
152 views

### Parallelize[Mapindexed[]], level={-1}? Sal Mangano's ã€ŠCookbookã€‹

It is easy to Parallelize[] Map[] & MapIndexed[], as having been shown in MMA9 Help for ParallelMap[] and Parallelize[]. For MapIndexed[], the default levelspec is {1}. However there are many ...
328 views

### Distinguishing slots in a function mapping Position across a list

Suppose that I have a list myList that has more than one level. Here is an example of such a "data structure": ...
352 views

### MapThread multiple functions onto multiple lists

I'm trying to learn the functional style which seems to prevail in Mathematica. I'm having trouble accomplishing the following: Let's say I have multiple lists of arbitrary data (using two lists ...
72 views

### Mapping a function of two arguments where the 2nd arg has a fixed value

I create three random images: i1 = Image[RandomReal[1, {8, 12, 3}]]; i2 = Image[RandomReal[1, {8, 12, 3}]]; i3 = Image[RandomReal[1, {8, 12, 3}]]; I can scale a ...
107 views

### Want explanation of when different looping constructs are appropriate [duplicate]

For example when would you use a Do loop over a For loop? For which tasks would you use Map, ...
130 views

### MAP a business cycles model

There is a Business Cycles Map on Phaser 3.0 and I've trying to run it on Mathematica the last four days without succes. The equations are  x_1 = (1.0 - a s)x_1 + a \left[s m + g \left(\frac{s m}{...
142 views

### Can one use Map during Expand?

Can one Map a simplifying function to the summands of an Expand before fully expanding the expression in question first? ...
634 views

### How to use Map inside MapThread?

Given this input lst1 = {{a, b, c}, {d, e, f}}; lst2 = {1, 2}; and the goal is to generate this output ...
326 views

### Using a table to format a grid

Ok, I can't wrap my head around this because I don't know Mathematica well enough yet, so I'm asking for help, at least a direction to explore in. I have a Grid: ...
172 views

### Drawing a large set of Graphics3D cylinders provided a set of cylinder specifications in a list

I'd like to draw a large number of 3D cylinders using Graphics3D. My list specifying the cylinders has elements that look like the following: ...
338 views

### finding anagrams

What I'm trying to find are the 4 letter words in the mathematica dictionary that have the most anagrams and the amount of anagrams these have each. But I can't seem to find all the 4 letter words in ...
124 views

### map rational number [duplicate]

I am trying to map this function ((-1)^(1/Denominator[#]))^Numerator[#]==(-1)^#& to a fairly big list of random rational numbers I am trying to get this to ...
296 views

I want to add two matrices, the first one containing a 2D vector at each position the other one a list of 2D vectors. The 2D vector from the first matrix should be added to each of the 2D vectors at ...
196 views

After discovering that MapIndexed cannot be used with compile (see MapIndexed and Compile) I am now trying do implement similar functionality using a combination of ...
120 views

### Problem with List Dimension Outer Map [duplicate]

I am currently handling a big list which has the following dimension: {6, 3, 4, 2, 2, 1, 8} where the last number 8 represent a ...
126 views

### Can Map operations be compiled or otherwise sped up for large lists?

I'm performing a series of Map operations in the following script: ...
267 views

### How to apply function f for each time value t, to each pixel from image, resulting in t images

I have a 2D array of complex values and I want to apply a function to every entry of the array, for every timepoint t in a list. I know how to apply my function to one entry for every time t in a list,...
261 views

### Map a function conditional on elements at multiple relative positions in a list

I figure this question has many solutions, and if an answer already exists it would be nice just to be referred to it. I need a function that 'maps' over my list and produces a list of equal length ...
604 views

This may be a rather strange question. I will try to create a sort of minimal working example. Suppose that I have two lists, list1 and ...