# Tagged Questions

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

117 views

### Function to naming columns

I often import files from excel or csv files and they come in a format like this: ...
948 views

### Convert list to sequence

I was just thinking how Tuples was created so , I came up with this, ...
180 views

### Factorization of a list with composite integers to a combined list of all prime factors

The following function io[aIn_] produces a list bOut containing ALL the prime factors of an Integer via the standard function FactorInteger[]. My code is: ...
303 views

### Manipulating sparse array elements

Suppose I have two sparse arrays ...
317 views

### Enumerate the 1-factors (perfect matchings) of $K_n$

Introduction I would like to enumerate the 1-factors, or (near-)perfect matchings, of the complete graph Kn. The adjacency list representation for Kn is basically { (x, y) | 1 ≤ x < y ≤ n }. For ...
241 views

### Selecting index position of data from a table that is less than a certain value

I have a table of numbers with a few thousand entries, and I'm trying to find the first index that is less than a particular value. An example of the table I'm working on is as follows: ...
209 views

### Join lists of lists with unique id

Sorry for the vague title, but I can't describe my problem properly and shortly. I am maintaining a list of players and their games with the following form: ...
1k views

### Collecting lists using Reap/Sow

I have a list like {{a,x},{b,y},{c,x},{d,z},{e,y}} and would like to produce from it a list formed by collecting all top-level elements whose second components are ...
219 views

### Speed up Select on large list

I am running this on a very large list, it is important to notice that some times the dates in v occure several times, and I want the selected list to show the same amount. This produces the right ...
61 views

### Given a list of pairs, average the second elements of pairs whose first elements match [duplicate]

Say this is my list: mylist={{1,4},{1,6},{1,11},{2,12},{2,14}} I want to do an operation that looks at the first element of each pairs, and for all those that ...
151 views

### How to convert multidimensional matrix into regular matrix?

I have this multidimensional matrix: {{{{a1, a2}, {a3, a4}}, {{b1, b2}, {b3, b4}}}, {{{c1, c2}, {c3, c4}}, {{d1, d2}, {d3, d4}}}} I would like to convert it into ...
119 views

### How to work with lists of functions

I have some lists of interpolated functions and I want to know if there is an easy way to operate with them. A simplified example: ...
770 views

### Finding elements from a sparse matrix

I am dealing sparse matrices of very large dimensions. I need to locate the positive and negative elements of the matrices and make lists of their corresponding positions. Of course I can write a ...
486 views

### Nested list to graph

The following nested list can be regarded as a representation of a (tree) graph: ...
227 views

### How to make sure Table or Do only runs through specific values?

