Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [map]

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

0
votes
0answers
27 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: ...
4
votes
1answer
131 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 ...
2
votes
1answer
102 views
1
vote
2answers
67 views

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

Given a simulated trading list as ...
0
votes
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 ...
10
votes
1answer
75 views

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

Bug introduced in 10.0.2 or earlier and persisting through 11.3 Confirmed: CASE:4041910 Consider the following example: ...
1
vote
1answer
47 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 ...
0
votes
0answers
44 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 ...
0
votes
1answer
46 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 ...
13
votes
2answers
432 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. ...
0
votes
0answers
80 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? ...
1
vote
0answers
63 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 ...
1
vote
0answers
79 views

Understanding Maps and slot

Going through some old code I found this line: ...
0
votes
0answers
59 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: ...
3
votes
4answers
164 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 ...
2
votes
2answers
87 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 ...
3
votes
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. ...
6
votes
2answers
251 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 ...
0
votes
2answers
99 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 ...
1
vote
0answers
25 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.
1
vote
2answers
61 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: ...
1
vote
1answer
55 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): ...
8
votes
1answer
112 views

How to Parallelize a simple MapAt?

I have a simple map I would like to parallelize (4x speedup for my 4 cores): ...
1
vote
1answer
61 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...
0
votes
2answers
58 views

Multivariate map

I have a multivariate function that I want to map into a triple of variables. ...
13
votes
3answers
297 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 ...
1
vote
1answer
79 views

Removing outer concentric circle picked up by ComponentMeasurement

So I have performed EdgeDetect and ComponentMeasurements on my images and obtained a pretty good elliptical fit. However, the black shadow of the beads in the image is being picked up by ...
2
votes
0answers
42 views

Error when using Map in Pure Function [closed]

I'm trying to solve Project Euler 21 My solution is as follows: ...
4
votes
2answers
235 views
2
votes
0answers
32 views

Apply all possible permutations into a function [duplicate]

I need to create a function that returns all possible trebles of integers that sum up to a given number. For example, is n=2 then I need something like this: ...
9
votes
5answers
835 views

Map every second element of a list

I've loaded a CSV: ...
3
votes
1answer
101 views

Mapping multiple function on list [duplicate]

I know what you may be thinking so I use the code below to demonstrate what I intend to do. ...
1
vote
0answers
41 views

Coverting a list of products to a list of strings

I am trying to find a way of converting a product of variables to a string, eg. if I have abc... I wish to obtain "abc...". I ...
1
vote
1answer
81 views

Pause when mapping [closed]

I am mapping a function across a list, but would like to pause before each item. For instance: function[variable_]:=( variable * 2 ) function/@{1,2,3} would give ...
0
votes
0answers
66 views

Variables defined modulo $\pi$ and avoiding singularities; phase plotting for a map

I have the following $2$-dimensional implicitly defined map ...
4
votes
1answer
111 views

Apply a function to a list that is a subset of sublists

My MMA fu is very stale, and I don't seem to be able to see a simple way to apply a function across a subset of a list. Specifically in the following data, I want to apply ...
1
vote
2answers
129 views

Comparing elements in a list of lists

I'm stuck with yet another list question. The basic gist: I have lists within a list like so: ...
1
vote
2answers
89 views

Mapping plots with multiple parameter values

The model I am trying to copy is this(not really necessary to look at it): https://www.wolfram.com/mathematica/new-in-10/plot-themes/table-of-plots.html but my problem is slightly different and I ...
2
votes
1answer
343 views

Mapping function with multiple parameters

So I am trying to print out a table using the map function. My code looks like this: ...
0
votes
2answers
138 views

Replacing For loop with multiple iterator with Table

I have written code for calculating cristofell symbol using for loop with 3 iterators for each coordinate ...
1
vote
3answers
58 views

Replacing undefined variables

Here's a MWE of what I want to do: a = 1; If[ValueQ[#], #, "Null"] & /@ {a, b, c} (*Actual: {Null, Null, Null}*) (*Expected: {1, Null, Null}*) What am I not ...
3
votes
0answers
116 views

How to ScanThread and ScanIndexed?

Why are there MapThread and MapIndexed but no analogous functions for Scan? What is the ...
11
votes
3answers
822 views

Best way to handle nested Maps?

I often find myself working with lists of lists of data, gathering data, performing computations, and producing a variety of different sorts of output. Intuitively, it seems like this should be done ...
2
votes
1answer
62 views

Im function won't distribute over a sum

When I take the imaginary part of a complex number times a function, I get the answer I was expecting, Refine[Im[(1+I) Cos[x], Element[x,Reals]] -> Cos[x] but ...
2
votes
0answers
64 views

Mapping of two functions by stretching and adding

Say you have two functions $f_1(x)$ and $f_2(x)$ that are the interpolation functions of two data sets $d_1$ and $d_2$, with $f_2(x)=Y(x)+f_1(X(x))$. Is it possible to find both functions $X(x)$ and $...
6
votes
3answers
492 views

Unexpected behavior with Map [closed]

Using Map, one can apply a function f to the elements of a list: Clear[f]; Map[f,Range[10]] (*{f[1], f[2], f[3], f[4], f[5], f[6], f[7], f[8], f[9], f[10]}*) But ...
1
vote
2answers
125 views

Change the coordinates from $(x,y)$ to $(\mu,\theta)$?

Suppose I have the following definition: $$ x=\cosh \mu\cos\theta, \quad y=\sinh\mu\sin\theta $$ I want to change the coordinates $(x,y)$ to $(\mu,\theta)$, suppose $x\in(-1,1), y\in(-1,1)$. Here ...
-1
votes
1answer
129 views

Equivalent to MapThread for lists of unequal length [closed]

I am looking for the equivalent to the built-in function MapThread that allows to map a function over lists of different length. ...
0
votes
0answers
28 views

Order of Map[] evaluation [duplicate]

Does f /@ list evaluate the f's in any particular order? For example, does it evaluate f on ...
2
votes
4answers
62 views

How to designate arguments in a nested Maps to get specified result?

Say I have two lists, list1 = {{a, b}, {c, d}} list2 = {{x, y, z},{x1, y1, z1}} and I want to map a function f over them to produce ...