# list-manipulation's questions - English 1answer

5.019 list-manipulation questions.

### 6 Deleting duplicates only if they are a certain kind of duplicate

2 answers, 285 views list-manipulation filtering
I have a list of tuples like this:{{1,a,b},{1,1,b},{1,a,a},{b,a,1},{b,a,b}}I would like to find a way to delete all those tuples in the list that contain a ...

### Multidimensional Matlab conversion

1 answers, 35 views list-manipulation tensors matlab
I try to convert this code Matlab code: ...

### 13 Data re-structuring by Thread

1 answers, 239 views list-manipulation data-structures
Thread can do thisThread[{a, {b, c, d}}]{{a, b}, {a, c}, {a, d}}But when above ...

### Plotting points with different marker and different plotlegend

1 answers, 20 views plotting list-manipulation
Currently i'm stuck at problem, where i have a sets of points, and I wish to plot these point with different plot markers, and also with different plot legend. The code is the following: ...

### 158 Elegant operations on matrix rows and columns

9 answers, 51.786 views list-manipulation matrix array faq
Question The Mathematica tutorial has a section 'Basic Matrix Operations', describing operations like transpose, inverse and determinant. These operations all work on entire matrices. I am missing a ...

### 4 Deleting sub-list that contains duplicates

3 answers, 53 views list-manipulation filtering
I have a large list of uniform-length lists. What is an efficient way to delete component lists that contain duplicates? For three-item sub-lists, I have used the following code: ...

### 3 Manipulation of 3D matrix

2 answers, 50 views list-manipulation matrix tensors
Assume that we have a 3D array x, and we would like to split it into 2D slices then cut every slice into some small patches and get all patches in single list ...

### 5 How do we cluster separate curves in a set of data?