I often need to generate or run through very large numbers of integers (we're talking {i, 1, 10^9} and higher) and want to add certain integers to a list, say ...
966 views

### Fast way of finding position of Interval containing an Integer

I have a large list (about 2.2 million) of pairs of integers. Each pair defines an Interval[{}]. Given some integer x, I need to ...
68 views

### Conditional clustering of elements

I have a long list like: ...
114 views

### MapThread over a nested list

This may be a simple question. Please close it if it is already answered. I have a nested list kr = {{35, 32, 27, 20}, {36, 33, 28, 21}, {37, 34, 29, 22}} I ...
57 views

### Filter through list and lump data [duplicate]

I have a very large data set (around 3000) that looks like: ...
191 views

### Exporting a list as RawData or Data

My problem is quite simple yet I do not seem to figure out the solution to it. I am simply trying to export a list in Mathematica, actually a list of lists of lists etc, something like ...
107 views

To help distinguish the various dimensions, I have a model which outputs a vector in a series of time intervals, I then construct a list of these models. Next, I would like to compute the outer ...
335 views

### Drop selection of columns from a ragged array

I have an application where I need to drop some arbitrary list of columns from a ragged array (where of course the shortest array rows have at least all the specified columns). E.g., given a ragged ...
125 views

### Importing and manipulating data in HDF format

I have two matrices A1 and A2 in HDF format. I use the following code to import them. ...
192 views

### Plotting data in a weird format

I have a lot of data on the following form: data = {{param1,param2,param3,param4,{{x1,y1},{x2,y2},...,{xn,yn}}},...} The first variables in each sublist are ...
93 views

### Sorting non-numerical lists [duplicate]

The Sort function will by default sort from lowest to highest. In[1]:= Sort[{3, 1, 4}] Out[1]= {1, 3, 4} However, if the list ...
147 views

### Unexpected output from oddSublists [duplicate]

I have just bought Mathematica and I'm in the process of plowing through Shifrin's great book. On page 74 the function oddSublists doesn't give me the expected ...
179 views

### How to format the data in a table to have only numbers

This question is in continuation of my earlier query, how to store output of a function in a table for future use. I am able to store the output of my function in a table, however the table consists ...
39 views

### Adding Elements to a List of Lists [duplicate]

I'm trying to do the following: Given a function f[x,y], I want to turn the list {{x1,y1},{x2,y2},...,{xn,yn}} into ...
423 views

### Fast way to get positions of “boxed” array elements?

Given a 2D array (arbitrary numeric / evaluates to numeric elements, simplified for examples, and can be arbitrary dimensions so long as the operation makes sense, I'm working with 2K X 2K in my ...
270 views

### Is there a function which instantly tells you whether an element is part of a list?

I have a very long list of numbers and I want to check whether there's a function (something that would look like PartOfQ[element,list]) that tells you immediately ...
87 views

### Make duplicate string then join two strings together in a table

I have two lists of data, dataA and dataB. ...
31 views

### Problem with slot in If statement [duplicate]

I am struggling with slots, In this case I have a function int which gives either true or false. When it gives true, I want ...
79 views

### Extracting second value of each sublist [duplicate]

How can one get the second value of every array inside the outside array? I have the following data data = {{10, 20}, {30, 40}, {50, 60}}; I want to extract ...
66 views

### Optimise CPU-intensive list combining function

I have a list of numbers list1 from which I want to create another list (list2) consisting of only those numbers that are equal ...
209 views

### Gather lists according to another list

I have a first list of pairs like this one: ...
88 views

### Generating the set of all three-dimensional binary arrays distinct under rotation and reflection?

How can I automatically generate all possible three-dimensional binary arrays of size $(x_1 \times x_2 \times x_3$) where each array is distinct from all others with respect to rotation and reflection ...
233 views

### Extracting function calls from an expression

I have an expression like this: expr = F[0, 1] + 2 F[0, 0] - 17*F[2, 0] and I want to transform it to a list consisting of all function calls with its arguments: ...
63 views

### How do I pull from a data list for parameter values in a system of ODEs and then solve and plot?

I have a parameter set list and I would like to solve a system of ODEs multiple times using each parameter set in the list. Then I would like each set of solutions to be graphed on the same plot. ...
489 views

### Plotting solutions of differential equations with different parameters [duplicate]

I want to plot x[t], when i manipulate w from 0.1 to 1.5. Here is what I've attempted, which does not work as expected. ...
137 views

### Plot graphs in different colors

I am generating a set of plots and exploring how changing a parameter affects the plot shape. I want each plot to be a different color, but the color rule i'm applying seems to only work for the last ...
363 views

### GatherBy and two conditions

I have a list of 4 dim points, given by ...
1k views

### How can you convert a matrix back into a list of lists?

It is very simple in Mathematica to convert a list of lists into a matrix: all you need to do is apply the //MatrixForm function to it and voila. Is it possible ...
377 views

### Re-arranging / selecting of a data table very slow in For loop [duplicate]

My task is quite simple; I have a table of data like M = {{1,2}, {1,3}, {3,4}, {5,1}, {6,9}, {6,8}, {6,1}}; so the table is sorted with respect to the first ...
36 views

### Check if a (possibly nested) list is real [duplicate]

I have a very large matrix of numbers. I want to check if all its entries are real. At the moment I am using realQ = And @@ Thread[Flatten[Im @ #] == 0] & Is ...
731 views

### Take both of the diagonals through an element in a matrix

I have a matrix like this: Reverse@Array[List, {8, 8}] // MatrixForm I need a function that given an element of this matrix will return all the elements ...
237 views

### Splitting dates into groups in half year steps

list = DayRange[{1999, 1, 1}, {2014, 2, 6}] I want to split this list into sublists one and a half year long, moving a half year forward every time. That would ...
170 views

### Implementing nested subtotals

Inserting a nested subtotal in a spreadsheet is a facility that Excel performs very well. But if a subset of this facility can be implemented in MMA for a table which needs it the hassle of its ...
93 views

### Using Derivative with list in curly brackets

I'd like to make a formula for a sum containing Derivative where the number of arguments in the latter depends on an input parameter n. Also involved is a list ...
I have a list {-1.8, 1.44, 0.2736, -1.72514, 1.17612} where each element stands for a value of x. e.g. $x1 = -1.8$, $x2 = 1.44$ and so on. How can I find the ...