Questions tagged [map]

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

Filter by
Sorted by
Tagged with
1
vote
3answers
77 views

Import data from different webpages of the same website

I imported and cleaned the following datasets for england soccer league in order to have home/away rank tables and next round matches: ...
1
vote
1answer
38 views

Code a function to obtain an output table from an input dataset taking into account some rules

Good morning, I have an input dataset in the following form: ...
3
votes
1answer
40 views

Indexed KeyValueMap

I have been trying to figure it out and I am probably very close, but I have spent 2 hours without sucess. I have the expression below ...
1
vote
1answer
39 views
2
votes
1answer
39 views

AppendTo inside ParallelMap

I think this question has never been fully answered. In here the problem has already been mentioned, but let me give a MWE. I will solve a given ODE for a wide range of initial conditions and I want ...
3
votes
2answers
57 views

WhenEvent with a function

I have the the function kill[x_]:=Map[#->0&,x] which is supposed to set a list of functions to zero. That seems to be working, because ...
3
votes
1answer
85 views

Add a legend to a combined Plot

I have trouble adding a second legend to this map (see picture underneath). I need the legend to that show each existing bubble size, with the respective rainbow color (from the map) and with the ...
5
votes
0answers
117 views

How to get 3D building data in map functions?

Most modern mapping APIs have 3D model data for city buildings built-in. For example: Is there some way to get this functionality in the Geography related functions? I believe ...
8
votes
1answer
225 views

Determining moving ratios over a list

To know how fast values in a list approach 1 I tried #[[1]]/#[[2]] & /@ Partition[{5040, 1460, 280, 76, 16, 2, 1}, 2, 1] This works, but I seek a better ...
0
votes
1answer
38 views

How to map a list of entities into a function?

x = RandomChoice[CountryData[]] Here I have defined x to be a random country. ...
0
votes
0answers
53 views

How to apply command to all elements of a list?

So I generated a list of cities and I want to apply FindGeoLocation to all of them without having to seperate the elements and then applying. ...
0
votes
0answers
35 views

Defining a function and order of operations

I feel I have a profound misunderstanding of how Mathematica works. Here's an example that confuses me: Say that for a matrix $A$ I want to extract the first $\mathrm{Tr}(A)$ normalized eigenvectors (...
0
votes
3answers
108 views

Function which returns a symbolic jump between two ordinates, e.g. $[f(a,b,c)]^+_- = f(a^+,b^+,c^+)-f(a^-,b^-,c^-)$

I want to create a function in Mathematica which accomplishes the following: $$[f(a,b,c)]^+_- = f(a^+,b^+,c^+)-f(a^-,b^-,c^-)$$ where $f$ is any function (has 3 arguments above but this need not be ...
3
votes
1answer
56 views

Concisely operate on RHS of list of rules

I have a length-N list of rules l = {a -> 5, b -> 1, c -> 42} and an length-N vector of scalars... dl = {-1, .2, 5} ...
5
votes
0answers
100 views

Visualizing the Riemann's mapping theorem [closed]

The Riemann's mapping theorem allows to map any simply-connected domain in the complex plane $\mathbb{C}$ conformal onto the open unit disk. Conformal is meaning preserving angles. This is a complete ...
1
vote
1answer
46 views

Why does a list of Iconize objects not work with Map

I am trying to understand how to Map a function onto a list of Iconize objects. Here is a simple example: listOfIconize = Table[ Iconize[Range[10 + i]], {i, 1, 3}] ...
1
vote
0answers
53 views

Chaining map and abstract functions — when (and why) is parenthesization necessary? [duplicate]

I am a bit confused with how do some expressions in Mathematica get parsed. I was using a combination of map (/@) and abstract functions of the form ...
0
votes
0answers
16 views

Can I use Postfix with a condition [duplicate]

I have a nested list Data set with mostly numbers, there are a few elements that occur as strings that I want to convert to a number. By postfixing ToExpression I ...
3
votes
1answer
41 views

Order or function/list arguments in map/select/others

I keep being uncertain of the correct order of [function,expr] arguments to functions such as Select, Pick, Cases, Position, etc., because I'm used to the ...
0
votes
0answers
36 views

Mapping a flat unit plane composed of polygons onto a cylinder

I'm looking to map a flat plane composed of triangles onto a cylinder, and then ultimately use a manipulate function to show the plane wrapping into a cylinder. Here is the code I have so far, I've ...
4
votes
1answer
64 views

Map list of functions over list of inputs

Given a list of functions {f1, f2, f3, ...} and list of inputs {1, 2, 3, ...} I wish to produce the list ...
3
votes
1answer
45 views

How to efficiently select positions of elements in a sublist

Apologies if this is an already answered question, I was unable to find anything until now. I believe the answer will be quite simple, I have just been stuck on it for a few days now. I have a large ...
2
votes
0answers
38 views

Generating a directed graph from a map of flows

I have generated a stream plot, with curves on it using the following code: ...
7
votes
4answers
214 views

Generate an array with custom index

Apologies if this is a duplicate. I am trying (but failing) to generate the following n x n matrix in Mathematica: where G[tj, t0] is a function along the main diagonal and G[tj, tj] is a function ...
4
votes
4answers
106 views

How to transform an UpperDiagonalMatrix into a symmetric matrix in Mathematica 5.2?

I have an UpperDiagonalMatrix as the following, how to transform it into a symmetric matrix in Mathematica 5.2? Note: don't use the command ...
7
votes
4answers
682 views

Mapping string into integers

Suppose I have the following list, l = {{"b", "c", "d"}, {"e", "b"}, {"a", "b", "d", "e"}} and further suppose I have the following association, ...
2
votes
2answers
134 views

How to convert list of variables x1, x2, x3 ,x4 … x10 to list of x1_,x2_,x3_..x10_?

I'm writing a function where I need to give many inputs. I created a list of variables from Table function. My aim is to get ...
2
votes
4answers
105 views

Appending to each string in a list with mapping

I have a list of 100 things: endings = ".w_" <> ToString[#] <> "_cold.r_0" <> ".xvg" & /@ Table[i, {i, 0, 99, 1}] And I'm trying to add 20 ...
1
vote
0answers
69 views

Is there a good reason why `Slot[]` is not an atomic expression?

Here's a good reason why I think it should be, Map[ If[AtomQ@#, #->"is an atom", #->"not an atom"]& , {"hello",Range@3, # &} , {-1} ] ...
8
votes
3answers
448 views

Map a function that takes arguments in different levels of a list

I would like to map a function that takes as an argument a list in a list of lists and an element of the list of lists. So for example, this is my list of lists: {{4,1}, {3,1,1}, {2,2,1}} I ...
1
vote
1answer
40 views

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

I have a list with the following structure: ...
5
votes
4answers
512 views

List, map function based on a condition

I have the following list: ...
2
votes
2answers
102 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 ...
1
vote
1answer
61 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}; ...
2
votes
3answers
169 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}: ...
13
votes
2answers
404 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 ...
7
votes
2answers
103 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 ...
0
votes
0answers
66 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 ...
1
vote
1answer
50 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)\}$. ...
3
votes
2answers
198 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 ...
7
votes
8answers
2k views

Simplify the code

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

Iterate MapThread with matrices

Consider a function f and a list p={a,b,c}. I want to get a list of ...
1
vote
1answer
37 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: ...
4
votes
2answers
204 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 ...
1
vote
3answers
71 views

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

I have borrowed the following cyclic permutations list making function from here. ...
0
votes
1answer
84 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, ...
1
vote
1answer
58 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 ...
1
vote
1answer
33 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 ...
0
votes
1answer
35 views

Create a list to Plot from a list returned by Solve

I have a list of 8 items the form: ...
1
vote
2answers
78 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 <...

1 2 3 4 5 7