1 answers, 98 views list-manipulation cluster-analysis
Below, I have included some data. (It is long, but I don't like to host data elsewhere and provide links that might some day be broken.) Plotting this set of data,...

### 1 How put a matrix in a row (with or without index titles) using mathematica

1 answers, 24 views list-manipulation matrix
I am trying to put a 16x16 complex matrix in a row, with separated columns to real and imaginary parts (i.e a 1x512 matrix). Additionally this 16x16 matrix is generated by an operator ...

### 3 Converting a free variable in a pure function into a parameter that can be varied under iteration

Here I am going, as a matter of illustration, make a large string list: l = Characters[WordList[]]; l = Table[DeleteDuplicates[l[[i]]], {i, Length[l]}];This ...

### 1 Adding each element in a list to the previous one

2 answers, 41 views list-manipulation
Having a list as follow: l = {x1, x2, x3, x4, x5};I want to add each element with the element before, so I did: ...

### 1 Select equations with RHS!=0 from a list

2 answers, 28 views list-manipulation filtering
I need to select from a list containing equations those having RHS not zero ...

### 3 How to get median based on probability distribution?

From some calculation, I have a distribution of discrete data $(i,P_i)$ and then want to get the median based on this distribution. Naive way is to create a list ...

### 3 Convert MATLAB script to find element positions satisfying more criteria

1 answers, 77 views list-manipulation filtering matlab
I am new in this community so forgive me if this is a sort of re-post. I am trying to convert this MATLAB script: ...

### 1 How can I implement a repeating operation?

1 answers, 72 views list-manipulation recursion
I have the list: ...

### 6 Find an envelope of the list of points

I have a list of points as you can see in the image below. From this list of points, I want to generate a filtered list of points, which is the envelope. Additionally, calculate the area under the ...

### 2 Replacing an element of a matrix by a function of that same element

3 answers, 59 views list-manipulation
I want to replace an element of a matrix by a function of its current value. The code I'm using is as follows ...

### 1 Refining a list of equations

1 answers, 64 views list-manipulation
I have a list of messy equations, called question: ...

### 6 Remove elements from deep nested list

3 answers, 184 views list-manipulation filtering
I have a list like this. How do I traverse the sublists to remove all the 1.'s but leaving the structure intact? I have attempted with Drop[list, {1}] but this ...

### 11 Loop over a list of strings and increment letter count in a corresponding sublist

I have a 2D list as follows: ...

### 5 Creating a new list from an existing one

7 answers, 277 views list-manipulation
Suppose we have a list containing four sub-lists like that ...

### 2 Replace part of the element in a List of points

3 answers, 64 views list-manipulation
I have a question about the list of points - in the list below I would like to change the 3rd value of each point to another - like this: {x, y, 0} to (x, y, 0.08} ...

### 3 Go through three lists simultaneously, styling output based on data in all lists

1 answers, 49 views list-manipulation output-formatting
I have three lists: ...

### 19 Are there advantages to using additional arguments of common functions rather than alternative ways of calculating with lists?

(Apologies for the long question title.) One of the interesting, if sometimes confusing, things about Mathematica is that there is always more than one way to do things. Even intermediate users can ...

### 8 Visualize a string/sequence, emphasizing certain substrings

I need to visualize a sequence, with the ability to emphasize certain segments. For example, take this sequence seq: ...

### 8 Simplifying nested If statements

6 answers, 2.616 views list-manipulation conditional
Consider :list = {100,102,103,99,106,107,104,112}I want to consider, extract only the "big moves" of that time series. In this case the moves bigger then 5 ...

### 2 How to create a table of tables? [on hold]

2 answers, 86 views list-manipulation
Consider a situation when we need to create a table of tables, e.g., forTablei[i_] = Table[{a[i,j], b[i,j]},{j,0,LargeNumber,1}]Create ...

### Tuples of elements from list excluding anything with repeated values

2 answers, 50 views list-manipulation combinatorics tuples
What I would like to do is the following. For a given list of elements; say (0,1,2,3,4) I would like to obtain all possible combinations of five, but not the ones with ANY repeated values. That is I ...

### 27 Efficient way to count the number of zeros at the (right) end of a very large number

If I want to count the number of zeros at the (right) end of a large number, like $12345!$, I can use something like:Length[Last[Split[IntegerDigits[12345!]]]]...

### Mathematica Bug? I cannot swap two elements list [closed]

I defined this function: swapTwo[{}]:={}; swapTwo[{e_}]:={e}; swapTwo[{e1_, e2_, e3___}]:={e2, e1, e3};or ...

### 4 Finding a specific string in a list

2 answers, 149 views list-manipulation
I have the following list:l={"apple","orange","kiwi","APPLE","lemon"}How can I make a command so the capitalised word would be returned? So in this case the ...

### 1 Select elements from 2D list with stride “t”

1 answers, 41 views list-manipulation
I would like to select elements from 2D list according to variable position (i.e. stride). For example:x=Range@25 ~Partition~ 5I want a command to select ...

### 6 Working with a CSV data file with 100 millions rows (and 30 columns)

1 answers, 111 views list-manipulation import csv-format
I am new to working with large datasets.. Currently I am struggling to upload a "big data" file into Mathematica. The file is in the CSV format and has 14GB. There are 100 millions of rows and 30 ...

### 1 ListLogLogPlot origin issues and numerical instability

I have the following long functions f1and f2 dependent on parameters ω and ...

### Summing coefficients of multinomial

3 answers, 103 views list-manipulation data
I have data of following form. data = {{1, multi1(z1, z2,..)},{2, multi2(z1, z2,..)},...} I want to add up all the coefficients of corresponding multinomial (and also want to perform different ...

### 16 Dropping n consecutive terms from a list periodically

9 answers, 653 views list-manipulation
Suppose I have the following listlis = Range[100];and I want to remove n consecutive terms periodically from the list. For example suppose I want to drop terms ...

### 6 Elegant way of partitioning in two starting from the second element?

1 answers, 140 views list-manipulation
I wrote a code for partitioning a list. I want to group them into two groups following the same pattern: 1. element added, then 2. and 3. are omitted, then 4. and 5. added and goes like this. ...

### 5 Replace targeted elements in first level of list only

1 answers, 97 views list-manipulation replacement
I have a list where some elements are strings or sublists: ...

### 7 How to delete arbitrary numbers of columns from a matrix in mathematica [duplicate]

7 answers, 359 views list-manipulation
Say I have a matrix of random integers, which is given byA=RandomInteger[25, {9, 11}]How can specific columns of this matrix (say 4th and 7th columns) be ...

### 12 Given a list of integers, find the largest sum of a contiguous subsequence

Given a list of integers, find the largest sum of a contiguous sub-sequence.{1, 2, 3, 4, 5, -1, 7, -4, -2} (* 21 *)And print the sub-array which is ...

### 3 Manipulating lists

2 answers, 68 views list-manipulation
Assume I have two lists: A[1,1]={1,2} and A[2,1]={3,4}. When I create a table ...

### 2 How to split sublists into sub-sublists without merging the sublists

2 answers, 83 views list-manipulation matrix
This is an extension of this question. I have xyPairsAll, which is a matrix holding sublists. It looks like ...

### Position for array

1 answers, 60 views list-manipulation symbolic array
how does Positionwork for array? In particular if i have something like this: ...