# Questions tagged [list-manipulation]

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

5,665 questions
Filter by
Sorted by
Tagged with
0answers
2 views

### Unable to operate on the table imported from .mx file

I saved a table by exporting it to .mx file. Now, when I import it back, it gives me the desired output. So, to work with elements of the table, I first define the imported table as (res2 = Import["...
6answers
103 views

### Joining lists with same elements

Let's assume that we have the following three lists ...
2answers
76 views

### How to check whether a sublist exist in a huge database lists in a fast way?

I have a database for example datatest (Length[datatest]=10) : ...
1answer
101 views

### Combining 2 Files . 1 line to many lines

2 Files A and B. A has 2593 lines and B has 18900000. I would like to Take A[i] and associate(added to the same line) it with 720 lines of B. Then A[1+1] associate it with the next 720 lines in B. ...
0answers
39 views

### 1D rotation of a list on reals about about a given value

I am seriously having a brain fart. Suppose you have a list of real numbers ranging from 1 to 4. ...
2answers
81 views

### Ordering a list of integers

I have a list of integers which I am trying to order in the following way: remove all zeros from the list sort in increasing order of absolute value put positive values before negative values I.e. ...
2answers
100 views
+100

### Create an animation to pause at the specified location

How can I pause play at the specified location when export a gif file or using Animate? I want it to run automatically, no need to interact with the mouse. Here is an example: ...
0answers
31 views

### Grassman and Clifford algebras as quotients of the tensor algebra

I've been working with tensors in Mathematica; it's great to have something like TensorProduct built-in with linearity and everything. Maybe you can take advantage of these structures to work with ...
1answer
50 views

### Dotting two vectors that are contained in a list

Is there a way to dot two vectors that are included in a list? Let's say I have two lists that contain a couple of vectors ...
3answers
108 views

### Splitting a list into two lists each containing a range of elements from the initial one

If I had a list of let's say 20 elements, how could I split it into two separate lists that contain every other 5 elements of the initial list? For example: ...
1answer
41 views

### Merging two lists as a twisted comb [on hold]

We have two separated lists as list1={{1,2},{3,5},{5,8},{18,3}}; list2={{1,1},{7,15},{10,1},{17,3}}; But we have to reach at ...
2answers
164 views

### Bug or undocumented behaviour in Intersection

I have two lists consisting of element pairs: a1 = Table[{i, i^2}, {i, 10}] // N; a2 = Table[{2 i, Sqrt[i]}, {i, 5}] // N; I want to pull out from both lists ...
1answer
37 views

### How can I consolidate mapping code between different levels of lists?

I have a list with the following structure: ...
3answers
214 views

### Find sublists in a list by contents, then union them

I want to find two sublists in a list by an element they contain, and then union them, keeping them in the list. I have this code that seems to do the job, but it seems rather clunky. Is there a ...
2answers
65 views

### Replacing duplicates in a list

I have a list that looks like: {{-5,0,-8,-3},{0,3,-3,0},{3,-4,0,-7},{-4,-1,-7,-4},{-1,4,-4,1},{4,-3,1,-6},{-3,0,-6,-3},{0,2,-3,-1},{2,5,-1,2},{5,-2,2,-5}} I ...
1answer
24 views

### Using Select and AllTrue to filter elements of a large nested list based on relations between elements of the smaller nested lists

I tried searching but all similar questions seemed to be based around one Boolean logical statement. I'm dealing with a nested list of pairs partitions of integers, such that the sum of the two ...
2answers
138 views

### Collect data points in a list into weekly groups?

Consider data of a format such as ...
3answers
3k views

### Flatten at a certain level

In an earlier question the brainteasing fourth syntax variant of Flatten was discussed. I see that with ...
4answers
757 views

### How best to join tables, which have different lengths on the same column values which exist in both tables?

I think my problem is pretty simple, and in SQL this would be trivial. I have two tables ...
2answers
174 views

### Show two plots together: a two dimensional curve tangent to the maxima of a three dimensional plot

I have a list containing 3 columns and 6552 rows which can be found here. The plot of data is shown below: We have a cross cut ...
4answers
258 views

### Select elements of a list by comparing it to another list

Suppose I have the following lists: ...
1answer
76 views

### How to use indices during Map?

I want to map a function on each element at the "deepest" level of a list. The list can have an arbitrary number of dimensions. The function needs the indices of the element to which it is being ...
1answer
179 views

### What is the best way to use errors in mathematica M12?

Since ErrorListPlot has been superseded by new functionality in ListPlot for Mathematica 12.0, what is the best way to handle ...
0answers
28 views

### Problems with the parametric Recurrence Table

I am trying to construct a minimization program where I have to minimize a function with respect to a matrix. This matrix enters into the optimization program in a convoluted manner together with data....
4answers
388 views

### How to obtain a subset (of a 2-d set of points with random coordinates) having monotonically increasing ordinates

If I start with a 2-d set of points: ...
3answers
352 views

### How to show decimal points on the axes frames in mathematica?

I have a set of data g1 and when plot using n1, i got the plot shown in figure below. I need to change the x-axis label from (1,2,3,4,5...) to (1.0,2.0,3.0,4.0,5.0) and y-axis label from (50000,...
9answers
6k views

### Map and Apply a function on a nested list

I have a list like this: {{1,2}, {4,2}, {6,4} ... } I want to replace every second number with a function of that number. For e.g. ...
9answers
492 views

### How to substitute values from a list into a function?

I was hoping to take pairs of numbers from a list and substitute them into a function. So if my list was list = {{1,2}, {3,4}, {5,6}} and my function was <...
4answers
115 views

### How do I pass a “list of lists” as the argument to a function of the form F[x,y]? [duplicate]

I have a function F[x,y] and a list of the form: {{a1,b1},{a2,b2},{a3,b3},{an,bn}} Basically, I want to pass the list ...
4answers
396 views

### List, map function based on a condition

I have the following list: ...
1answer
115 views

### Numerically convolve lists in mathematica

I have a function $$\chi(x) = \frac{a^2}{a^2 + \left(\frac{d^{2}}{x} + x\left( \frac{ab}{x^{2} - c^2} - 1 \right) \right)^{2}}$$ which I would like to convolve with the Fourier transform of the ...
1answer
136 views

### Using Select on Dataset with missing keys

I have a very large dataset with about a million entries with up to 75 keys each. Across the whole dataset about half of the keys are blank. In order to reduce filesize, I have used the following ...
3answers
466 views

0answers
92 views

### Calculate the intersection points of a line and a parametrically defined 3D surface

Thanks to Henrik Schumacher for advice to simplify the sample code: I would be grateful for any pointers on the following issue. A line from an external point intersects the surface at 2 points (...
3answers
45 views

### How to making a repeting list out of tables?

I'm a little bit trouble with the below task, I'd like to make a repeting list out of a table. This is the starting point for the list And I like to make them into this form: How should I make this? ...
2answers
338 views

### Map vs. Table for index-specific operations on 2D arrays

Many experienced users on this site tend to use Map (and its variants, MapAt, MapIndexed, etc.) rather than Table. When applying the same operation to every element of an array, Map does seem more ...
5answers
286 views

### Return last number in sub-sequences in a list of integers

Given a list of integers like this: z = {113, 117, 118, 119, 120, 121, 475, 476, 529, 538, 542, 543, 544} I want a function that returns: ...