Questions tagged [map]
Questions about applying functions or operators to expressions, especially constructs that take advantage of Map (/@) functionality.
329
questions
0
votes
0answers
41 views
How to change Point options when using Map?
I want to change the point size of the points I am plotting in the code below, but wherever I place the PointSize[] option it doesn't like it.
The code is part of a larger program, which generates a ...
1
vote
1answer
41 views
loop execution time difference after Map operation
I am box filtering data from a DNS simulation. When filtering the original data read from a file, this is fast. When filtering a function of these data after applying Map, it is 10 times slower. If I ...
1
vote
1answer
84 views
Optimal way to evaluate a function over many points
This piggy-backs on my previous question: Parameter space search routine is too fast?
I am looking for a fast way to evaluate a symbolic list over many points. So lets say I have a list of symbolic ...
0
votes
1answer
36 views
How can I plot various points on a world map and compare distances?
How can I plot various points on a world map and compare distances?
For example, the distance between Jerusalem and Westford, MA compared to the distance between Westford, MA and Recife, Brasil? Then ...
4
votes
2answers
178 views
Maximum of all distances between any pairs of vertices of a random triangle
Given a set $S_n$ of $n$ points selected uniformly at random in a $d$-ball, I want to estimate the average length of the longest side of a triangle having as vertices any three distinct points of $S_n$...
0
votes
1answer
37 views
Replace Table with a fast matrix operation to create for matrices A, B the tensor (b_{ij}A) and similar questions
I have two (nxn)-matrices A=(a_{ij}) and B=(b_{ij}) and I'd like to create the (nxnxnxn)-List
C=(b_{ij}*A)
so e.g.
...
6
votes
3answers
177 views
4
votes
1answer
74 views
Key-dependent maps preserving association
Suppose I have some association a0 = <| key1 -> val1, ... |> and some function f[key, val]. I'd like to produce the ...
1
vote
1answer
26 views
Changing PlotStyle while mapping ListLinePlot at several datasets [closed]
Assume that I have several datasets in a matrix and I want to plot them using
...
3
votes
2answers
250 views
How to write a positive function as sum of positive terms only
A multivariate polynomial function can be written in a certain form (x^m (1-x)^n y^k + ... ) if the function is Positive in the whole domain and contains a finite ...
2
votes
0answers
50 views
Map Inverse Ordering on Matrix [duplicate]
I have an matrix (symmetric, but any $n \times n$ will do)
$$A = \begin{bmatrix}
0 & 4.5 & 6 & 5.5 \\
4.5 & 0 & 4 & 3 \\
6 & 4 & 0 & 5 \\
5.5 & 3 & 5 &...
4
votes
1answer
93 views
Plotting conformal mappings: $(x, y) \mapsto (x^2, y)$
I'm currently studying transformation geometry, and I've been trying to figure out a good way to plot conformal mappings on $\mathbb{R}^2$ of the form
$$ \mathbf{f} : \pmatrix{x \\ y} \mapsto \pmatrix{...
2
votes
3answers
83 views
Multiple Calculations in a condition
I want to add and subtract 3 from a list.
pos = {82,84}
If[# > 3,
(# - 3) && (# + 3)] & /@ pos
the output I want:
...
0
votes
1answer
76 views
Removing curly brackets in an argument of ArcTan [closed]
I have list of number pairs
l = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}}
of which I want to take the ArcTan
...
4
votes
1answer
141 views
Why Does Parallelization Not Speed Up these Seemingly Well-Parallelizable, Simple Functions?
Original Example
Consider function f, a parallelized version fPar, and a coarsest-grained parallelized version ...
3
votes
2answers
53 views
Map vertex id to vertex coordinate
I want to map vertex labels to vertex coordinates stored in two variables.
vl = {6, 9, 12}
vd = {{1011, 1127, 420}, {950, 1052, 404}, {780, 1033, 470}}
I tried,
<...
1
vote
2answers
83 views
How to pass arguments and options of a function when using Map?
Suppose I have a list in which I need to map a function to a list. Also suppose that function takes several arguments and even more options (such as styling). How would I pass all arguments and ...
1
vote
1answer
60 views
Sort a nested Association by another Association
I have a nested association of numerous pixel values sorted by sample date (e.g. 20190422C) and futher by a strain percentage (e.g. 0, 30, 50).
I want to sort it even further using and Association of ...
2
votes
1answer
53 views
Crown a list of two sublists with ErrorBar without losing list structure
I have a list with two sublists of numbers, e.g.
Sigmaf = {{1,2,3},{3,4,5}};
... and I would like to crown each number with ...
1
vote
1answer
63 views
cascade application of Map or MapThread
In the following application
f = MapThread[If [#2 == 0, 0, #1/#2] &, {d, c}] // N;
I need to overlay another mapping operation so that ...
1
vote
1answer
39 views
Map two input streams, one graphics objects and the other characters through Show
The question is how to sequentially execute Show with two streams of input. The first is graphics object stream and the second is a character stream for supplying ...
1
vote
1answer
30 views
sequential execution of Show with two input streams, one of graphics object and another of characters
The question is how to sequentially execute Show with two streams of input. The first is graphics object stream and the second is a character stream for supplying labelling for the graphics. I tried
<...
0
votes
0answers
52 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
16 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
70 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)$,...
3
votes
2answers
66 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
24 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
82 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
260 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
78 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
88 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
103 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
54 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
49 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
48 views
Automating a code to use Map function, using it to plot with ListLinePlot command and plotting with certain imposed conditon
I have a code which goes like this:
...
2
votes
1answer
56 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
68 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
101 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
145 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
227 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
44 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
59 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
39 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
121 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
168 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
63 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
55 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
46 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 ...