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
2
votes
0
answers
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 ...
2
votes
0
answers
138
views
Given n-polynomials, how can I find the linearly independent polynomials?
Suppose I have $f_1, f_2, \cdots, f_n$ equations in $k[x_1, \cdots, x_n]$, i.e., the polynomials $f_i$ consist $n$ variables including degree. For example $n=3$, one of the example of $f_1$ would be $...
2
votes
0
answers
87
views
Fast value extraction for refreshing large data
I am trying to fine tune a procedure to reduce its running time. It involves two large arrays "data" and "positions":
...
2
votes
0
answers
71
views
Appending to list without accesing the whole list
I'm developing a function that constructs a list with a lot of elements (around 1 million), with each of the elements being a somewhat complicated algebraic expression. I'm doing this by using ...
2
votes
0
answers
95
views
sometimes Select / sometimes Position is faster
As you see,
For list L,
L1(Select method) is slower than L2(Position method).
But for list <...
2
votes
0
answers
44
views
Delete list item if message is thrown
I have a nested list with each element containing FindRoot like this:
{FindRoot[a,b], FindRoot[c,d], FindRoot[e,f],...}
...
2
votes
0
answers
125
views
How to use Select and MemberQ together with Map correctly?
I have a list with quite a few elements. Each element is a rule of the type vector-> number such as {1,2,3,4}->1.435 and ...
2
votes
0
answers
168
views
Map a function that uses the lists indices as arguments
Suppose I have a function f[x_] that I want to Map over somelist (assumed to be one ...
2
votes
0
answers
52
views
Implementing array with partial cyclic data?
I'd like to construct an array where some columns are cyclic. As an illustrative example, take
Table[Mod[k, 2^i], {k, 2^10}, {i, 0, 10}] //Grid,
where the vast ...
2
votes
0
answers
60
views
Handling lists indexed with integer partitions
I am trying to do some exploration around the multi-dimensional version of [truncated moment problem], where I work with various distributions (uni- or multi-variate), and use some truncated moment ...
2
votes
0
answers
122
views
Repeated calling of a ParametricNDSolve result in a faster way?
I recently learned of ParametricNDSolve and found that I need to compute it once and then call its result sol at different ...
2
votes
0
answers
61
views
Error using Standardize
I'm trying to standardize a set of data.
...
2
votes
0
answers
80
views
For any countable totally-ordered $A$, how can mathematica show my choice function gives a unique collection of finite sets whose union is $A$?
Suppose $A=\sqrt{\mathbb{Q}}_{>0}$. We want a unique $\bigcup\limits_{i\le j}A_i$ for $i,j\in\mathbb{N}$ such that $A_i$ is finite, $A_i\subseteq A_{i+1}$, and $\lim\limits_{j\to\infty}\bigcup\...
2
votes
0
answers
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 ...
2
votes
0
answers
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:
...
2
votes
0
answers
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 ...
2
votes
0
answers
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 ...
2
votes
0
answers
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 <...
2
votes
0
answers
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 <...
2
votes
0
answers
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 ...
2
votes
0
answers
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 (...
2
votes
0
answers
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 ...
2
votes
0
answers
54
views
Error with combining lists
I'm attempting to combine lists of the form
...
2
votes
0
answers
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:
...
2
votes
0
answers
154
views
ListDensityPlot using
I have two data tables with identical parts along the vertical axis.
For example:
...
2
votes
0
answers
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 ...
2
votes
0
answers
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 ...
2
votes
0
answers
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$,
...
2
votes
0
answers
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:
...
2
votes
0
answers
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
...
2
votes
0
answers
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
votes
0
answers
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 ...
2
votes
0
answers
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 <...
2
votes
0
answers
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.
<...
2
votes
0
answers
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 ...
2
votes
0
answers
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 ...
2
votes
0
answers
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 ...
2
votes
0
answers
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?
...
2
votes
0
answers
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.
...
2
votes
0
answers
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$ ...
2
votes
0
answers
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, ...
2
votes
0
answers
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 ...
2
votes
0
answers
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 ...
2
votes
0
answers
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:
...
2
votes
0
answers
343
views
Extract points from ParametricPlot3D
I have this ParametricPlot3D
...
2
votes
0
answers
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
votes
0
answers
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) ...
2
votes
0
answers
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 ...
2
votes
0
answers
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}, {...
2
votes
0
answers
161
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 ...