# Questions tagged [list-manipulation]

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

548 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
71 views

### Efficient Conversion of a Large Integer List to Boolean List

I am working on a problem where I need to generate a list of random Boolean values. My current approach is to first generate a list of random integers (0 or 1), and then convert this list to a Boolean ...
• 215
138 views

• 39
60 views

### How to work around TuringMachine's lack of a halting mechanism

It looks like the TuringMachine function doesn't have a halting mechanism. When I say "halting mechanism", I mean something that's built-in to the ...
• 121
50 views

### ListContourPlot and ListPlot3D return empty (white) plots when scaled

using Mathematica 11.1.1.0. I could not find this topic before. Look at these simple data plots: ...
• 81
134 views

### Using Fold[ or Map[ Better?

I'm working through MMA Cookbook by Mangano, page 54. He shows Map is a compact form of Fold function. Is using ...
• 600
75 views

### Add, subtract, multiply, divide etc, lists that are coordinate pairs e.g. time histories

I often do signal processing and have lists that may be time series or spectra that are in the form of $$\{ \{x1,y1\},\{x2,y2\}, \{x3,y3\}...\}$$ I usually have lists with all the same x values ...
• 16.1k
57 views

### SortBy without final cannonical ordering

How can I SortBy a list without final cannonical ordering? E.g. SortBy[{9, 1, 2, 5, 3, 7}, # Boole[# >= 6] & ] returns <...
• 1,580
85 views

### How to use a List in Do-loop?

My program produces a list that looks exactly like this: listr = {{i[1], 0, 13}, {i[2], 0, 21}, {i[3], 0, 41}, {i[4], 0, 5}}; Now I want to use this list in a <...
• 21
79 views

### NMinimize with real solutions, problem in the resolution and criteria for other ways to solve equations

I have multiple parts in my question. You are welcome to answer to any of them :) Part 1 : I have 3 equations $p(x_1,y_1)=p(x_2,y_2),\mu_x(x_1,y_1)=\mu_x(x_2,y_2),\mu_y(x_1,y_1)=\mu_y(x_2,y_2)$. I'm ...
• 1,245
134 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 (...
50 views

### When mapping FindMinimum to a list, how to find out which instance does not converge

I defined a function f[x,y] and wanted to study its minimum over x when viewing y as a ...
54 views

### Error with combining lists

I'm attempting to combine lists of the form ...
• 33
69 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: ...
• 323
154 views

### ListDensityPlot using

I have two data tables with identical parts along the vertical axis. For example: ...
• 573
153 views

### Converting video file to list of images to analyze pixels of each frame

I am trying to recreate the following physics experiment to analyze chaotic motion: https://www.researchgate.net/publication/275890532_Tracking_the_Motion_of_a_Double_Pendulum_Using_Mathematica I ...
94 views

### Fold/ NestList/ etc in MCMC loop for optimisation

I am trying to simplify and optimise an old loop code I wrote. Since Fold and NestWhile use the results of the last iteration in the new iteration, I would like to use them in order to get rid of Do ...
• 1,320
37 views

### Partition data but dropping elements between each sublist

Is there a neat way to partition a list into sublists of fixed length $n$, discarding a fixed number $k$ elements between each one? E.g for $n=3, k=1$, ...
• 5,613
106 views

### How can I deal with a SystemException?

I have a list of functions that are being evaluated, using ParallelTable[], and continue to get the error message: ...
• 1,427
120 views

### Run function as loop over two matrices

I'm still wrapping my head around Mathematica syntax. I have a matrix clustersAll that looks like ...
• 1,041
50 views

### Odd behavior of ArrayReshape with SparseArrays

I am trying to understand why I am seeing inconsistent results when using ArrayReshape on a SparseArray vs. a normal nested <...
• 2,045
165 views

### Normal vector in discrete 3D object

Consider a large array(~42000,3): array={{x1,y1,z1},{x2,y2,z2},...,{xn,yn,zn}}; This array forms a certain shape, it may contain cavities or other ...
151 views

### What is the best equivalent way in MMA to micmicking python's generator expression?

In python, there is a syntax called generator expression. For example, [i for i in range(1,5)], [i**2 for i in range(1,5)], and <...
• 1,181
88 views

### Cleaning Curated Data

I am preparing data consisting of temperature and pressure values from each country in the world using the following code. <...
• 109
470 views

### Find the position of the non-zero minimum in a list

I have a list which looks like list = {{0}, {0}, {0}, {0}, {0}, {0, 1, 2}} How can I find the position of the non-zero minimum which is non zero (this should be ...
• 4,262
93 views

### product of all elements in subsets of timeseries

apologies in advance if this is obvious, but I'm very new to mathematica and couldn't find the answer in the documentation nor in the forum here... I've got a 2 year time series ts with daily ...
• 33
333 views

### Parallelizing / speeding up a replacement rule over large list

I have a list of differentiated expression of the form {f[0,0,0],(f^(a,b,c))[0,0,0],...} where I have left the function as a general ...
• 113
316 views

### Efficiently create an array of values of a function

I have a function of four arguments, and I would like to have its values on the four-dimensional grid in an array. What is the most efficient way to produce this array, and how do I make it packed? ...
• 450
132 views

### Picking one element per row per column to give the smallest combination of absolute values

I am trying to find the minimum combination of absolute values from this matrix. ...
• 93
166 views

### Handling oscilloscope bitmap data

I'm using an oscilloscope from Tektronix; its output is formatted as a $n \times (m + 2)$ matrix, where $n$ is the number of vertical divisions and $m$ the temporal scale. The first $9\times 2$ ...
• 361
439 views

### Using Table within Table

I have a large set of data which is composed of lists of lists of lists. I have to sort through the data, applying functions to lists that fit my selection rules. Because of these lists within lists, ...
• 93
123 views

### Using List correlate with three 2D arrays

Working off from a question I asked previosuly where the answer to my problem was to use ListCorrelate, I have been playing around with trying to use ...
41 views

### Indexing items in multiple lists to find a specific solution

Broadly, I am looking for a solution numerically using FindRoot, but the output seems to be be quite sensitive to the initial guesses for one variable in particular, so I am running the function over ...
• 21
43 views

### Unexpected behavior of a variable

I am confused with a strange phenomenon that I observe and do not understand. Look, here is a simple code making a random walk: ...
• 38.7k
343 views

### Extract points from ParametricPlot3D

I have this ParametricPlot3D ...
• 356
692 views

### Interpolation error: element mesh with insufficient quality

I'm trying to work with a numerical function as a list of elements: {{x1, y1}, f1}, {x2, y2}, f2}, ..., {xN, yN}, fN}} I've produced the list in other ...
• 2,366
168 views

### Function output

I would like a function that computes Cartesian product of two sets z=(Tuples@{#1,#2}), and computes the number of elements in this set(list) ...
• 67
123 views

### Arrays with two different types of indices

Is there a way of having arrays which have, so to speak, two different depths $m,n$? From the point of view of memory usage, it would be the same as an array of depth $m+n$, but I would like to ...
• 165
247 views

### Dynamic array in Mathematica like malloc in C++

I have a table to describe a crossroad. Each traffic line has it own Q(flow), V( speed) and direction. I'm saving data in array, which hardcoded (very simple code data = {{66, 55, 3}, {44, 33, 2}, {...
• 117