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
3
votes
6answers
89 views

Generating list with short code

I need to get this list {1,0,2,1,3,2,4,3,5,4,6,5,7,6,8,7,9,8} with a very small code (< 30 characters) using Table and List functions. On each step, either it - subtracts 1 or - adds 2 I ...
0
votes
1answer
24 views

Lists forming figures

I would like to make a list whose elements form a disc when formatted. For example, this list forms a triangle when formatted ...
2
votes
3answers
26 views

cleaning up a list of values with no missing data

Im attempting to clean up a list which has missing elements by inserting the mean feature variable into the missing data ...
2
votes
1answer
60 views

Help: Obtain a huge amount of data solved in FrobeniusSolve? (perhaps better without running FrobeniusSolve?)

How to obtain a huge amount of data solved in FrobeniusSolve more systematically? I am interested in obtaining these two sets of data from FrobeniusSolve: ...
0
votes
1answer
16 views

building a graph from table of string records and array of keywords

I have a table of records, each record is about a publication onm some topic, the different colums indicating the title, authors, abstract and so on I made a function searchkeyword[string_] that ...
1
vote
1answer
36 views

how to scramble and then unscramble a list of elements?

list = {"a", "b", "c", "d"}; scrambledList=scramble[list] {"b", "d", "a", "c"} unscramble[scrambledList] {"a", "b", "c"...
1
vote
0answers
29 views

how to rotate the elements in a list?

Given a list of elements: list = {"a", "b", "c", "d"}; What is an idiomatic way to move the first element to the end? ...
3
votes
5answers
80 views

Decomposing a list into several two coordinate lists

How can the following list can be decomposed into separate two coordinate lists? list = {{1, {0}}, {2, {0}}, {3, {-2, 0, 2}}, {4, {-2, 0, 2}}, {5, {-2, 0, 2}}}; ...
2
votes
2answers
68 views

Track a moving peak on a periodic ListAnimate plot

I have a ListAnimate plot and I want to track the position of the peak as it moves. Is there any way to do this which takes into account the fact that the peak of the wave moves past the window of ...
6
votes
2answers
346 views

I'm not able to delete -> in {{x -> a}, {x -> b}, {x -> c, x -> d}}

Here is what I have done. Input DeleteCases[{{x -> a}, {x -> b}, {x -> c, x -> d}}, Rule, {2}] Output ...
4
votes
2answers
115 views

Removing a nested list associated with a key and inserting into a new list

I'm trying to remove nested lists that are associated with a key ...
0
votes
1answer
49 views

Accessing the elements of Tables that are stored in Lists

I have a list of Tables Psilist = {psi0, psi1} Where psi0 and psi1 are 2D tables. I would ...
1
vote
1answer
69 views

How to evaluate {Subscript[x, 1] == 2, Subscript[x, 2] == 3} , $x_1^2+x_2=2^2+3=7$

My code simply can't solve this. $ x_1^2 + x_2 = 2^2 + 3 = 7 $ ...
1
vote
0answers
43 views

$ x $ and $ y $ coordinates in ListLinePlot [closed]

I'm trying to make a ListLinePlot with my randomly generated data, and I want one vector to be the x coordinates of the graph, ...
0
votes
0answers
45 views

How to plot a series of arrows from a list of vectors?

Suppose I had a list of 3-vectors as a time series like the following: ...
5
votes
3answers
234 views

Position of a nested list

I have a list of the form { {{1, 2}, 0.395}, {{1, 3}, ∞}, {{1, 4}, ∞}, {{2, 3}, 1}, {{2, 4}, ∞}, {{3, 4}, ∞} } and I hope to find the elements whose list ...
6
votes
3answers
116 views

Split expression into list of terms

I'm looking for a nice way to split an expression into a list of the terms (i.e. the addends). The desired behavior in: ...
1
vote
3answers
74 views

Import data from different webpages of the same website

I imported and cleaned the following datasets for england soccer league in order to have home/away rank tables and next round matches: ...
5
votes
2answers
79 views

Apply Outer to list of matrices and vectors

I have a list, M, of square $ n \times n $ matrices, {M1, M2, M3, ...}, and a list, V, of $ ...
1
vote
1answer
105 views

Automate Poisson Football Scores Prediction

I would like to automate a simple poisson football scores predictions process. I started by importing and cleaning home and away England League team tables data to work on it with Poisson ...
1
vote
0answers
35 views

Retrieving boundary points of concave hull (or alpha shape) in 3D

I am trying to find the boundary points of some concave 3D region which is described by a list of points. If the region were convex I would take the convex hull and simply extract the coordinates ...
4
votes
2answers
127 views

Automatic generation of filenames from column values and automatic PlotLegends labels from file names?

I have a two-part question about the automatic generation of file names and Plot Legends, Labels. Part 1: I typically work with very large matrices of data with columns of the form: MASTERdataset: ...
1
vote
1answer
67 views

Color code and string choice on a table

I have the following Table: ...
4
votes
2answers
176 views

Create a matrix from the rows of another, and calculate the rank of the new matrix

This may be a very basic question, so apologies in advance, I'm a first-time Mathematica & StackExchange user! I have a 7x3 matrix X with all rows being unique in a 2D-list format. For example:...
0
votes
1answer
109 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 ...
4
votes
1answer
66 views

How to specify Part in [[{…}]] at mixed levels?

In the following example, how to easily get {2,4,10} using the [[{...}]] syntax? ...
3
votes
1answer
2k views

How to make an efficient difference of sets function?

How to write a nice code that removes all elements from given set A, that occur also in set B? I would like to use DeleteCases[] for this purpose, but have no good ...
0
votes
0answers
41 views

Using If statement to evaluate lists

I have a list of x,y values and i am finding the distance between each point, So for 20 point in my file I have something like this, ...
8
votes
2answers
155 views

Top few numbers (highest) of a list

If I have a list A = {51, 2, 3, 4, 5, 6, 7, 52, 55}; How do I get the highest three numbers of A to get ...
2
votes
2answers
60 views

Rearrange a list according to position association with a new list

I have the following code: ...
0
votes
0answers
32 views

After execution of simple list manipulation every expression turns dark blue and nothing is defined - how to debug

This question is related to this one in the sense that it uses the code from there. What happens is best illustrated in the video here. When I run (* part 1 *) ...
2
votes
1answer
46 views

Label Callout as a symbol instead of numeric values

I have this code: ...
3
votes
1answer
46 views

Construct a list given two different lists — a list of elements and a list of indices of those elements

I have two separate lists, say: L1={{1,2},{1,3},{2,3}} L2={A12,A13,A23} How can I construct a single matrix A with values $$\left(\begin{array}{ccc} 0 & ...
0
votes
1answer
37 views

How to count outputs in Catch command by using Mathematica

I am using the below command in Mathematica (an example): Catch[Do[i; If[EulerPhi[i] > EulerPhi[i + 1], Print[i]], {i, 1, 100}]] Of course, I would like to do ...
3
votes
3answers
416 views

Map and Pure Function

Trying to take the first item of a member and raising it to the power of the second item of the same member and then subtracting the output from the third item of the same member, the list: ...
1
vote
1answer
68 views

Implement a math command on a list of numbers [closed]

I have a set of numbers and would like to do the same math process on all of them. Example: data1={1,2,3,4,5,6} Then have each number processed as Log(1), Log(2),..... This seems like such a ...
0
votes
1answer
60 views

Mapping a function to a list

Trying to map: ...
1
vote
1answer
38 views

Code a function to obtain an output table from an input dataset taking into account some rules

Good morning, I have an input dataset in the following form: ...
0
votes
1answer
44 views

Help with printing table data

I am looking for the way of building a Table in a fast way. My true table evaluates huge functions with a system of differential equations . Let us for simplicity consider this: ...
6
votes
3answers
126 views

Automatic data evaluation and elimination

I have an experimental data set: ...
5
votes
3answers
181 views

How to construct simultaneous equations from two lists?

Assume that I want to solve a simultaneous equation below. \begin{cases} 2x_1+3x_2=5\\ x_1-x_2=0 \end{cases} First I construct two lists ...
2
votes
1answer
33 views

How to construct a list from a single output

Sorry if I didn't make it clear in the title but is there a way to construct a list from montecarlo = If[Norm[RandomReal[{-1, 1}, {2, 1}]] < 1, 1, 0] for an ...
0
votes
0answers
29 views

I want to make list series with “Do”

I want to make list series as follow list1={}, list2={}, list3={}, ... I will put my data(data1.m, data2.m, data3. ....) in this lists. I could Import data like this : ...
1
vote
1answer
64 views

How to add within elements of a list?

I'm trying to show the possible combinations of rolling 3 dice and taking the sum of the two highest numbers ...
2
votes
3answers
72 views

Function on nested lists

Please can someone help with this question, I'm a bit stuck. Write a function which will accept a list corresponding to a mark list, where each entry in the mark list has the form ...
1
vote
2answers
99 views

Automate table to display figures

With reference to the post Automate Poisson Football Scores Prediction, I succeded in defining the Poisson probability density function for home (μh=A) and away (<...
1
vote
3answers
60 views

Using select to replace values which meet a condition

I like to use Select statements to clean my data. Usually I will use the Select to exclude data from the next stage of my ...
3
votes
1answer
345 views

Selecting cases from a list based on two conditions

Let's say we have a list of lists of length 3, as below: ...
2
votes
1answer
306 views

What is the fastest way to build a simple table?

Question: What is the fastest way to obtain a table of values from a parametrized function? For a function of x, which is a sum of ...

1 2 3 4 5 121