Questions tagged [list-manipulation]

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

Filter by
Sorted by
Tagged with
6
votes
2answers
81 views

How to create a nested list of variable depth with indexed elements

i want to obtain this definition of a nested list t = Table[C[i, j], {i, 3}, {j, 3}] with arbitrary depth, ...
1
vote
0answers
44 views

How can I convert the Defer result to a String

I have created a package.wl where I am building a simple interface with input fields and buttons to generate and solve some simple integer logarithms. There is a button [show solution] that explains ...
2
votes
2answers
128 views

Hierarchy (bifurcations) in graphs

Suppose we have the given network 'g1', which we get based on the set 'q1': ...
6
votes
2answers
224 views

Cases for nested lists

I have a nested list where each element looks like {{x, y}, {{a, b}, {c, d}}} I would like to extract elements of a list with $ b < 0 $, so I look for ...
1
vote
2answers
45 views

How to define a function that acts invidually on a varible number of arguments

I am trying to generate a function that applies to each argument for any number and type of arguments. The function might work like this: ...
2
votes
1answer
26 views

User defined function for creating Row only listing first column of matrix or first element of a vector

I cannot figure out why my rowNameValue[] is only listing the first part of a column or vector. Below is the code. ...
0
votes
1answer
27 views

How to create a function that applies individually to each variable number of arguments

Abstract I have a function objectName that gets SymbolName and value. I would like to apply this to many variables at once with ...
2
votes
3answers
60 views

How to Find Duplicate Sets in a List

Given the list below, I would like to find the sets within that list that are identical according to the order of their elements, generate that set, and show the number of times it appears in Lst. For ...
1
vote
1answer
33 views
3
votes
2answers
82 views

Print corresponding elements from two lists

I have two lists xx and yy where ...
2
votes
1answer
37 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 ...
1
vote
1answer
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 ...
9
votes
2answers
454 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. ...
5
votes
2answers
131 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, ...
0
votes
1answer
85 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 ...
0
votes
0answers
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: ...
3
votes
2answers
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 ...
3
votes
1answer
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}} ...
4
votes
4answers
184 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: ...
0
votes
0answers
36 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[]. ...
2
votes
1answer
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 ...
2
votes
1answer
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 ...
5
votes
1answer
63 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 ...
6
votes
1answer
109 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 ...
2
votes
1answer
35 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 ...
0
votes
0answers
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 ...
2
votes
1answer
33 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?...
5
votes
2answers
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 ...
5
votes
3answers
84 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 ...
1
vote
0answers
25 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 ...
7
votes
4answers
271 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 ...
1
vote
1answer
39 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 ...
1
vote
2answers
39 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 ...
1
vote
0answers
57 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 ...
2
votes
2answers
75 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: ...
4
votes
3answers
151 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 ...
0
votes
0answers
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 ...
1
vote
1answer
36 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 ...
1
vote
3answers
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 ...
6
votes
2answers
308 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 ...
6
votes
2answers
152 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: ...
11
votes
7answers
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: ...
1
vote
3answers
39 views

Converting a dataset to nominal data

Im trying to covert a list of data to nominal data. Here is the data. ...
2
votes
2answers
48 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. ...
5
votes
1answer
116 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 ...
0
votes
0answers
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 ...
4
votes
2answers
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 ...
1
vote
2answers
39 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 ...
1
vote
2answers
50 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}}} ...
2
votes
3answers
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. ...