Questions tagged [list-manipulation]

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

Filter by
Sorted by
Tagged with
6
votes
6answers
306 views

Certain search in list

A list $LL$ of $n$ real numbers is given. For each element $e$ of $LL$ to find the position of the closest to the right element of $LL$ which is at least twice bigger than $e$ and return it. If ...
-1
votes
2answers
78 views

Sum with list as its upper limit

Say I want to create the list $\{ \sum_{j=1}^{5} 2j, \sum_{j=1}^{6} \frac{5j}{2} \}$ I guessed that this can be done using the code ...
7
votes
2answers
77 views

Parallelizing MapAt

What is the best way to parallelize MapAt? Only ParallelMap is provided, but seems bad when executing functions on a subset of a ...
1
vote
2answers
60 views

Make a function of a list of expressions

I have a family of functions, each of which takes a long time to build the expression. Once the functional form is determined, however, calculations are very fast. So I want to build a table of ...
7
votes
5answers
282 views

How to generate all commutative pairings of list elements?

Given a list with an even number of elements, e.g. list = RandomSample[Array[e, 20]]; how can one generate a list of all different commutative pairings of the ...
0
votes
0answers
47 views

PauliMatrix tensor product

My Pauli matrices are: ...
5
votes
3answers
171 views

Select items in a list that contain criteria #2 [closed]

