Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [list-manipulation]

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

0
votes
1answer
48 views

Breaking up a list of lists

I have a list of values stored in SortedLat, where SortedLat is a list of 74 sublists, and each sublist has its first element be a string. As you can see I am trying to create the first column for a ...
0
votes
0answers
37 views

How to process the list of photos?

We have a list of photos (about 300) and we need to apply to each photo the function ColorSeparate, but when we do, it tells it can process just one at a time. The whole task is to define how fast ...
0
votes
0answers
53 views

Visualizing a huge weighted graph

Consider a weighted graph 'net': ...
4
votes
2answers
81 views

List of lists elementwise greater/smaller than

I have two lists a = {{3,1,2},{5,1,3},{4,1,1}} b = {{4,0,3},{4,2,2},{5,0,2}} And would like to compare each element within ...
2
votes
3answers
175 views

Find the 3D region containing the origin bounded by given planes

I'm writing a code to generate the Wigner-Seitz cell of the reciprocal lattice for a given set of lattice translation vectors. For example, consider the Body Centered Cubic (BCC) lattice whose basis ...
6
votes
2answers
71 views

Merging two rows with rounding their first elemnts

Mathematica shows my data in the below style: ...
8
votes
2answers
1k views

Why does a table with a defined constant in its index compute 10X slower?

I need to do some iterative summations. Here is a minimum working example: ...
6
votes
2answers
133 views

Sorting upon the first element of a nested list and show that as numerical values

I wish to sort the below list upon the first elements: ...
0
votes
1answer
36 views

How to create a list of undefined functions?

