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

How to digitize a vector field?

Is there some way that I can digitize both the direction and the magnitude of a vector field accessible in JPEG format? To clarify what I mean, I want to have the numerical value of: 1)magnitude and 2)...
3
votes
2answers
59 views

Applying transformation rule for corresponding indices?

I have two lists, that looks like below list1 = {a, x, b, x, x, c}; list2 = {2, 3, 4, 5, 6, 7}; Any time there is an x in the ...
0
votes
0answers
64 views

Iteration limit exceeded

I am trying to adapt the following piece of code (coming from this answer): ...
1
vote
1answer
62 views

how I should use `MovingMap` on a `Dataset`?

I am aware of How would I use Map on a Dataset column? still I cannot see how I should use MovingMap on a Dataset. Even the ...
0
votes
1answer
27 views

Recursive addition of vector list to last elements of vector lists

This question refers to an extension of Add list of vectors to list of vectors recursively . I tried hard to complete the problem but now I got stuck. I have vectors ...
4
votes
2answers
115 views

bind specific 'Slots' to specific 'Map'

Is it possible to construct a pure function using multiple slots, with the following concept :       Binding   specific slot    to    specific apply or map For example : In this example, To ...
2
votes
2answers
105 views

Restrict kinds of heads when dealing with level concept

In[1] Map[(# + 7) &, {a, 3 b, {c, d}, e}, {2}] Out[1] {a, 10 (7 + b), {7 + c, 7 + d}, e} But I want feature like ListMap : ...
0
votes
0answers
37 views

calculate differences of a list using slots

I want to calculate the differences between the numbers of a list. One way to do that is using 'Differences'. For example: L = {1, 3, 6, 9}; Differences[L] this ...
0
votes
1answer
40 views

How to prevent small locations from being plotted as points when using GeoListPlot?

When a location is too small, GeoListPlot marks that location using a point on the map. For example, ...
1
vote
1answer
67 views

Manipulate mapping on lists

For some function f, consider the following expression: ...
15
votes
1answer
905 views

Metropolis-Hastings Algorithm - Significantly slower than Python

I would like to code a Metropolis Hasting algorithm and thought I would get the general scheme of things going with a toy example. I think I got it running but my Mathematica code runs significantly ...
0
votes
0answers
45 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
42 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
88 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
42 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
184 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
39 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
185 views

Nested lamdas: MapThreading a MapAt lambda

Consider a set of (here) 3 series ...
4
votes
1answer
79 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
28 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
255 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
113 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
86 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
158 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
55 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
90 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
75 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
66 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
40 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
31 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
54 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
82 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
73 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: ...
2
votes
1answer
87 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? ...
6
votes
2answers
278 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
87 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
90 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
53 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
52 views
2
votes
1answer
65 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
70 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
109 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
158 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 ...

1
2 3 4 5
7