In List: Tuples[{1, 2, 3, 4, 9}, 4] How can I select all items that contain only two "9"? Result: {{1, 1, 9, 9}, {1, 2, 9, 9}, {1, 3, 9, 9}, {1, 4, 9, 9}, {1,...
7
votes
4answers
505 views

From the list of 3-tuples, how can I select tuples which contain one for more nines? [closed]

From the list Tuples[{1, 2, 3, 4, 9}, 3] how can I select exactly those 3-tuples that contain one for more nines? This is the result I want: ...
1
vote
1answer
51 views

JoinAcross with multiple associations

I would like to use JoinAcross to combine several lists of associations. Extending an example from the documentation, I'd like to do this: ...
1
vote
3answers
71 views

Expressing an Edge List as a 0-1 Table with Headers

Consider the edges ...
2
votes
1answer
39 views

Eliminate date in a list [closed]

I wish to eliminate the dates of my list of BTC prices so that I only have the prices left (I do not need the dates for the purpose of my analysis). The list appears as follows: Is there an easy ...
10
votes
4answers
184 views

Efficiently merge lists chronologically without duplicates?

Prepare some dummy data to investigate: ...
4
votes
1answer
51 views

Counting the number of duplicates in a list

What is the quickest way to count the maximum number of duplicates in a list? For example, the maximum number of duplicates in {1,1,1,3} is 3, in {1,1,2,2} is 2 and in {1,1,1,2,2,2,3,3} is 3. I've ...
7
votes
4answers
210 views

Finding x,y coordinates where y is largest

Suppose I have the following list of $x,y$ coordinates: ...
2
votes
0answers
36 views

Error with combining lists

I'm attempting to combine lists of the form ...
13
votes
3answers
630 views

Concise way to draw this pyramid

I wrote the following to draw a pyramid, this approach uses functions TranslationTransform and Tuples, is there a way to do the ...
3
votes
1answer
43 views

Taking multiplicities into account when counting the elements of a list

Say we have a list l = {4x,3y,z} When we do Count[l,x] we get, as expected 0 Is there a function, call it F, that ...
0
votes
1answer
55 views

How to transpose a data of N lists?

I am using a command like this data = Transpose[{t1, Table[z1[[i]], {i, 1, 10}]}] //Tableform There will be N lists t1,z1[[1]],...z1[[10]] I would like to ...
0
votes
1answer
66 views

How to make split tables in Join?

I have a command Table0[mS_]:=Table[{mS*i,i^2},{i,1,20}] Table1=Join[Table0[1],Table0[2],Table0[3]] When calling Table1[[1]] I expect to get the element Table0[1]...
0
votes
1answer
38 views

Tracking back a variable corresponding to an output

I have a function: ...
3
votes
5answers
101 views

How to rearrange the terms in polynomials to the power of x?

Here is my code Eliminate[y == x + n && x^2/6 + y^2/3 == 1, y] I got 6 - 3 x^2 == 2 n^2 + 4 n x But I wanna it to be ...
9
votes
4answers
627 views

Select row of data if next row contains zero

I am a new user of Mathematica, and just faced a problem. I have a data set of three columns, and want to select only those rows that go before the rows, which contain 0 in the third column. ...
1
vote
4answers
90 views

How to put solutions of mutiple DEs with NDSolve in table

I have $N$ differential equation for each $s \in {1,2,...,N}$ on the domain $x \in [1,2]$ of the form (e.g.) $xf_s'(x) + \log(xs) f_s(x)+1 = 0$, with the boundary condition $f_s(1) = e^{-s}$ Now I ...
5
votes
1answer
87 views

Mapping a function f[xi_,xj_] over a list {x1, …, xn} with the i < j restriction

I am often facing the situation where I have a list $\{...x_k...\}$ and where I want to compute: $$ \{...f[x_i,x_j]...\}\text{ with }\ i<j $$ Unfortunately, I have not been able to find an ...
0
votes
0answers
57 views

Import and merge PDF files

I have a folder with several pdf no more than 50, I would like to import them to be disordered and that the output was a single pdf (you can imagine it as a proof of form A and we want to produce form ...
0
votes
0answers
27 views

Problem with UnitConvert with a list

I'm studying this part of the course units convert I have two list the first: is in Megaparsec and I need to transform it to kilometers ...
1
vote
2answers
53 views

Pull the data from a set of chosen rows of a table

Suppose I have the matrix shown. Suppose I want the entire row data associated with specified column IDs 106, 110, 109. The output would be {106, Job2, J2},{110, Job7, J7},{109, Job5, J5}. ...
0
votes
0answers
26 views

Taking tuples of a variable number of lists?

I have a number n lists indexed by i as list[[i]], how can I write a function which outputs all n-tuples of elements in these lists when I would like to vary n?
1
vote
1answer
43 views

What is the number of contiguous subsequences in this binary word?

I want to count the number of times the contiguous sublist 0,1,0 occurs in the binary word 0,1,0,1,0,0,1. It occurs twice. I ...
0
votes
0answers
32 views
0
votes
1answer
52 views

Delete elements form a list with elements with strings and numbers

I am trying to create a list list2 removing elements from a list list. The structure of list...
3
votes
2answers
177 views

Condition on all eigenvalues of a matrix

I am going to help Mathematica to satisfy the condition: If all elements of a matrix's eigenvalues are different from zero, then print "ok" For ...
6
votes
4answers
200 views

Take elements from a list based on two criteria

I am trying to take elements from a list of tuples using 2 criteria. An example of the list is: list={{-1, -1}, {-1, 1}, {1, 1}, {1, -1}, {1, (1 + I)/Sqrt[2]}} ...
1
vote
1answer
65 views

How to join two matrix with different dimensions?

I have two matrices with different dimensions I want to join them together in one matrix. for example, I have two lists of diseases associated with their symptoms in both matrix, what I want is to ...
2
votes
2answers
82 views

Is there an efficient way to fill in the elements of a matrix as m11,m12…etc?

I want to autofill the elements of a matrix (or list) by m11, m12, etc. I am able to autofill using ...
14
votes
2answers
716 views

Flatten not working

I am trying to modify some code proposed here Part assignment is not a symbol and I cannot manage to make Flatten work. I write ...
0
votes
1answer
76 views

Breaking up a list of lists

I have a list of values stored in SortedLat, where SortedLat is a list of 74 sublists, and each sublist has its first element be a string. As you can see I am trying to create the first column for a ...
1
vote
0answers
78 views

Visualizing a huge weighted graph

Consider a weighted graph 'net': ...
4
votes
2answers
192 views

List of lists elementwise greater/smaller than

I have two lists a = {{3,1,2},{5,1,3},{4,1,1}} b = {{4,0,3},{4,2,2},{5,0,2}} And would like to compare each element within ...
2
votes
3answers
210 views

Find the 3D region containing the origin bounded by given planes

I'm writing a code to generate the Wigner-Seitz cell of the reciprocal lattice for a given set of lattice translation vectors. For example, consider the Body Centered Cubic (BCC) lattice whose basis ...
3
votes
3answers
176 views
6
votes
2answers
78 views

Merging two rows with rounding their first elemnts

Mathematica shows my data in the below style: ...
8
votes
2answers
1k views

Why does a table with a defined constant in its index compute 10X slower?

I need to do some iterative summations. Here is a minimum working example: ...
6
votes
2answers
145 views

Sorting upon the first element of a nested list and show that as numerical values

I wish to sort the below list upon the first elements: ...
0
votes
1answer
71 views

How to create a list of undefined functions?

I have a undefined function $\phi[i,j]$ where $i=0,1,...,m$ and $i=0,1,...,n$. How can I generate this list: {$\phi[0,0],\phi[1,0],...,\phi[m,0],\phi[0,1],\phi[1,1],...\phi[m,1],\phi[0,2],...,\phi[m,...
4
votes
3answers
209 views

Deleting the same lines from a list

Say I have a list of Lines: ...
3
votes
2answers
167 views

Applying FoldList to its own output

I'm trying to figure out a functional way to essentially apply FoldList (or some related function such as Nest or ...
2
votes
0answers
45 views

How to calculate a projection of x,y,z data to x any y plane?

I have a List containing x,y,z data, which I can plot nicely in a ListContourPlot: ...
-1
votes
1answer
49 views

Finding longest repeating sequence in a list of lists [closed]

I want to find the longest repeating sequence in a list of lists. ...
3
votes
1answer
74 views

Applying dot product to list of vectors

Suppose I have: w = {1,0}. I want to apply the dot product of w to each element of the list of vectors ...