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
0
votes
0answers
45 views

Mapping on changing list

for those who have seen it, I have deleted my previous question, as suggested by @Αλέξανδρος Ζεγγ, The goal : Modifying dynamically the list on which a mapping is done I try to give you a concrete ...
0
votes
1answer
12 views

NIntegrate arguments and non-numerical lists

Having two lists a = {1,2,3} b = {4,5,6} and a function f[lo_, hi_] := NIntegrate[x^2, {x, lo, hi}] I would like to ...
1
vote
2answers
59 views

Iterate Minimize on a list of functions

I have a function $f$ defined on $[-1,1]$. For a minimal example, it suffices to define f[z_]:=z^2 - 1 I need to find a list of points such that $f(z_0)= f(z_1)$,...
0
votes
1answer
28 views

Map of an expression in a 3D grid is very slow

I have a quite large expression as function of $R$, $\phi$ and $Z$ as you can see: ...
0
votes
0answers
21 views

Optimization of storages capacity

Consider a series of storages where different goods are added into daily. I would like to optimize the distribution of these goods between the storages in a way which takes into account some ...
2
votes
1answer
72 views

How do I create a bifurcation diagram for the below iterative map? [closed]

I have tried to create a bifurcation diagram for the following iterative map: x[n+1]=-r Log x[n], x[1]=0.711 and r=1/log(n(n+1)) using the following code But it doesn't work. Any help? ...
5
votes
2answers
253 views

Is it possible to speed up this code by eliminating “For” loop?

I am finding how to speed up a code. The code and general equation are as below. ...
6
votes
3answers
68 views

Sorting list on multiple criteria based on means of subgroups

I have a set of records where each record is for a particular item. An item is a member of a particular subgroup and a subgroup is a member of a particular group. One item is always a member of a ...
4
votes
1answer
86 views

Iterative comparison between different vectors

I have some soccer outcomes for each league round to import in a data form similar to that: ...
2
votes
3answers
94 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: ...
2
votes
1answer
50 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
44 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
47 views
2
votes
1answer
44 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
63 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
91 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
122 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
226 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
40 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
54 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
114 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
57 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
108 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
54 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
45 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
39 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
70 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
50 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
44 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
216 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
111 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 ...
8
votes
4answers
698 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
169 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
119 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
70 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
454 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
554 views

List, map function based on a condition

I have the following list: ...
2
votes
2answers
106 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
66 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
256 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
431 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
105 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
71 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
61 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
200 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, ...

1
2 3 4 5
7