The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
1answer
88 views

How to map an inequality to a list?

vars = Table[Subscript[a, j], {j, 5}] We can do the total Total[vars] and produce ...
5
votes
3answers
207 views

how to concatenate a list of a list of strings

I have two lists of lists, La and Lb that I want to concatenate so that every element of a list n in La is concatenated with the corresponding element of list n in Lb. For example: La = {{P, O, O, ...
2
votes
1answer
66 views

Use Map with multiple arguments over a nested list

I noticed there are a few similar questions to mine on here, but I couldn't figure out how to accomplish this mapping. I have sets of data I want to plot, which represent intensity and frames, and I ...
3
votes
2answers
65 views

Faster use of Condition for a large array (see the example)

Here is the example/problem. I have a array of $n$ random number. n = 2000; p = RandomReal[{0, 9}, n]; I have to create a $n\times n$ sparse matrix with ...
6
votes
2answers
166 views

Speed and the MapThread function

Can anyone help explain why MapThread is so slow in this simple case? ...
1
vote
1answer
64 views

How-to implement iteration over a result of an iteration in a functional way

I have a pure function f:= #1 * #2 * #3 &; Which I can invoke in a following way: f[#,2,3]& /@ {1,2,3} Which ...
4
votes
1answer
127 views

Applying function to cartesian product of two lists

I have two lists X = {1, 2, 3}; Y = {5, 6, 7, 8}; I want to apply function g[x,y_,z_] to all pairs from X*Y, so I need to ...
4
votes
2answers
183 views

How to convert a list of 3D points to a list of distances?

How do I apply a function (this case EuclideanDistance) between element i and i+1 on a list ...
2
votes
1answer
59 views

Map function with a counter

How can we embed a counter in the Map function? Consider a data set such as data = {{a, b, c, d}, {e, f}, {g, h, i}}. The ...
0
votes
0answers
43 views

Referring to arguments in nested functions

I am interested in executing the following command but don't know the proper syntax to distinguish between nested arguments, here at the Select[] and Map[] levels. For example, ...
17
votes
2answers
424 views

Can A Plot Be Overlayed With A Map?

Some brief, only slightly important background. I am doing a research project using the data from NASA's GRACE mission. I wrote a short Perl script to take two data files and find the change in ...
3
votes
1answer
61 views

Map with multiple arguments

I have a function f[m,n] and a list of arguments args = {{m1,n1},{m2,n2},{m3,n3},{m4,n4}, ...} that I want to apply to it. I ...
3
votes
1answer
109 views

Map an Argument to a list of functions

I want to "map" an argument to a list of functions. Here is the concrete Problem. I generate a list "Messungfit" of functions: ...
0
votes
0answers
61 views

Loop in a loop, or how to evaluate complex expressions

I need to find $h_{0j}$ for every $1\leq j\leq300$, where \begin{multline*} h_{0j} = \sum_{q=1}^{Q}g_qe^{-\lambda_q j\Delta}\frac{e^{\lambda_q\Delta}-1}{\lambda_q} + \sum_{p=1}^{P}\frac{e^{-\alpha_p ...
1
vote
2answers
59 views

How to generate commands which are very similar?

I have several data sets that I wish to interpolate and integrate like this: ...
5
votes
2answers
114 views

A problem with Compile and Map

There is a weird behavior of Compile that I do not understand. Consider the following example: ...
0
votes
1answer
82 views

How do I manage my memory better when using the Map function?

So I'm attempting to write a Mathematica program that prints a range of natural numbers as the sum of four cubes. I wrote the following Mathematica code to try this, but am running into a memory ...
0
votes
1answer
50 views

How to switch keys in a Map to Association [closed]

I have an association that has parameters for a function. These parameters represent two cases that need to be applied to the function. Some parameter values are common to both cases but some are ...
0
votes
0answers
174 views

Differing results with Map and ParallelMap

I am using Mathematica 10.0.2 and I am trying to change the string Class_1 to 1, so I use the following code: ...
5
votes
6answers
255 views

Indexed Map Thread

I'm attempting to MapThread a function of two lists that requires the index of the list values. For example, MapThread[#1*i+#2*j&,{{a,b,c},{e,f,g}}] Where #1 ...
0
votes
2answers
42 views

Different behaviour of Map and Inner in replace rules

Why does x[{1, 2}] /. {x[l_] -> Map[func, l]} {1, 2} not behave as expected, while for example ...
4
votes
3answers
147 views

How to map over inner keys of nested Associations?

Considering an association: <|"a" -> <|aa-> "asc", bb-> "asd", cc-> 0, ImageType -> "asd", dd-> "asd"|>|> How can I make the inner ...
0
votes
1answer
73 views

What is the “proper” way of multiplying a list of vectors by a matrix? Why Map does not work? [closed]

I am an absolute newbie with Mathematica, so please forgive me if this is stupid, but for the life of me I can't solve this. Suppose I have a list of vectors $b_{1...n}$ and a square matrix $A$ and I ...
2
votes
4answers
175 views

Using Map sequentially

I'm trying to simulate the probability of a balanced hand in Bridge (The Theory of Probability by Santosh S. Venkatesh, 2013) using Mathematica. The problem is solved in the textbook but I just wanted ...
0
votes
0answers
41 views

Why does ParallelMap throw errors where Map does not?

I am encountering a problem with ParallelMap. I have a call in a large code base, part of which attempts to fit data in parallel using ...
0
votes
1answer
62 views

Tutorial for Map, Apply, etc

I have this code: ...
1
vote
1answer
76 views

Misunderstanding the difference between Map Apply (@@@) and Map (/@) [duplicate]

Here's a minimal working example of a problem I'm having: ...
4
votes
1answer
161 views

MovingMap maps to second level unexpectedly

I'm trying to build a financial indicator in mathematica. I import some historical data ...
1
vote
3answers
98 views

MapThread (or alternative) for adding fixed option

I currently use MapThread[f, {{a1, a2}, {b1, b2}] for obtaining { f[a1, b1], f[a2, b2] }. Is there a version (or alternative) ...
0
votes
2answers
70 views

How to change list to a list of points

I have a list of angles {a1, a2, .... , an} and I would like to have a list of points ...
8
votes
5answers
230 views

How to Map a function with HoldAll attribute

First of all, I'm not sure about the title of this question, so please correct me if there is any title more sensible than mine. The problem is the following: I have a function f that checks if a ...
2
votes
1answer
88 views

Fixed Points Problem with 2D Mapping

I have been playing with the mapping given by ...
3
votes
1answer
122 views

Parallel Apply on a deeply nested expression

I have a deeply nested expression, i.e. something like {{{{...}..}..}..}, and I'd like to use Apply in a parallel fashion, e.g. ...
7
votes
3answers
357 views

Functional equivalent of a For loop referring to consecutive elements in a list

I have implemented this function which smooths the values in a list by, if it encounters a zero, replacing this entry by the average of its two neighbours (apart from the first and last values of the ...
2
votes
2answers
164 views

Adding map to 3D plot?

I've made a 3D plot of a pressure surface over the region 160W-20W, 20N-80N - the right panel and I would like to put a map under it, probably just continental outlines for simplicity. I'm just ...
2
votes
0answers
57 views

Is there an equivalent to MovingMap[] for functions that work on more than one TimeSeries?

I have a family of functions that require two TimeSeries (A and B). As a trivial example, imagine a function called beta[tsA_,tsB_] that determines the slope of the linear regression line for the ...
5
votes
2answers
139 views

Indexed Thread on dataset and list

I currently have a dataset, and I would like to add a column based on another list. For example: ...
2
votes
2answers
91 views

How to use select and map together

I have two lists, list1 and list2. I want to Select from ...
0
votes
2answers
66 views

How to continuous apply a function to an argument? [duplicate]

In order to calculate x = sqrt(1 + x) for a given number x, 40 times, I tried this: ...
1
vote
1answer
47 views

Summimg peculiar nestings

I have some lists with peculiar nestings: ...
3
votes
3answers
258 views

Use map on a different level

I have just started to get used to Mathematica's Map, Apply, and related functions, and I can't figure out how to do maps that require working "one level down". For example, I am currently trying to ...
0
votes
0answers
85 views

map of Europe as histogram

I want to make a histogram using the map of Europe, such as this or similar: thanks to all
0
votes
1answer
52 views

Fastest way to make division between a number and elements in a list [duplicate]

I have a list y={{a,b},{c,d},...} of dimension {10^5, 2}, and number x. I want to divide only the second part of each element of the list by x, and have as result a new list {{a,b/x},{c,d/x},...}. ...
0
votes
1answer
101 views

Superpose a map and a region plot

I would like to add on a map of city a region plot, which is this one in this case : ...
2
votes
1answer
107 views

Why is Nearest not giving me expected result

I have the following list: numbers={0.,0.6,0.8,1.,1.2,1.4,1.8} Then I calculate the midpoints: ...
0
votes
1answer
53 views

Elegant ways of solving this file batching task

There are a batch of data files in a folder (dir = "D:\\Documents\\datadir"), each of which consists of a list of data items, one per line. Each data item is a pair ...
2
votes
3answers
88 views

How to test a condition for a list and output all the expression that is true?

Suppose that I have a list lis={x-y,x+y,x*y}; and a function f[a_,b_]:=#/.{x->a,y->b}& I want to output all the ...
4
votes
2answers
78 views

Count the number of element repeats at various distances

I have a function of x: f[x_] := Abs[Extract[list, x + n] - Extract[list, x]] I then apply this: ...
1
vote
1answer
77 views

For loop with MapIndexed and If [closed]

I have a for loop that uses MapIndexed and If to build a a list called avald1. The problem ...