# Questions tagged [list-manipulation]

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

6,423 questions
Filter by
Sorted by
Tagged with
34 views

### Filtering solutions using the Select function [closed]

I have a certain code that output in the following format: {{a1,b1},{a2,b2},{a3,b3},...,{an,bn}} Where $a_1$ and $b_1$ etc are numbers. Now I want to filter ...
78 views

### Question about the test format applied in a for loop

I have an issue with the following code. I am trying to remove the points which have a distance less than 2mm relative to each other starting with a specified point ...
452 views

### Evenly spaced Tick marks for Primes

I'm trying to have the integers evenly spaced on the x axis of a ListPlot, and the prime numbers evenly spaced on the y axis. ...
121 views

### Grouping list elements according to a condition

I have a list of "calls and responses", which are pairs of a message and then either a $0$, for a call, or a $1$, for a response. There is some amount of calls, and some amount, potentially unequal, ...
83 views

### correct use of the command FindInstance

I have tried to solve this system for numbers that go from 1 to 10 non-repeated integers, this occurs to me ...
57 views

### Resorting nested list A according to nested list B

How can sort nested list according to each other? e.g. I have the following list: ...
66 views

### Random Sample from Very Large Table

I'm currently trying to create some test data to check a numerical implementation against Mathematica's implementation of some functions. In order to do this, I've been generating a broad range of ...
26 views

### Removing elements from nested list [duplicate]

I would like to remove the element of A1 from the list B1: How I can do that? Thank you! A1= {{5, 6}, {4, 5}, {5, 4}} ...
180 views

### Dropping some row from a Table with If condition [closed]

I have to drop the rows of a table only when the element in the first coloumn of the row satisfies multiple condition. The table: ...
35 views

### Appending a list which was created with ToExpression

I would like to create many different lists by changing one part of the list name with a variable defined as a string, then creating a name for that list using ToExpression[]. ...
49 views

### How to obtain Detele

From a={{6, 4}, {8, 1}, {11, 3}} How to obtain {{6, 8, 11}, {6, 11}, {6,11}, {6}} or ...
40 views

### Select coprimes from list of pairs

Given t2 = {{1, 5}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, {2, 5}, {3, 1}, {3, 2}, {3, 3}}; I can get coprime pairs by ...
59 views

### How can the missing time series values be filled?

Though there appears to be a similar question, it does not sate this use-case... I present below the MWE: I have a date-list, here it is just a linear series of numbers, but the real use-case is that ...
107 views

### How to group together numbers in a list by the value of their tens digit?

The line Table[Prime[n],{n,1000}] produces the list of first 1000 primes. Given this list how can the values be grouped by the values of their tens digit? i.e. how ...
34 views

### Quotation marks inside a list [closed]

I want to place quotations for every element in a list. I am trying this col = Table["\"" i "\"", {i, 0, 5}]; and I am getting ...
32 views

### UI building, how to input an array of number in the Manipulate function?

