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
1answer
86 views

What is the difference between Catenate and Flatten? [closed]

I am having a hard time understanding the difference between Flatten and Catenate. Consider the following example code: ...
3
votes
1answer
39 views

select subset of combinations based on condition

My question is about choosing a subset of combinations within a list, based on a condition. Fot example, a shop sells 26 products. The name of a product starts with a letter. Each product has a price. ...
2
votes
3answers
41 views

Extract a row from dataset based on two strings

Say I have a list as below: ...
4
votes
1answer
104 views

Permutations with Repetition

I am working with a function of type F[a,b,c,d,e,f] that obeys the following symmetries: ...
5
votes
1answer
223 views

Split list by sequential entries

I have a list with some entries being sequential and some not. I would like to construct a list of lists split by sequential entries. In this context, sequential means the integer value increases by ...
0
votes
1answer
50 views

accessing and modifying matrix element

I basically want to do the following A = Array[0 &, {4, 9}]; a = {2, 3}; A[[a[[1]], a[[2]]]] = 1; A // MatrixForm but with less cumbersome notation.(i.e. ...
0
votes
0answers
49 views

Contour plot of a constant y? [closed]

I have the following data points, ...
0
votes
1answer
62 views

Gather list items by position [closed]

I have the following list: list = {{a, b, c}, {d, e, f}}; Independently of the size of each sublist (...
1
vote
1answer
39 views

How to separately pass elements of a 3D list as part of the arguments of a function

Hi I have a function which its arguments have the form F[a,b,c,d,e] but the 2nd to 4th arguments are in a list of the form R={{{b,c,d},{e,f,g}},{{h,i,j},{k,l,m}}} how can I pass these elements as ...
4
votes
2answers
156 views

List correction

I have a list of games, locations, and dates in the following format: lis = {date, firstTeam, firstScore, secondTeam, secondScore, location of secondTeam} Location ...
3
votes
1answer
106 views

Is it possible to improve a code related with iterative closest point (ICP) algorithm?

I am trying to write a code related with ICP algorithm. The purpose of the code is matching a target data with a reference data by translational operation in XYZ axes (3-degree-of-freedom (DOF) ...
5
votes
3answers
181 views

How to manipulate the colours when joining points in ListPlot

Suppose I plot out two sets of data on the same graph as follows: ListPlot[{{{1, 1}, {2, 2}, {4, 4}}, {{3, 3}, {5, 5}, {6, 6}}}] The colours of the points change ...
0
votes
0answers
24 views

CDF is not working in webpage

This is the first time when I am trying to put my interactive dashboard into my website. But it is not working. These Ways I followed: 1- Save the .nb file to .CDF file format. 2- Use the "...
3
votes
2answers
179 views

Delete duplicate from list of lists with unequal lengths

I have a list of lists with different lengths, it is of the form { {{1,2},{3,4}}, {{5,6},{7,8},{25,-1},{-14,-3}}, {{1,2}}, {{5,6},{7,8},{22,-1},{-11,-3}}, } It ...
0
votes
1answer
56 views

How to find all functions that accept level specifications as an argument?

How can I find a list of every function that takes a level specification as an argument?
0
votes
2answers
62 views

How to swap keys and values of an association? [duplicate]

How do you swap the values and keys of an Association in a manner similar to taking the transpose of a two-dimensional matrix or nested list? I am trying to solve the Wolfram Challenge Capital Cities ...
1
vote
0answers
129 views

How to Create an Efficient Word Square Algorithm?

I am working on the Wolfram Challenge Babbage Squares. I have looked at the following resources in order to come up with an idea for how to find all the possible word squares: Word Squares and Beyond ...
0
votes
1answer
39 views

Contour plot with x, y and z values?

I have x , y and z as x = List[1.355, 1.357, 1.359, 1.36, 1.357, 1.355]; and ...
2
votes
2answers
55 views

A question about Ordering command

We have the following list: list={a,b,c}; Subsequently, we apply the Ordering command to the permutations of the previous list, ...
9
votes
4answers
2k views

Is there a simple way to convert {a,b,c} to a,b,c?

I need to use: Composition[G][x] In the elements of the following list: j = {{a, b, c}, {c, b, a}}; That is: I could do: ...
1
vote
0answers
57 views

How to get List element after `[[ ]]` operation [closed]

How to get the first and second element in every last column from every row? eg. {{7,8}, {3,3}} ...
6
votes
1answer
111 views

How to obtain all subsets of a list with repetition?

I'd like to generate all lists of length m containing all possible element combinations from a given list of length n with ...
1
vote
1answer
43 views

How to optimize time to obtain large data set? [duplicate]

I would like to generate a set of data of matrix of size 1000 x 1000 x 1000 in a region defined by 0 outside the sphere of radius r=100 centered in the coordinate (500, 500, 500), and number 1 inside ...
0
votes
0answers
42 views

Check if two elements exist in a list

I would like to know how i can determine if two elements in a list exist. For example the setup would look like this: ...
4
votes
2answers
137 views

Sort nested list by a fixed order

I have a nested list like this one: list={{{a,1},{b,3},{c,5}},{{b,1},{c,3},{a,5}},{{c,1},{b,3},{a,5}},{{a,1},{c,3},{b,5}}} Now I need to sort the list such that the ...
1
vote
1answer
46 views

How to create a simple transformation function on lists using short form of ReplaceAll?

I can easily do this with Map so the real goal of this exercise is to get a better grip on using transformation rules. Please help with this. The outputs should be ...
13
votes
4answers
425 views

Group points which on several straight lines

I have some points, they are distributed on three straight lines, how to group points on the same line? I have tried FindCurvePath, but I got the wrong result. I ...
5
votes
1answer
466 views

Generating a list of integers that sums to zero

Given a pair of integers n and k, I want to generate all lists of integers of length n, ...
1
vote
1answer
44 views

Interpolate function against time

I have two vectors called lammdaWind11 and timeWind11. They are of size 51*1. I have interpolted each one independently as ...
4
votes
3answers
230 views

Shift the value of the elements in a list

goodmornig, I have a list of numbers like this: ...
5
votes
1answer
89 views

Using Table to Assign Values for the Index

I would like to assign values for the two indexes at the same time. For example: Table[x + y, {x, {1, 2, 3}}, {y, {1, 2, 3}}] will give me an output of: ...
3
votes
2answers
95 views

How to reorder a 3d (m x n x n) array to extract an n**2 length list of sequences of m points

I have a 900x100x100 array of floats called 'data' which is essentially 900 frames of 100x100 pixels. I want to extract 10,000 sequences of 900 values each. These are essentially the time series of ...
0
votes
1answer
42 views

Finding the list where the minimum is

So I have the following lists: TolRin=0.2; TolRout=0.1; TolC={0.02, 0.05, 0.4}; TolL={0.02, 0.05, 0.3}; I want to find the minimum on this lists and I know that Min can do that https://reference....
0
votes
0answers
44 views

Split list based on a threshold

Problem I have to split a list into multiple lists whenever any element of the list is above a certain threshold. The last element of my list is always zero or less ...
12
votes
2answers
1k views

How can I use fast Fourier transform (FFT) to solve a PDE (heat equation)?

I'm trying to solve a one-dimensional heat equation (PDE) with the Fourier transform numerically, in the way it was done here. The equation: , is subject to the initial condition: , where U(x,t) is ...
3
votes
2answers
94 views

Subtract lists in a list of lists

I have experimental data where every run is stored in subsaves, e.g. Run 1 has subsaves run1.1, run1.2, run1.3, run1.4. and the data are cumulative. I import the data of a run using ...
3
votes
2answers
66 views

Argument of maximum value of a table in range

I have data = {{817, 501}, {818, 549}, {819, 562}, {820, 534}, {821, 534}, {822, 535}, {823, 516}}; How to find argument "822" for 535 (which is the ...
1
vote
1answer
50 views

Deleting elements of a list with a condition [closed]

I have a long list of number-pairs, like this {{a,b},{c,d},{e,f},...{y,z}}. I need to delete some elements if its 2nd number is less than a threshold ...
0
votes
0answers
47 views

Numerical minimization of function

So I have the following equation: 3 Sqrt[9.15753*10^-6 + 25.1556 TolC^2 + 25.1556 TolL^2]==1; Now TolC and TolL can take respectively the values of these lists: <...
0
votes
0answers
36 views

Flatten a pair of matrices within a list of matrices

I have a list of matrices, which I think is better to give an example using the code. ...
5
votes
3answers
186 views

How to locate a value from a list

I made a list with two values in each cell. ...
0
votes
1answer
47 views

Formatting list by applying `Re` and `Im` [closed]

I have a list of the form $$\{\{ a_1, b_1\}, \{a_2, b_2\}, \cdots, \{a_n, b_n\}\},$$ where $a_1\in\mathbb R$ and $a_2\in\mathbb C$. I want to change the list to $$\{\{ a_1, \mathrm{Re}(b_1), \mathrm{...
0
votes
1answer
41 views

Count number of entries based on date

I have the following sample data: ...
1
vote
2answers
87 views

How to find non-zero integers in a list containing zeros and times? [duplicate]

I have lists like {0, 1, 0, 3, 0, -t2, 0, -(1/t2), 0, 0, 0, 0} including zeros, non-zero integers, and times. I wonder how I get the position of all non-zero ...
2
votes
1answer
62 views

How to manipulate functions?

This is probably a simple question, I have matrix a , and I construct b from a by adding a variable to the first column. b is a function of variable d, and now I need to do mathematical calculation on ...
7
votes
1answer
189 views

How to set deeper patterns in arguments within function definitions. For example if an argument must be a list of 1 or more strings

Suppose I want to define a function whose argument must be a List of only Strings and List must have at least one member. I know how to require that the Head must be a List but how does one qualify ...
4
votes
2answers
109 views

Map a function to irregular matrix column major_order

Suppose I have an irregular matrix ...
1
vote
1answer
50 views

How i can add an element of one sublist to other?

I have list. st = {{1, 2, 3}, {}, {}} It is nessesary to add the first element of any sublist to start of other sublist. In a quick way. Example: from 1 to 2 ...
5
votes
3answers
267 views

Make the elements in the grid appear one by one

I need to make an animation like this, start with a table at first, then each element filled from left to right, top to bottom, instead of dynamically generating grid, the current code can only ...
1
vote
0answers
84 views

Extension of /@ operation

If I want to extend this useful operation /@ into a "matrix" version, say for example (#1*{Cos[#2], Sin[#2]}) &/@ ...

1
2 3 4 5
146