I have a undefined function $\phi[i,j]$ where $i=0,1,...,m$ and $i=0,1,...,n$. How can I generate this list: {$\phi[0,0],\phi[1,0],...,\phi[m,0],\phi[0,1],\phi[1,1],...\phi[m,1],\phi[0,2],...,\phi[m,...
4
votes
3answers
203 views

Deleting the same lines from a list

Say I have a list of Lines: ...
3
votes
2answers
154 views

Applying FoldList to its own output

I'm trying to figure out a functional way to essentially apply FoldList (or some related function such as Nest or ...
2
votes
0answers
43 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: ...
-1
votes
1answer
45 views

Finding longest repeating sequence in a list of lists [on hold]

I want to find the longest repeating sequence in a list of lists. ...
-1
votes
0answers
27 views

Importing a rectangular .csv produces a nonrectangular dataset. Why? [closed]

I'm trying to import a large dataset from csv format into mathematica. As far as I can see, the dataset is rectangular in the csv, with no null values. But when I import it I get a list of lists of ...
3
votes
1answer
65 views

Applying dot product to list of vectors

Suppose I have: w = {1,0}. I want to apply the dot product of w to each element of the list of vectors ...
0
votes
0answers
31 views

Counting number of words in a Wikipedia article [closed]

I tried using the command Total[TextWords[WikipediaData["computer"]]] but it didn't work. Why?
0
votes
2answers
47 views

Remove 0.*I in imported table

I imported some table containing elements with 0.*I. I tried to remove this 0.*I by using ./{"0.*I" -> 0}, however, it did not work. Could you please tell me how to remove it? Edit. I created a table ...
1
vote
2answers
31 views

Partition singular series symmetrically into increasingly larger sub series

I've created a symmetric series with powers $${-n,-(n-1),\cdots,-1,0,1,2,\cdots,n}$$ and wish to study the convergence of the series as a function of the number of symmetric terms. So I first ...
8
votes
4answers
245 views

Extracting sublists that contain similar elements

Let's say I have a list containing different sized sublists of string pairs structured like this ...
2
votes
2answers
118 views

How to turn a Python array into Mathematica List?

I am running a = RunProcess[$SystemShell, "StandardOutput", "python2 fit.py"] which returns "[ 0.04044647 0.75243326 -0.42992283]\n[ 0.04163976 0.15076435 ...
3
votes
2answers
1k views

Create a list of all possible Boolean configurations of three constraints

I have three nonnegativity constraints \begin{equation} A_1>0, A_2>0, A_3>0. \end{equation} I want to create a single List consisting of all possible/inequivalent Boolean configurations of ...
2
votes
1answer
41 views

Turns nested Lists into nested Associations, ReplaceAll for list vs ReplacsAll for association

I want to transform some nested lists into nested associations except the "rows"->List pattern. Here is the example ...
1
vote
1answer
25 views

Trouble with RecurrenceTable using elements from a previously computed list

When I use RecurrenceTable to solve a recursion relations, I encounter a problem, which is perhaps simple, but I do not understand why it is complaining. Here is a ...
5
votes
4answers
379 views

Looking for a simple way to manipulate one column of a matrix

Given {{a, b}, {c, d}} I want to get {{c, b}, {a, d}} with one simple expression. Is this possible?
1
vote
2answers
80 views

Selecting matrices based on existence of unique column and row of all equal terms

So, I have a list of lists of lists such as the following: {{{4}}, {{7, 7}, {7, 7}}, {{5, 5}, {6, 6}}, {{2, 1}, {1, 1}}} Interpreting the elements of this list ...
1
vote
2answers
120 views

Flatten a four dimensional array into a matrix

What is the simplest way to transform an array of the form ...
2
votes
1answer
18 views

What would be the best implementation of the D'Hondt method of highest averages for allocating seats on party-list proportional representation?

The 2019 European Parliament elections are happening shortly and seat allocation will use the D'Hondt method of highest averages. In order to analyse possible scenarios and results I need a Wolfram ...
1
vote
1answer
47 views

Dynamic Plot of multiple Disk Graphics

I want to plot multiple disks with disk-coordinates and disk-radii from two dynamically updated lists. I think there should be an easy way to do that but I dont get it. Thx for your help! ...
1
vote
3answers
55 views

Mapping a function with levelspec vs. Mapping over a flattened list

I have borrowed the following cyclic permutations list making function from here. ...
0
votes
1answer
23 views

Count the number of words in WordList that start with a “q” [closed]

How can I create a subset of WordList[] that contains only the words that start with "g"?
7
votes
3answers
271 views

TreeGraph construction

I have a list l={{1,1},{2,3},{2,3,2,3,4}}. Based on that list, I want to draw a tree. Starting from a single point at the top of a tree, I proceed as follows, using ...
4
votes
1answer
170 views

Transforming a list to list of lists using a specific rule

Say, we have a list: l = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14} and a corresponding list: v = {2,3,2,3,4}. We want to ...
0
votes
1answer
74 views

Part assignment is not a symbol [duplicate]

read some related posts and found no solution. For a list defined like this m = {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9, 1.0, 1.5, 1.6}; when I define this function ...
0
votes
0answers
65 views

How do you drop Undefined elements from a list?

Suppose v[w,y] is a function and consider the following solution for w: solw = Solve[v[w,y]==0,w,Reals]; w[y]:= N[w/.solw] I ...
2
votes
1answer
59 views

Counting elements of multidimensional list according to patterns

I have the tuples : a = Range[0, 2]; l2 = Tuples[{a, a}] which gives ...
3
votes
1answer
52 views

How to utilize a Pick[] command in a differential equation

The code below is a simplified example of a problem I am working on. I first define a relation V that depends on x[t] and ...
3
votes
1answer
64 views

Find intervals between elements of a list [closed]

If I have a list: {a,b,c,d,e,f} Is there a function that allows me to easily construct a list that shows the intervals between elements: ...
6
votes
5answers
374 views

Select list elements based on other list

I am trying to find a nice and clean method to select elements from one list which are in another list or the criteria is based on another list. The ones I want to returned are in ...
7
votes
5answers
470 views

Efficient deletion of specific list entries

It is sometimes useful to remove exactly the amount of specific entries on one list from another. Consider: ...
11
votes
2answers
209 views

Selecting elements from a list where the order is set by another list

I have two lists, list A and list B. All of the elements of A are members of ...
3
votes
2answers
61 views

ListPointPlot3D filling between two lists

I'm trying to connect pairs of corresponding points from two lists in a ListPointPlot3D (similar to what was done here but in 3D). Filling-> {1->{2}} isn't ...
1
vote
5answers
98 views

Extracting certain elements from a ragged array

For the following let me use this notation: $\qquad \text{data}=\{\{x_1,y_{11}\}, \{x_1,y_{12}\},\{x_1,y_{1N}\},\,\dots,\,\{x_2,y_{21}\}, \{x_2,y_{22}\},\{x_2,x_{2M}\},\,\dots\}$, where $M\neq N$. ...
0
votes
1answer
37 views

Finding the negative real root of in set of solutions under a varying constraint

Suppose I have a function and its derivative like: V = x^3.5 - x*y Vx = D[V, x] I first solve V for ...
3
votes
1answer
68 views

Finding positions of minimum values in list

I would like to find the positions of multiple occurrences of a minimum value in a list. For instance, for the list {1, 2, 1, 3}, I want to obtain the two positions for the occurrences of the number 1....
9
votes
5answers
710 views

Building a list of products from the elements in another list

I'm new in Mathematica software, and I need help with a simple exercise. Given the list list = {x, 3.2, y, 1, 2.679, 3, z, 4, -7.9}; I need to make some rules ...
0
votes
1answer
44 views

Extract a single list of data points from a list of multiple lines

So I have a list of 50 lines that ive acquired using the EdgeDetect function on a .bmb from an experiment ive run. The list looks like: ...
4
votes
4answers
140 views

How to apply differences on part of a list and keep the rest?

I have a list, l1 = {{a, b, 3, c}, {e, f, 5, k}, {n, k, 12, m}, {s, t, 1, y}} and want to apply differences on the third parts and keep the parts right of the ...