# Questions tagged [map]

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

272 questions
Filter by
Sorted by
Tagged with
1answer
29 views

### How can I consolidate mapping code between different levels of lists?

I have a list with the following structure: ...
4answers
394 views

### List, map function based on a condition

I have the following list: ...
2answers
88 views

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

This is an extension of my recent question, Map vs. Table for index-specific operations on 2D arrays For that question I gave a minimal working example, since I was more interested in learning ...
1answer
41 views

### Combine a List of Plots: Using MapThread with Show [closed]

I have a list of graphics p1 = Plot[x Sin[x] - 1, {x, -2.5, 2.5}] p2 = Plot[Evaluate[D[x Sin[x] - 1, x]], {x, -2.5, 2.5},PlotStyle -> Red] ListNew = {p1, p2}; ...
3answers
105 views

### Map function over two lists

How to map a function over two lists, first one and than the other? For example, assuming I have two lists {a,b,c} and {d,e,f}: ...
2answers
336 views

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

Many experienced users on this site tend to use Map (and its variants, MapAt, MapIndexed, etc.) rather than Table. When applying the same operation to every element of an array, Map does seem more ...
2answers
88 views

### Creating a new Dataset column using a map from a second Dataset

Say I have two datasets: one is a detailed list of events, and one is a coarse list of events. I want to add a column to the detailed list from the coarse list (for the purposes of sorting). For ...
0answers
62 views

### A map function in a simulation problem

This is a continuation development of another post by @Dr. Wolfgang Hintze and deserves credit for the code work presented here. My modification was to include simple mapping to allow compare the ...
1answer
40 views

### Moving map with non-overlapping window

How can I apply a function to a list with non-overlapping window. E.g. $data = \{x_1, x_2, ...., x_n\}$ and we apply f with window size 2 to get $\{f(x_1,x_2), f(x_3, x_4), ...., f(x_{n-1}. x_n)\}$. ...
2answers
193 views

### How to find the positions of replaced elements in a list

I have two sets of elements a={3, 4.8, 5, 4.2, 3.6, 2.3, 4.5, 3.7} b={2.8, 4.7, 5.3, 3.5, 4.7, 2.8, 4.2, 3.4} and I create ...
8answers
2k views

### Simplify the code

I have a function that grabs the second part of the list and change it to times, ...
2answers
160 views

### Iterate MapThread with matrices

Consider a function f and a list p={a,b,c}. I want to get a list of ...
1answer
35 views

### Summing up elements of nested lists based on conditions from another list

Here is a simplified version of my question, nothing that I have a much larger dataset. I have a list of samples of proportions: ...
2answers
191 views

### List of lists elementwise greater/smaller than

I have two lists a = {{3,1,2},{5,1,3},{4,1,1}} b = {{4,0,3},{4,2,2},{5,0,2}} And would like to compare each element within ...
3answers
62 views

### Mapping a function with levelspec vs. Mapping over a flattened list

I have borrowed the following cyclic permutations list making function from here. ...
1answer
82 views

### Arrays, Mapping, and Convolutions

I'm trying to create a function that convolutes a 3D Normal Distribution to the points listed below. However, I think I'm going about it in the wrong way. When I try and convolve it with the points, ...
1answer
51 views

### Replace second derivative with product rule

Suppose that after some calculations, I find a[x]*D[g[x],x,x]+b[x]*D[h[x],x,x]+c[x]*D[j[x],x] What sort of operations do I need to do in Mathematica such that ...
1answer
30 views

### Mapping the FindMinimum function over a matrix

I'm quite new to Mathematica and so still trying to work out how to use some of its syntax and functions. I have a function for the free energy of a generic system with two order parameters. I am then ...
1answer
29 views

### Create a list to Plot from a list returned by Solve

I have a list of 8 items the form: ...
2answers
76 views

### How can I iterate across a list of triples?

