# Questions tagged [list-manipulation]

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

9,315 questions
Filter by
Sorted by
Tagged with
383 views

### How can I change elements in a matrix to a combination of other elements?

Suppose I have a list like { {x1,y1,z1}, {x2,y2,z2}, {x3,y3,z3}, ... } and I want to change it to ...
1 vote
84 views

### Modifying list operation [closed]

I have the following list ...
1 vote
37 views

### Pick last row of a matrix for which the second part of the row is smaller then a certain value

Lets say there is a matrix={{1,2,3},{4,5,6},{7,8,9}}. Im interested on the position of the last row, for which the second element of that row is strictly smaller ...
1k views

### How can I define a sequence of Integers which only contains the first k integers, then doesnt contain the next j integers, and so on

I need a list of integers to check if a variable has one of the values of the list. If[ MemberQ[List,x], Green, Red] The list contains integers and is characterized ...
160 views

### How to create an Xlookup function (similair to Excel)

Edit: I have added table3, which is closer to my real life use case and timings of the code Edit 2: I have added table4, which ...
181 views

### Replace a column/row of a matrix under a condition by a random number

Lets say there is a matrix of the form: matrix = {{1,2,3},{4,5,6},{7,8,9}} I want to replace the elements of the last column, if they are larger then zero, by the ...
86 views

### How can I change entries in a list of lists depending on the entries in the list itself?

I have an 3D dimensional Array of data. It has this kind of strucuture: {i,x,y} ...
1 vote
91 views

### Binary Distance between the two Primes

Given a prime number p, is there always a smaller positive integer exponent k such that p+2^k...
130 views

### Arrange solutions of equations in column form in a table

If we have the following system of equations: ...
150 views

### Extract terms containing symbols

I would like to be able to extract terms that contain a symbol expression and leave the special function alone. I have a list: ...
244 views

### Enumeration of a nested list

My problem is consisting of following: I have a nested list of following form: {{B, v ** v, b ** B}, {b, B ** b}, {b ** B, v ** v}, {}} And I want to enumerate ...
1 vote
53 views

### How to distinguish these strings when extracting parameters?

Consider the following list: ...
1 vote
54 views

### How to extract manipulated indexed variables from Manipulate

I am struggling with getting values of variables that are manipulated with Manipulate: The code: ...
84 views

### Solving Transcendental Equations [closed]

I want to solve the transcendental equations as follows $$A=\frac{w^{\frac{b}{a}}}{c^{\frac{2}{a}}}\mid cos(\frac{b\pi}{2a})\mid$$  c=\frac{c^{\frac{2}{a}}}{w^{\frac{b}{a}-1}}\mid csc(\frac{b\pi}{...
1 vote
38 views

### ListPointPlot3D {{x1,y1,z1},...} with Manipulate t. Data is {{t1,x1,y1,z1},{t2,x2,y2,z2}...}

I have a data {{t1,x1,y1,z1},{t2,x2,y2,z2}...}, and I am trying to plot 'x,y,z' in 3D with Manipulating 't' I have tried the similar thing before, but the 'x,y,z' were a function of t. (I wrote it ...
1 vote
55 views

### Creating coefficient matrix

Suppose I have 3 elements, $\{A1,A2,A3\}$. I have 3 independent polynomials, stored in a list $\{A1-s*A2,A2,A2+A3\}$. I want to create a matrix form which will help to visualize easily which elements ...
145 views

### Why is the code with multiple Do slower than the one without them, and why is For faster than Do?

For some table tab having N rows and n columns, I need to go over all its rows $j$ and ...
45 views

### How to flatten a list in NMaximize?

I have the following function: ...
92 views

### FindPeaks in a 2d list and half values

FindPeaks is a nice little help. But it only works on 1D lists and tends to return half integer values for positions of the peaks which are ultimately very useless ...
149 views

### Numerical integration of a list

I have a list, p, obtained by a complex numerical procedure. Its element has the structure: {k,fi,z}. Below I give a simplified ...
330 views

### Add the number of occurrences to the list elements

I'm not explaining it well, sorry. There is a list[j] consisting of randomly selected number {a,b} elements. For example,({j,4}) ...
74 views

### Why is the following code not compilable?

The code below should replace particular elements of some table acccolumns if some condition is satisfied: ...
60 views

### Why does the following code not change the table?

Consider the following code: ...
153 views

354 views

### Efficient way for writing -1 <= X[i,j] <=1

I have an $m \times n$ variable $X$. I want to write the following constraint ...
89 views

### Constructing Toeplitz Matrix

How can I construct this matrix?
202 views

### How can I remove and keep the elements of this set?

I have a list list = {{1, 3, 7, 1, 2, 1, 4, 7}, {6, 2, 7, 9, 4, 3, 6, 7}, {2, 8, 8, 2, 3, 2, 4, 6}, {5, 7, 7, 5, 2, 1, 2, 4}, {8, 10, 10, 8, 2, 1, 2, 4}} Consider ...
73 views

### Error with using ReplaceAll

I wrote a For Loop. In this For Loop, I want to change the values of a list. The main issue is: I have a nested list like: ...