I'm trying to build a simple financial app with Mathematica, i'm having problems with UI building (nothing fancy, it's just an hobby). Here is the code. The problem is with the Manipulate function, i ...
31 views

### Selecting specific element from a list of lists based on values of another list

I have a list of pairs in which every pair correspond to a edge in a network (or graph). This list in a .txt file (available here https://drive.google.com/file/d/1g-1l3__IxJ8qe_wtM4_0TYuklwoH_Rqa/view?...
58 views

### ArrayPad unexpected changing of order

If I pad an array with two columns on the left the order of the columns is reversed depending on the length of the row of the padded array. I don't think this is normal, but if it is, what is the ...
83 views

### Conditional column extraction

Let $A$ be the following matrix A = {{1, 0, 9}, {5, 0, 6}, {4, 1, 9}, {7, 0, 11}, {8, 1, 2}} and let $B$ be the matrix that comes from $A$ with ...
24 views

### How to define more general boundary conditions for ConvolutionLayer?

In Mathematica 12, I only see the option to define "PaddingSize" for a ConvolutionLayer in order to get Dirichlet boundary ...
270 views

### Why AssociateTo does not work when Association is inside a list?

V 12.1 on windows 10. I am still learning how to use Associations. This is very strange. I wanted to change field in association using AssociateTo. When the ...
38 views

### ReplaceAll with pattern matching not working with list of lists

Abstract This is just a learning exercise for me. I am trying to create a function that will take a list of vectors, multiply them by a constant if constant is given, and then add all vectors. If we ...
38 views

### How do you loop a summation while taking values from list?

I have a list given as: d={{{1,1,1},{10,10,10}},{{70,70,70},{51,51,51},{97,97,97}},{{7,7,7}}} Each number in the list represents a potential "W" value for the ...
56 views

### What is the correct syntax for performing a summation using numbers from a list? [closed]

I have the following lines of code: l={1,2,3,4,5} n=5 Summation= n l Total[Summation] I would like to perform the same thing above, but in a more elegant ...
74 views

### How do you delete sublists of a desired permutation?

I have a list given as: d = {{{A1,A2,T3}, {A4,T1,A2}, {T5,A1,A3}}, {{T1,T2,T3}, {A5,A1,A2},{A1,A2,T3}}} I'm trying to delete sublists of the type: ...
150 views

### How do you apply “Pick” to multiple sublists?

I have the following list: lis1={{{A3,T3},{A3,T4}},{{A3,T3}},{{A3,T3},{A4,T4},{A3,T1}}} Which is also accompanied by an ...
38 views

### Plot inside Streamplot [duplicate]

I am looking to include plots in the $x,y$ plane that represent the lines that the fixed points of a dynamical system follow as the variable $l$ is varied. In doing this, I am trying to represent ...
35 views

### Labeling outputs of a function inductively

Suppose I have two lists labeled by the string "0" and "1" respectively, and two functions $f$ and $g$ which takes as input these lists. Is there a way that I can inductively label the outputs of ...
59 views

### Can you map an AssociationThread of multiple sublists?

I have two lists that look like this: d={{1,1,3,5,7,2},{1,1,3,5,6,7,2}} dd={{A1,A1,A3,A5,A7,A2},{A1,A1,A3,A5,A6,A7,A2}} If I use ...
306 views

### Fast multiplication of high dimensional matrix

I am very new to Mathematica. I am dealing with the multiplication of matrix as the following code ...
151 views

### How do I flatten sublists while maintaining a separation between preexisting sublists?

I have a list that looks like: z={{{a,b},{b,c},{c,d},{d,e}},{{b,c},{d,e},{w,e}}} How would I create a list that looks like: ...
1k views

### Find if there are consecutive 1s in a binary representation of a number

Given a list of numbers in decimal form, what is the most efficient way to determine if there are any consecutive 1s in the binary forms of those numbers? My solution so far: ...
39 views

### Converting a dataset to nominal data

Im trying to covert a list of data to nominal data. Here is the data. ...
47 views

### Counting inside Sublists [closed]

I have the following problem. Given n_ for a square matrix. n=3 Makes: lst = {{1,2,3},{4,5,6},{7,8,9}} Can this be done with Map[? I can do it easily with Table. ...
115 views

### Identify flipped data

Edit I'll try to reformulate my problem to make it more clear. Consider association with elements of the form {x,y} -> {f(x,y),g(x,y),...}, where keys are ...
55 views

### Evaluate parameters before function uses them

I want to construct a power series: LP[s_] := With[{x = 1, R = 10, n = 1}, Sum[cc[i + n, n, x, R] s^i, {i, 0, 20}]] but it kinda takes a long time to compute the ...
59 views

### applying compound function on parts of list

I have list t1={{1, 2}, {2, 5}, {3, 10}, {4, 17}, {5, 28}, {6, 41}, {7, 58}} and want to substitute the second part with the biggest prime factor in it, giving ...
36 views

### Conditionally extracting data from long lists

I need to make a fit on a small part of my data list. To do so I need to extract data setting a condition. Example: From the list below I would like to create a new list that contains only data whose ...
49 views

### How do I pull out sublists from a list under a given condition?

is there an easy way to pull sublists out of a "master list" based upon certain conditions? Let's say I have a list: list1={{{1a,1b},{1a,1c},{1a,1a},{1y,1y}}} ...
112 views

### Turning numbers embedded in deeply nested lists into strings [closed]

This must have a simple answer, but I cannot think of it. I want to take the numbers in a list such as: {1,{2,{{3,4},{5,6}},7,8} into strings. ToString will turn the whole list into a string. ...
84 views

### Removing specific sublists

I have a program that generates a list of specific 3-tuples of integers. A typical output is as follows: ...
34 views

### Remove braces from AppendTo output

If I have the following inside a loop: tts={}; AppendTo[tts, p] where p is just a number at each iteration so that in the first iteration I get: ...
29 views

### Get second position elements given a criteria [closed]

I know this is a very simple question but I am fairly new in Mathematica. If I have this list: ...
52 views

### ListPlot and comparisons between lists

The problem is a bit tricky, I will try to be as clear as possible. I have several lists (let's call them x, y, z and k), all of the same length, and where the i-th value of each list corresponds to a ...