# Questions tagged [list-manipulation]

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

546 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
164 views

### BinLists for list of depth greater than 1

Bug introduced in 9.0 or earlier and fixed in 10.3.1 or earlier BinLists uses the bin specification assuming an interval that is closed on the left and open on the ...
• 531
166 views

### Find algorithm or generator formula with automated procedure and pattern recognition

I am trying to find a generator formula for the discriminant of a polynomial and believe it would be an interesting problem for the Mathematica community to know how to automate evaluation of certain ...
• 483
216 views

### Problem with ParallelTable?

I am trying to numerically solve Bloch equations using Euler's method. My code is the following ...
• 581
167 views

### Compilation of a function that needs to call Subsets

I'm working on a code that runs many (easy) operations on combinations (subsets) of different size (6, 7, 8, 9) taken from a big set of numbers (normally more that 40). So, this means the code has to ...
• 2,037
143 views

### How to create a complex variable from dated list values

Can anyone help me to construct a variable "PI" from values of variable x. Variable x represents a group of two time series rj and ri on equal dates(joined two dated lists with states).Variable x have ...
• 171
134 views

### An efficient way to merge a pair of 4d arrays of non regular length lists

Question I have two 4 dimensional non regular length lists of complex values. I have working code however it seems quite slow and I am not sure how I could improve this. Mathematically I am trying ...
• 153
734 views

### How could I make an Excel-like table?

I am looking to build a simple Excel type of a table with four columns. I have spent some time researching Mathematica documentation, but haven't come across a way to implement that. Here is a picture ...
• 21
384 views

### Generating a variable size table one element at a time

I can produce a variable size list of strings like AACBBAABC with this code: ...
• 51
91 views

### The number of real values assumed by combinations of complex roots of a decic

Define complex conjugate as the pair of complex numbers $a+bi,a-bi$. Assume you have 5 such pairs and they are the 10 roots $x_i$ of a 10th-deg equation with integer coefficients. In general, how many ...
150 views

### Need an explanation on how code from journal works

I was reading a paper from Mathematica Journal. It gives code for calculating subsets. ...
• 2,073
151 views

### correct usage of ParallelTable

I am trying to parallelize my script. Here is a MWE of how I have done it: ...
• 1,273
682 views

### Generating a function which outputs possible chemical reactions

