# Questions tagged [list-manipulation]

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

8,817 questions
Filter by
Sorted by
Tagged with
1 vote
68 views

### Modifying list of lists to standardise lengths and field positions

Sorry, beginner here. I feel this should be simple but I'm struggling... I'm reading a set of race timing data from a web site and want to manipulate it into a list of lists that I can then export to ...
• 185
258 views

### Plot3D in Mathematica a function

How I plot the attached function $G(t,s)=s(t-1)$ for $0\leq s\leq t\leq1$ and $G(t,s)=t(s-1)$ for $0\leq t\leq s\leq1$(In Picature in Mathematica and How I change the color from yellow). I have tried ...
95 views

### Convert tuples to numbers [closed]

The link Convert string of tuple of numbers to complex number is perhaps a bit too advanced for me to understand, but I wonder if there is some easy way to convert tuples to integers, e.g. ...
• 1,273
167 views

### How to create patterns for DeleteCases / Cases / Select: deleting elements of a list, from the condition of a negative element in a column

I've been trying to create a simple and "human readable" instruction for deleting elements from a list with an specific pattern. I have the following list and I would like to delete the ...
1 vote
57 views

### Adding timeline to ListAnimate

I want to add time in the ListAnimate so that after I exporting the video I can see the graph changes by time. For example I have a graph that is changes by time, ...
72 views

...
1 vote
213 views

### Is it possible to separate two signals in Mathematica?

I have asignal and I would like to decompose it into two.. this is the datasetTot of both signals ListPlot[datasetTot, PlotStyle -> {Black, Black}] I know ...
• 3,517
455 views

### Modify one list according to degeneracies of another

I have two lists, each with four elements, let's say listA = {0.3, 0.6, 0.6, 0.9} listB = {0.1, 0.2, 0.3, 0.4} Notice that the second and third element of ...
• 1,967
134 views

### How to make a table with three columns?

I am trying to make a table with three columns containing the values of p, q and W. I have written the following code which gives multiple columns. I have tried Flattening the table. but I could not ...
• 664
373 views

### Finding the periodicity (or wavelength) in approximately periodic data irregularly sampled

I have irregularly sampled data that looks as in the picture. Is there a function in Mathematica that allows me to find an approximate or average period or wavelength? I know beforehand that the data ...
• 577
3k views

### Fastest way to generate {{a,a},{a,b},{a,c},{b,b},{b,c},{c,c}} from {a,b,c}

What is the fastest way to generate {{a,a},{a,b},{a,c},{b,b},{b,c},{c,c}} from l={a,b,c}? I've tried ...
• 335
1 vote
88 views

### Convert a polynomial to a vector [duplicate]

I am trying to transform a generated polynomial terms into a vector, I used the command 'MonomialList', ...
• 31
1 vote
30 views

### Efficient construction of a formal polynomial using list manipulations

I have a code which is probably extremely inefficient given my inexperience with Mathematica list manipulation. Take as input data: ...
• 1,307
188 views

### Parts of a Piecewise Matrix Function in NDSolve

First time posting. Reproducing the Problem I'm relatively new to Mathematica (using v.12.3), and working on a project. My problem can be reproduced with this. ...
98 views

### Abs applied with explicit map not giving same result as built in threading

I was making a code change that required me to change some code that looked like Abs[list] to something that looked like ...
112 views

### Introduce formal symbols indexed by natural numbers

I'm going to describe a toy example here which I'm hoping with some help, I can then soup up into the more complex application I have in mind. Suppose the input is a list of lists, and for now take ...
• 1,307
425 views

### 'Mapping' the values of a list to variable

Suppose I have the variable expr1 = a[n] + b[n], and the list stencil={-1,0,1}. I want to make a function ...
• 957
147 views

### Deleting sublists where an element repeats beyond a repetition threshold

I am looking for some help constructing a function Part[M_,N_] which outputs the list of all integer partitions of positive integers up to $M$ such that in each ...
• 1,307
62 views

### Create list with integer partitions satisfying some conditions

I want to create a function PartSet[N_,M_] of two positive integer variables which outputs a list of all pairs of integer partitions for all integers up to $M$ ...
• 1,307
48 views

### How to swap multiple values in a large list? [closed]

I have a large list of data points ({{a,b},{c,d},{e,f}...}) that I need to swap the elements of for each point ({{b,a},{d,c},{f,e}....}). This is specifically for a curve-fit, so the data needs to ...
944 views

### Partitioning a list based on a criterion for sublists

SeedRandom; alist = RandomInteger[{1, 10}, 20] {2, 5, 1, 8, 1, 1, 9, 7, 1, 5, 2, 9, 6, 2, 2, 2, 4, 3, 2, 7} I would like to divide this list into sublists (...
• 18.9k
87 views

### Select rows with a specific element from a given table

Lets say I have 4 rows in alist = {{1, 1, 3, 3, 1, 6}, {1, 1, 3, 4, 1, 1, x}, {1, 2, 3, 3, 1, 6}, {1, 2, 3, 4, 1, 1, x}}; If I want to select and print out ...
• 95
1 vote
31 views

### Placing plots around a circle with SectorChart

I need to position some graphs around a circle so that each occupies a sector. There're 18 graphs in total and the first five are shown below: ...
• 1,262
35 views

### Show list of points in NDSolve

When I was solving my ODE system with NDSolve, I obtain {x[t]->InterpolationFunction[{{1., 126.}},<>][t],y[t]->InterpolationFunction[{{1., 126.}},<>][t]} How can show a list point? ...
410 views

### Why False && {False, False} does not preserve list structure?

I am on Mathematica 12.1.1.0 trying to perform a boolean operation over every element of a list, but preserving the list structure. When I run ...
• 53
260 views

### Association vs Pair - Creation performance, Selection performance

Suppose that we ...
• 3,221
57 views

• 51
1 vote
70 views

### List of ordered pairs from a dataset

I have a dataset with Keys Biz Unit, Rate, Average. Rate and Average are numerical values and I want to pull them from the dataset as a list of ordered pairs without the keys. I've tried various ...
• 91
632 views

### Monitoring Apply / @@@ over large lists

How to monitor and/or print partial progress of Apply, e.g. f @@@ list? I have found answers using Map (e.g. this nice trick using Echo, or this general trick), but ...
• 243
53 views

• 912
60 views

### Displays a few lines on same graph

I've asked a similar question before, but this time I have a slightly more complicated issue. I have a list of lists, and I want to show a few of the lines in the list. The following code will plot ...
• 245
68 views

### Packed/Unpacked array - what object/like 0 or 1?/how to check/ [duplicate]

In Mathematica, there is a concept called packed array. ...
• 3,221
142 views

### Reducing list of pairs by summing repeating ones

I have a list of pairs $\{\{a_1,A_1\},\ldots\{a_n,A_n\}\}$. Suppose $A_i=A_j$ for some $i\neq j$. Then I would like to eliminate both $\{a_i,A_i\}$ and $\{a_j,A_j\}$ from this list, and instead of ...
• 361