Stack Exchange Network

Stack Exchange network consists of 174 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 on the manipulation of List objects in Mathematica, and the functions used for these manipulations.

0
votes
1answer
20 views

Plotting points with different marker and different plotlegend

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: ...
6
votes
1answer
280 views

Deleting duplicates only if they are a certain kind of duplicate

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 ...
5
votes
1answer
98 views

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

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,...
3
votes
2answers
50 views

Manipulation of 3D matrix

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 ...
1
vote
1answer
24 views

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

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 ...
4
votes
3answers
53 views

Deleting sub-list that contains duplicates

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
votes
2answers
66 views

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
vote
2answers
41 views

Adding each element in a list to the previous one

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
vote
2answers
28 views

Select equations with RHS!=0 from a list

I need to select from a list containing equations those having RHS not zero ...
6
votes
3answers
258 views

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 ...
3
votes
3answers
271 views

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 ...
1
vote
1answer
72 views
2
votes
3answers
59 views

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

I want to replace an element of a matrix by a function of its current value. The code I'm using is as follows ...
2
votes
3answers
64 views

Replace part of the element in a List of points

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} ...
1
vote
1answer
64 views

Refining a list of equations

I have a list of messy equations, called question: ...
8
votes
2answers
149 views

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: ...
0
votes
2answers
50 views

Tuples of elements from list excluding anything with repeated values

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 ...
0
votes
0answers
33 views

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
votes
2answers
149 views

Finding a specific string in a list

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
vote
1answer
41 views

Select elements from 2D list with stride “t”

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

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

Consider a situation when we need to create a table of tables, e.g., for Tablei[i_] = Table[{a[i,j], b[i,j]},{j,0,LargeNumber,1}] Create ...
6
votes
1answer
111 views

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

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
vote
1answer
36 views

ListLogLogPlot origin issues and numerical instability

I have the following long functions f1and f2 dependent on parameters ω and ...
6
votes
1answer
139 views

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

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. ...
4
votes
1answer
66 views
0
votes
1answer
26 views

Valid Array generation for ListDensityPlot

I want to create a ListDensityPlot of T vs k, and to do so I am not able to achieve an ...
6
votes
4answers
247 views

Find the list that best matches reference list

I need to find how well several different lists match a reference list. I'm looking for a percentage or some kind of similarity score. For example, ...
5
votes
1answer
97 views

Replace targeted elements in first level of list only

I have a list where some elements are strings or sublists: ...
1
vote
1answer
38 views

Convert Part of Subscript Files to Math Form

I have french subscript file here: https://uploadfiles.io/iehon If you download it an open it with Word, you can see that the math sections are but between $<i>$ and <\i>: To import the ...
3
votes
2answers
68 views

Manipulating lists

Assume I have two lists: A[1,1]={1,2} and A[2,1]={3,4}. When I create a table ...
0
votes
1answer
60 views

Position for array

how does Positionwork for array? In particular if i have something like this: ...
1
vote
1answer
41 views

How to separate rows with commas in imported CSV

I imported a CSV file that uses commas as its delimiter, but some fields also contain commas. When I import the file into Mathematica as follows ...
10
votes
5answers
653 views

Taking the square root of the first element of a list

If I have a list for example : {{4,1},{9,2},{16,3},{25,4}} Is there a command that replaces the first element by its square root and returns a list ? In the ...
1
vote
1answer
85 views

Study frequency of occurrence of alternatives in a test [closed]

There is a test with 5 alternatives A, B, C, D, E, I need to study the frequency of occurrence of these alternatives in a test of 80 questions, "n" times I can not think of a way to program it, help ...
2
votes
1answer
50 views

How do I find all local minima in a multidimensional array?

I'd like to find all local minima in an array of data. The array I'm working with is 3D, but I'll use a 2D example to illustrate what I mean: Say I have the following array: ...
3
votes
1answer
44 views

Simulation using Manipulate within Manipulate

Suppose there is a list of matrices (say m matrices), matC. The first element of this list is considered as the Benchmark matrix ...
2
votes
2answers
43 views

Convert List of Equations To Coefficient Matrix

I have the following list of 2 equations (but generally I have much more than 2 equations): m= {A1*x+B1*Sin[x]-C1*Cos[x],C2+A2*Cosh[x]} How could I ...
1
vote
1answer
32 views

How to select random number of elements from a list?

Assume that I have a list a = {1,2,3,4,5,6}; and I want to have a function that outputs a subset of the list such that with probability p=0.2 each element will ...
1
vote
1answer
42 views

Mapping over a piecewise function

This is a followup to a question I posted earlier today. Suppose you have a piecewise function such as "snap=max[x,0]= x if x>0, 0 otherwise". Then you would think that it must be straightworward to ...
1
vote
2answers
45 views

Slider for a list of real numbers versus a list of matrices

Suppose that there are two lists, where capital letters in List1 denote matrices. ...
9
votes
3answers
454 views

Create lists of equivalences from pairs

I have a list of pairs, e.g., ex1={{1,2},{1,3},{2,3}, {4,5}, {6,7},{6,8}, {7,8}} that I would like to merge into the list ...
2
votes
4answers
73 views

Identifying maximal element in a list with case distinctions

I need to create code that identifies the positions of all maximum elements of a list. I already know that if myList contains only numbers, I can do ...
2
votes
1answer
48 views

Select elements in a list of tuples of quaternions that satisfy a condition

I defined 24 quaternions using the Quaternions package and i create the list of all possible 4-tuples using ListQuad = Tuples[ListQuaternions, 4] where ...
6
votes
2answers
253 views

how to construct a special matrix out of two lists

I have two lists as: abs = {a1, a2, a3, a4}; trs = {t1, t2, t3, t4}; I like to build the following special matrix: ...
0
votes
1answer
56 views

Converting a list of associations into a single association

How do i smartly join a List of Associations (eg. returned by ParallelTable) such that i get a single Association? ...
4
votes
2answers
72 views

Different plotting lines and points when using lists

Does anyone know how I can to draw a line connecting a list of data, while the dots are a colour and the line another colour? As an example, the following is a list of data and how I plot them <...
10
votes
0answers
84 views

What changed in String handling between 11.0 and 11.3?

I was trying to optimize some String-handling code here using my standard trick of converting it to a list of bytes first and using basic list operations instead of ...
12
votes
10answers
1k views

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
votes
5answers
94 views

In a given unsorted list, find the maximal ascending sublists of at least two contiguous elements

In a given unsorted list, find the maximal (strictly) ascending sublists of at least two contiguous elements. input={1, -1, 2, 3, 4, 0, -2, 5, 0} and ...