I want to make a list of chemical reactions and I write them down in a $\require{mhchem}\LaTeX$ format. They are of the following form NA_n^i+MB_m^j \rightarrow \hat NA_{\hat n}^{\hat i}+\hat MA_{\...
• 1,485
1 vote
55 views

### How can I efficiently gather similar lists?

I want to gather similar lists by the function sameQ below. Gather works well here, but it's too slow for large data. My real <...
• 613
1 vote
53 views

### Random replacement in array

In the spirit of this interesting article of Stephen Wolfram I also decided to study some issues related to mutations. I’m working with simple {0,1} arrays and I’ve ...
• 1,729
1 vote
47 views

### Define certain argument in functions which depend on several arguments and built in a list

I got confused working with list of functions of two variables. I construct few lists of functions, one is vector of functions List1 and another is 2D list of ...
• 316
1 vote
31 views

### Efficient chain rule implementation

(there is a fair amount of context here) I am implementing a generalized chain rule to do some work, say for order 3 in derivatives ($\partial_i = \partial/\partial x_i$): \begin{align} \partial_i \...
• 499
1 vote
83 views

### How to efficiently calculate matrix operations when the elements are defined as functions?

I'm trying to calculate the one-body density matrix of a system of particles as described in this article, given in equations 14 and 15. Here, is my code but it seems very slow. Is there any efficient ...
• 63
1 vote
61 views

### What is another way to write this equations in this list?

I have mylist: mylist = {{6, 7, 6, 2}, {7, 9, 7, 3}}; Here are two ways that I write equations from mylist: ...
• 1,097
1 vote
64 views

### Why is SequencePosition or SequenceCases so slow on large lists?

I observed that SequencePosition or Sequence Cases on a list of around 60'000 digits is so slow that I had to sort out to string pattern matching. Is this normal behavior or should Wolfram have a look ...
• 121
1 vote
64 views

### Export data vertically

I have data that I want to export to a text file. ...
1 vote
67 views

### What can be improved in the following custom interpolation?

Consider some test data: a grid of x, y, and values of some function on this grid: ...
• 5,827
1 vote
56 views

### Convert a graph to Lad format using a concise method

The LAD format is a kind of graph formats; see https://perso.liris.cnrs.fr/christine.solnon/SIP.html The specific format requirements are as follows: Each graph is described in a text file. If the ...
• 2,039
1 vote
57 views

### Selecting from a list of associations

From a list of Associations ...
• 75.2k
1 vote
101 views

### Optimize grouping of list of lists by elements

I have a sorted list of lists of size ~200,000 x 3. The data are such that the first element of each triplet loops through i = 1, 1.1, 1.2, ..., 199.9, 200, and for every value of i, the second ...
1 vote
55 views

### Fitting experimental data to a plot with different x-axis paths

Given Mathematica code of eigenvalues in different variable-paths , I want to add experimental data in the path Gamma-X ; X-Gamma ; and M-Gamma . Here is the code : ...
• 117
1 vote
54 views

### SameTest for arrays of points

I need to gather arrays of points by some intuitive SameTest, so for some tolerance the next arrays will be treated as the same: Next code looks like suitable for ...
• 1,729
1 vote
77 views

### How to remove curly brackets from a list of functions?

When I'm creating a plot I standardize the format by predefined parameters, like: ...
1 vote
45 views

### Finding and manually weeding out images in ClusteringComponents clusters

I have processed images using the following code, where list1 and list 2 are x and y axes, sample of images: ...
1 vote
164 views

### How to show the limit of two functions in a code approach zero?

I don't know how to shorten the program, the entire code is required to understand everything: ...
• 71
1 vote
53 views

### How to join common dates on a TemporalData set with TimeSeriesThread (possible Bug)

Bug introduced in version 13.2 or earlier WRI have forwarded the problem to their developers. Case Number 5029803 I am trying to join TemporalData with many paths ...
1 vote
70 views

### How to Name a Path in TemporalData?

Preamble: I am working with stock prices and need to perform calculations on them. And then extract the information for further calculations. TimeSeries/...
1 vote
58 views

### Selecting elements with a particular slope

I have a dataset for which I want to identify 'groupings' based on three criteria, but only one of them is giving me a headache. The criteria are that each group must: have a minimum number of points ...
• 1,418
1 vote
51 views

### Comparing performance of ParallelMap with pure function

Test data are here: q = CloudGet[ "https://www.wolframcloud.com/obj/874e3b18-808a-404a-aaa0-4e3ad1ac4668"]; I construct interpolation and an equi-...
• 3,960
1 vote
63 views

### Report sum of each list seperately

I'm looking to calculate the variance of the total of multiple lists. To do this accurately I will need each list sum to be reported separately, and recorded in a list, to then perform the variance ...
• 173
1 vote
168 views

### SortBy the second element in the sublists

Is there a way to sort sublists in a list by the sublists' second element? For example, if the list is: ...
• 567
1 vote
174 views

### Why is my module saying "cannot assign to raw object" when I run it more than once?

I am trying to solve the shortest path problem in Mathematica. My code looks like this so far. I first import the list. ...
1 vote
217 views

### ListLogPlot for positive and negative values

I am trying to plot the following set of points on Mathematica: ...
• 163
1 vote
52 views

### how i convert lists' elements x to this lists' elements y and how i get elements from nested list?

i have nested list as follows x = {{x11, x12, x13}, {x21, x22, x23}, {x31, x32, x33},{x41, x42, x43}} = {{1, 3, 5}, {3, 4, 3}, {2, 6, 7}, {2, 6, 8}} i want to make ...
• 369
1 vote
38 views

### Generating a table of lists following the set of rules

I am trying to generate a table of degree sequences for simple connected graphs for a given number of nodes. Example output for $n=4$: ...
• 81
1 vote
65 views

### An error in the short form of a two-dimensional array?

I noticed very strange behavior in the function Short when applied to a two-dimensional list of real numbers in Mathematica 12.3. Consider that ...
• 101
1 vote
41 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,327
1 vote
36 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,534
1 vote
87 views

### How to DeleteDuplicates from a list of Rules having set to different values whereby we wish to drop the last occurrence?

About This Function This will eventually set default values for Options based on the end users preferences so that no OptionsPattern need ever be set. The symbol<...
• 2,467
1 vote
58 views

### Reading *ptw files into Mathematica

I have a SWIR camera that outputs raw image files in *ptw format. I need to read them into Mathematica for image analysis. I know that such files can be read into Matlab and C++, so there must be a ...
• 11
1 vote
117 views

### How to fix Mathematica crashing in the following case?

I have a problem with Mathematica when trying to glue two tables together. The tables have the form ...
• 5,827
1 vote
89 views

### How to define function Gradient of many variables?

I would like to define a function with a list as input variables and obtain gradient of this function. I have tried many different ways, the simplest one which works is as following example, ...
1 vote
74 views

### Dividing list into smaller list using a set of rules?

Suppose we have the list for $n\in\mathbb{N}$ Range[1,n] We choose the number in the list where $x=1$, $x=n$ and $x=1+(n-1)/2$ round closest to and the numbers ...
• 71
1 vote
100 views

### Find invariant tensors under two matrix

I have two $9\times 9$ matrices $g_1, g_2$ where ...
• 101
1 vote
94 views

### Inconsistency of interpreting TableForm inputs

Bug introduced in 12.3.1 or earlier and persisting through 13.2.0 or later. Consider this line of code and its result: ...
• 952
1 vote