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
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 ...
Tokubara's user avatar
  • 215
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 $...
phy_math's user avatar
  • 801
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": ...
mmen's user avatar
  • 163
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 ...
Marcosko's user avatar
  • 239
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 <...
imida k's user avatar
  • 4,047
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],...} ...
user2286339's user avatar
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 ...
Jesuel Marques's user avatar
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 ...
duality's user avatar
  • 65
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 ...
Trev's user avatar
  • 763
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 ...
Gravifer's user avatar
  • 812
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 ...
xiaohuamao's user avatar
  • 4,698
2 votes
0 answers
61 views

Error using Standardize

I'm trying to standardize a set of data. ...
isaac5122's user avatar
  • 797
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\...
Arbuja's user avatar
  • 39
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 ...
Matt Diamond's user avatar
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: ...
Frieder's user avatar
  • 81
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 ...
prog9910's user avatar
  • 600
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 ...
Hugh's user avatar
  • 16.1k
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 <...
Al Guy's user avatar
  • 1,580
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 <...
Tom's user avatar
  • 21
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 ...
J.A's user avatar
  • 1,245
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 (...
William Taylor's user avatar
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 ...
Epsilon_F's user avatar
2 votes
0 answers
54 views

Error with combining lists

I'm attempting to combine lists of the form ...
Student's user avatar
  • 33
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: ...
WolfiG's user avatar
  • 323
2 votes
0 answers
154 views

ListDensityPlot using

I have two data tables with identical parts along the vertical axis. For example: ...
John's user avatar
  • 573
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 ...
happyhippie924's user avatar
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 ...
Titus's user avatar
  • 1,320
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$, ...
SPPearce's user avatar
  • 5,613
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: ...
Jmeeks29ig's user avatar
  • 1,427
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 ...
brienna's user avatar
  • 1,041
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 <...
Fidel I. Schaposnik's user avatar
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 ...
Giovanni Baez's user avatar
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 <...
Eric's user avatar
  • 1,181
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. <...
hwhorf's user avatar
  • 109
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 ...
Tomi's user avatar
  • 4,262
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 ...
flux's user avatar
  • 33
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 ...
jpdomann's user avatar
  • 113
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? ...
And R's user avatar
  • 450
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. ...
gweeish's user avatar
  • 93
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$ ...
Enzo's user avatar
  • 361
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, ...
Butters's user avatar
  • 93
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 ...
Luca Pontiggia's user avatar
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 ...
emoberg's user avatar
  • 21
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: ...
Alexei Boulbitch's user avatar
2 votes
0 answers
343 views

Extract points from ParametricPlot3D

I have this ParametricPlot3D ...
Emmet 's user avatar
  • 356
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 ...
user16320's user avatar
  • 2,366
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) ...
Gelios's user avatar
  • 67
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 ...
geodude's user avatar
  • 165
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}, {...
Mishin V.'s user avatar
  • 117
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 ...
Kelly Lowder's user avatar

1
2
3 4 5
11