Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.

learn more… | top users | synonyms (5)

7
votes
2answers
190 views

How to implement JoinTo efficiently?

AppendTo is not efficient so I'm not quite sure of the best way to implement its analogue for joining (e.g. in python this would be extend function). So how can this be improved: ...
5
votes
3answers
167 views

Add up data values for matching entries [duplicate]

Is there a function that extends Tally in the following way (essentially need an answer to this guy's homework question): the a ...
0
votes
1answer
57 views

make constant some elements of a list

how to give some elements of a list a value that be same always, and cannot change anyway. ...
2
votes
2answers
95 views

Selecting divisors of a large number that meet some criteria using the factors list

I have a list that represents a factorization of a number: its format is identical to the output of FactorInteger. I need to select the divisors that meet some ...
0
votes
1answer
61 views

Why the list rule is strange in the Cloud? [closed]

If we have some data,for example: data = Table[{i, i + 1, i + 2}, {i, 10, 80, 10}]; data[[All, 1]] Export["test.xls", %%] the output is: {10, 20, 30, 40, 50, ...
4
votes
3answers
110 views

How to get a line density from list density plot?

I have a list density plot from a list ls={{x1,y1,z1},{x2,y2,z2}}.... How can I extract the line density with a fix y, such that ...
3
votes
6answers
329 views

How to do this job without creating a new list?

I have a list {{x1,y1},{x2,y2}...} a list {z1,z2...}, I want to create a new list ...
3
votes
2answers
156 views

Merging Financial Time Series

I am trying to merge two or more financial time series. For example, ...
3
votes
0answers
63 views

Map level inconsistencies with Missing values [closed]

Negative Level specs interact with Missing values, eg: ...
3
votes
1answer
107 views

How to asign the points below a line to a specific value?

I have a list {{x1,y1},{x2,y2}...}. I want to create a list {{x1,z1,0},{x2,z2,0}...} with $z1<y1, z2<y2\cdots$, so that I ...
6
votes
4answers
915 views

How can I avoid using a For-loop in my code?

I am trying to avoid using For because I heard that For is not cool in functional programming. Below is a problem that the first ...
1
vote
0answers
46 views

FindPeaks “expecting an image” [closed]

I am trying to use FindPeaks for a list of data, but when I have tried to use it it returns an error. I went to the help menu for the function to check that everything is in the correct format, and ...
8
votes
6answers
211 views

An expression for the “perimeter elements” of a matrix

For example (5x5): m = Array[x[##] &, 5 {1, 1}]; MatrixForm@m I want to get a clockwise ordered list with the "perimeter" elements (they could be any kind ...
0
votes
2answers
43 views

How to restructure a list of {x,y,f[x,y]}-triples for use with Interpolation? [duplicate]

I have lists of triples {{x1, y1, f[x1,y1]},{x2, y2, f[x2,y2]},... }, which I would like to interpolate. In order to use Interpolation[], I seem to need a list ...
7
votes
3answers
132 views

Grouping by total length of elements grouped

How might one split a list of irregularly-long sublists into groups, each of which is shorter than a specified length? For example, given the following input: ...
4
votes
2answers
129 views

How can I get a list of the exponents of a polynomial? [closed]

I have a polynomial 1 + x^2 + x^4 + x^8 + x^9. I want a list of the exponents. {0,2,4,8,9}.
2
votes
1answer
66 views

Explicit Contraction of Tensor Indices [duplicate]

Is there any easy way to explicitly contract indices of several given tensors. For example, ...
4
votes
2answers
69 views

putting two lists in one ListLogPlot by one modified list

I imported two sets data one: ...
5
votes
3answers
231 views

Find when two lists are parallel with autocorrelation

I am working on a signal processing project with two oscillators. The first oscillator has a frequency $f_1$ that is independent, and the second oscillator has a frequency $f_2$ that increases, and ...
3
votes
1answer
84 views

Solving a list of equation which takes so much time

I try to solve a list of equation in a following way but it Mathematica solves equations after 30-40 minutes or don't solve them at all. The functions that I use are ; ...
1
vote
0answers
48 views

Concise use of list addressing

I very often work with Lists of Lists (trend data exported from other programs). Sometimes the start times of the important data ...
4
votes
0answers
149 views

Tracking coordinates [closed]

I have a list (=data) of 2d coordinates, whereby: Dimensions[data] = {l, m, n}. The coordinates (index n) are belonging to ...
3
votes
3answers
139 views

Declaring lists

Do I have to declare a list before using it in a loop? for example: For[i = 1, i < 10, i++, A[[i]] = i]; The output is: ...
1
vote
0answers
57 views

Finding correct combination of functions

I am trying to write code where I have an array $S$ or numbers in any order [5,4,2,1,....] Then I have a specific set of functions that I can write. ...
3
votes
2answers
91 views

Creating all permutations of list with “alignment”

I need to find all permutations of a list satisfying a condition but I'm lost about how to do so. Given a list I want a write a function to produce all permutations such that the list is "top aligned" ...
3
votes
3answers
116 views

Mapping at arbitrary nested list [duplicate]

This is a candidate for a duplicate (probably from the documentation) but I've ironically failed to find the direct analog so far. I have an arbitrary nested list, say: ...
1
vote
1answer
47 views

adding offset to a list of points [duplicate]

I'm trying to duplicate this behaviour: {a,b,c}+1={a+1,b+1,c+1} in two dimensions. In other words I want to have: ...
3
votes
3answers
64 views

How-to select an entry from a list of pairs that meets a condition depending the 2nd element of each pair

Processed data structure data = Transpose[{RandomInteger[{1, 20}, 100], RandomReal[{10^-8, 10^-1}, 100]}] You can download the actual raw data structure here. ...
1
vote
0answers
29 views

Fast arithmetic on matrix elements

I have a square matrix $U$ of dimension $L\times L$, I am interested in the following quantity $U_{1,j}U_{2,k}U_{3,l}U_{4,m}\cdots U_{L,q}$ summed over all permutations of the letter indices, ...
6
votes
5answers
140 views

Simple Enumeration of Coin Tosses

How do I enumerate a sample space with up to 6 coin tosses where 4 Heads ensures a win. For e.g {HHHH},{HTHHH},{TTHHHH},{HTTHHH} etc.I tried the following but I do not know how to do a variable length ...
0
votes
2answers
97 views

How to map the second highest value in each row of a matrix

I have a matrix with three or more columns called mat. I would like to map the second highest value in each row of mat into its ...
5
votes
3answers
328 views

Mean distance beween nearest 2 coordinates

I have as an example the following 2d-coordinates: ...
8
votes
3answers
286 views

How to evaluate if a list obeys the Normal distribution?

I am processing a data when I encountered this problem. I use the way of plotting the "normal probability plot" to show the result The list I have is: ...
4
votes
2answers
68 views

Find Instance with Set Membership Condition

Given two vectors $u=(x_1,\ldots,x_n,a_1,\ldots,a_s) \in \{-1,1\}^{n+s}$ and $v=(x_1,\ldots,x_n) \in \{-1,1\}^n$ and a bunch of fixed vectors $c_1,\ldots,c_k \in \{-1,1\}^{n+s}$ and $b_1,\ldots,b_k ...
15
votes
2answers
300 views

Which elements of a large array are part of a set?

I have a large integer packed array arr. My array is multidimensional, but for simplicity let's consider 1D arrays for now. ...
3
votes
2answers
176 views

Tracing 2d coordinates by using Nearest function

In 5 digital images I have determined the 2d coordinates of detected objects. The resulting coordinate list can be downloaded from here: http://pastebin.com/7bE0CEJ5 ...
6
votes
4answers
593 views

How to replace a space by a comma

in this expression = "{1 2 3 4 5 6 7 8}", I want to replace each space by a comma , to get ...
0
votes
1answer
34 views

Repeating the first row of a matrix; subsequent rows depend on the first row

I had asked this question at an initial level before; thank you to all with your suggestions. Now this problem is getting complicated and I am unable to figure it out. There is a 10x10 matrix of ...
1
vote
1answer
53 views

Assemble rule replacement from pairs of positions

I want to create a rule replacement list, which I then use to create a SparseArray. The input is a list of positions of the from ...
0
votes
0answers
46 views

Can't operate on vector within a list of rules

I'm trying to set up a list of rules which includes the following: ...
1
vote
1answer
62 views

How to find the detailed Dimensions information of a list

In 5 digital images I have determined the 2d coordinates of detected objects. The resulting array (list) can be downloaded from here: http://pastebin.com/7bE0CEJ5 ...
-3
votes
1answer
134 views

Why doesn't Thread always thread? [closed]

What is the rationale for Thread not threading as a side effect if the arguments of the function to be threaded can be fully evaluated? For example, ...
1
vote
1answer
86 views

Why does my threaded function need to be substituted?

In my code I have ...
5
votes
3answers
129 views

Changing the first row of a matrix; subsequent rows depend on the first row

I have generated a matrix of zeros. tab=Table[0,{i,10},{j,10}] tab is defined such that given ...
6
votes
3answers
71 views

Using Select on a 2d table with a criteria that accepts 3 parameters

I have a table sets := Table[{i, j, k}, {i, 1, 10}, {j, 1, 10}, {k, 1, 10}] and I want to use a function that accepts three parameters and returns a boolean, as ...
6
votes
2answers
147 views
3
votes
1answer
118 views

Creating a custom color plot with tones of colors

Here is a sample set of data ...
3
votes
3answers
85 views

How to pair-up nearest elements from different lists

I have two long lists (of different lengths) of complex numbers. There seem to be some close pairings, so I'd like to explicitly pair elements from each list with their nearest counterpart in the ...
3
votes
4answers
153 views

Sum the first element of a list

Suppose I have a list of the following: list={{1,2},{1,6.5},{1,6},{1,0}....{1,36}}. Let say the Length of the list is 300. I would like to sum the first member of ...