i just started to use Mathematica and I`m completely new to programming. So i'm some kind of noob in the purest form.. I'm trying to transform a coordinate system into a different one. I'm using <...
1answer
70 views

### How to properly Abort from within a ParallelMap?

If a condition is met within a sub-kernel in the function being mapped, how does one cancel the whole ParallelMap operation? ...
1answer
50 views

### Using elements of list to solve a differential equation

I have created a list as shown in picture. the digits inside f are values of a and q respectively. I want to solve the Mathieu equation.....
0answers
38 views

### Map a function at the lowest level [closed]

How do I map a function to the lowest level of any given nested list? As an example, how do I create output from input in the ...
1answer
80 views

### Fast and Listable Piecewise function

I am writing a simulation where I have an array with ten columns and on the order of millions of rows, for which I need to iterate on the order of ten thousand times, making computation time a major ...
0answers
30 views

### Help with weird behaviour of Map[Take… on large lists

Lets say I create a giant list: tmp=RandomReal[{1,10},600000000]; Now I want to take 10 random sublists of length 150000: ...
1answer
142 views

### Apply Max to each element of a list [duplicate]

I have a list a = {1, 8, 0, 6, 5, 3, 5, 2, 2, 5} I want to generate a new list whose elements are the same of a if it's bigger than 5, or 5 elsewhere. I managed ...
1answer
119 views

### How to compute Maximum Drawdown faster and highlight data-list-line on the plot?

Given a list as ...
2answers
74 views

### How to caculate Position Cost Price in given trading list quickly?

Given a simulated trading list as ...
1answer
23 views

### Table of convolutes

Inputs Start with a vector $x\in\mathbb{R}^{n}$, and a vector-valued function $f:\mathbb{R}^{n}\mapsto\mathbb{R}^{n}$. Output Given some $k\in\mathbb{Z}^{+}$, what are elegant ways to produce the ...
1answer
100 views

### Parallelize[MapIndexed[…,Association[…]]] returns broken result

Bug introduced in 10.0.2 or earlier and persisting through 12.0 Confirmed: CASE:4041910 Consider the following example: ...
1answer
50 views

### Mapping over a piecewise function

This is a followup to a question I posted earlier today. Suppose you have a piecewise function such as "snap=max[x,0]= x if x>0, 0 otherwise". Then you would think that it must be straightworward to ...
0answers
51 views

### Using Map function with NDSolve

I would like to solve a set of differential equations but vary one parameter, KieP, between 900 and 1100. The solution for a given parameter has many peaks. I would then like to interpolate between ...
1answer
53 views

### How to map a function to a specfic level spec

I'm rewriting a function into a manipulatable graphic and while I'm happily surprised with how concise functional programming can be, I'm having trouble mapping the anonymous function ...
2answers
474 views

### Project map to a particular shape

I want to project a map to a particular shape, like a circle or ellipse. For example, let's imagine we want to project a map of the continental United states so that its outline is that of a circle. ...
0answers
97 views

### Operation on sublists with multiple arguments

I have a list and add only the values which are > 0 with: Total[Cases[mylist, x_ /; x > 0]] How to do this if I now have a list of sublists? ...
0answers
72 views

### Run function as loop over two matrices

I'm still wrapping my head around Mathematica syntax. I have a matrix clustersAll that looks like ...
0answers
84 views

### Understanding Maps and slot

Going through some old code I found this line: ...
0answers
86 views

### How to give a function multiple variables in a mapped and nested list?

I come from python (not advanced tho), and have been learning mathematica. I'm currently struggling with the following code: This is a basic version of what i wanted to implement: ...
4answers
170 views

### @ and Sequence ( and /@ ) [duplicate]

list = { {a,b}, {c,d}, {e,g} } How to efficiently get { f[a,b], f[c,d], f[e,g] } I tried various combinations using ...
2answers
145 views

### Clear variables inside Module

I have a function that uses Module. The function takes as input a .csv that can have as many columns as it wishes to, and it ...
1answer
53 views

### Can I Use a List To Position An Arbitrary Number of Graphic Objects?

I can use a function to compute the positions of individual nodes of a neural network based on how many there are in each layer (nodesPerLayerList below). Now I want to display them all in position. ...
2answers
259 views

### Applying functions to lists

I have a few expressions $f(\theta,x)$, $g(\theta,x)$, $h(\theta,x)$ in terms of two variables, an angle and a length. The angle goes from $-\pi/2$ to $\pi/2$ and the length from 200 to 1500. This is ...
2answers
120 views

### Mapping slots over lists

In the meantime I'm accustomed to write special character orgies like D[%,#]&/@L (to quickly fish out the coefficients of the last input with respect to ...
0answers
28 views

### Color filling by GDP in a map

I would like to have a tool where one can type in a minimum GDP level and then every country that has this minimum level gets filled with color.
2answers
72 views

### How to I use Map to apply a defined function to a list?

Problem: How to map a function onto a list. My (example input: mylist = {{1, 2}, {3, 4}} gg[x_, y_] := {N[x + y], N[x y]} Map[gg, mylist] Expected output: ...
1answer
62 views

### Angle between one vector and a list of vectors [closed]

I have one vector v1 and one list of vectors v2. I want to find the angle between them (see below): ...
1answer
125 views

### How to Parallelize a simple MapAt?

I have a simple map I would like to parallelize (4x speedup for my 4 cores): ...
1answer
76 views

### Extracting the graph of Keys in nested Associations

Related to this q: Extract all Values from nested Association How to extract the direct graph of all Keys in nested Associations...
2answers
63 views

### Multivariate map

I have a multivariate function that I want to map into a triple of variables. ...
3answers
312 views

### MapThread Not Mapping on Ragged Array

Update: WRI Support has considered this a missing feature of MapThread instead of a bug. A request to update MapThread to ...