Questions tagged [list-manipulation]
Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.
9,402
questions
0
votes
0
answers
26
views
Method of assigning a number to the number of attempts that have appeared from it, with the first attempt appearing as number 1
I want to assign the first trial that appears as number 1 and the number of trials that appear from there as elements of the list, plus a number.
At first,
The following ...
0
votes
1
answer
52
views
Assigning flag to the end of a collection of series
I have a large number of series(in the form of Rules) and want to assign flag at the highest order of each of the rules. What I mean, is following. Take the list of ...
2
votes
1
answer
85
views
How can I determine the cycle lengths in a directed graph?
I have a directed graph:
a = {{0, 1, 0, 0}, {0, 0, 1, 0}, {1, 0, 0, 1}, {1, 0, 0, 0}};
AdjacencyGraph[a]
I want to determine the cycle lengths in the directed ...
0
votes
1
answer
47
views
Making some powers of variables inside the function : $X * \alpha^{m} *\beta^{n} f[A[x,y]] \Rightarrow X f[\alpha^{m}\beta^{n} A[x,y]]$
Suppose I have a function of the form $ a_1 a_2 \cdots a_n b_1 \cdots b_m \cdots f[L[x,y]]$. I want to make some particular letters and their power inside the bracket.
i.e.,
I want the letter $\alpha,...
0
votes
0
answers
36
views
The Value is not Updated in the list/table [closed]
I have following data
groupedTerms3rdcycle = GroupBy[term3rdcyclelist, Most -> Last];
where term3rdcyclelist is the list.
I ...
3
votes
2
answers
130
views
Taylor approximation of integrals
I have BVP as in the picture and I want to solve it numerically by method given as follow. In the original paper, it is motioned that first iteration is computed and other are computed with Taylor ...
2
votes
3
answers
171
views
Manipulate list of equations
I have a list of equations:
eqns={a/b==c,d/e==f,...,x/y==z}
Now I want to muliply each of the equations with corresponding denominator, so that the result is:
<...
5
votes
3
answers
84
views
How to add a column to a dataset made up of an association of associations?
A dataset can be created in at least two ways: first, from a list of associations, second, from an association of associations (I know that it is also possible to create it as a list of list and an ...
7
votes
7
answers
422
views
Accumulated instance count of each list element
Given a list with repeated elements, for example:
list = {m, i, s, s, i, s, s, i, p, p, i}
I'd like to determine, for each position in the list, how many times the ...
4
votes
3
answers
633
views
How to remove a high accuracy numerical number from a list?
My numerical calculation gives a list of numbers
list = {-0.36, 0.2499999999999992, -0.21, 0.36, 0.36},
I want to delete 0.25 ...
0
votes
0
answers
62
views
Calculation hangs when called an own function from own loaded package. Debug output shows strange things
I created a package a long time ago and it was working, but in the versions 13.2 13.3 an old created function hangs when called. If I evaluate the same function from a cell manually and then call, it ...
0
votes
0
answers
40
views
Matrix Dimension Changes [closed]
I am trying to run the following code:
...
0
votes
1
answer
42
views
Neglecting coefficients of a given list
Suppose I have some complicated expressions, I want to extract some terms with $\{a_1, \cdots, a_n\}$ out of the complicated expressions without considering coefficients.
For example, here is my trial....
3
votes
2
answers
116
views
How do I create a list of matrices based on lists I have?
Okay, so let's say I have these lists and a number
a = {1, 2, 3};
b = {4, 5, 6};
And now I want to create 3 matrices that each look like this
...
12
votes
6
answers
2k
views
7
votes
6
answers
556
views
Rearrange triple sublists
Given a set of triple lists (all contain element 9!)
tripel = {{5, 10, 9}, {4, 9, 3}, {3, 9, 8}, {4, 5, 9}, {9, 10, 8}}
I would ...
0
votes
0
answers
53
views
MinimalBy with argument and value
I need to find element of some list arr which is minimal by some function f.
But I need to get result in form ...
9
votes
8
answers
872
views
Shuffling two lists into each other
Given a subset s of Range[n] and two lists a and b, with ...
1
vote
1
answer
75
views
Value of a function over permutations of two lists
I want to do the sum (in Ising lattice gauge theory)
...
2
votes
3
answers
241
views
Getting all solutions to an equation on condition the variables are either 0 or 1
Given a list of 3-bit binary lists
b={{0,0,0},{0,0,1},{0,1,0},{0,1,1},{1,0,0},{1,0,1},{1,1,0},{1,1,1}};
I would like to have all possible solutions to
...
1
vote
1
answer
73
views
Map list of strings to appropriately nested functions
I have a list of strings consisting of sequences of "+" or "-"'s. For example, let's take the list
...
0
votes
0
answers
43
views
Selecting from a list of associations
From a list of Associations
...
2
votes
3
answers
187
views
Table with additional conditions for the generated objects
Suppose that I have a function
prob[n_] := Table[Subscript[p, i], {i, 1, n}]
that generates tuples with n entries that correspond to probabilities. What I would ...
0
votes
1
answer
69
views
A simpler way of identifying which elements of Tuples[{0,1,2,3},6] multiply with each of my codewords to give zero?
So I have a list of codewords. The codewords have length 64, so there are 64 codewords in my code. My code is over an alphabet of 4 (the code can be thought of as having four elements $0,1,2,3$ and ...
7
votes
4
answers
505
views
Fill an empty matrix with the depth of its elements
Given an arbitrarily nested empty matrix like for example
mat =
{
{},
{{}, {}},
{{}, {{}}, {}},
{{}, {{}}, {}, {{{}}}}
};
and knowing that
...
1
vote
1
answer
74
views
How can I make a map to solve in a list of coefficients of an equation?
I have a list
list = {{2, -4, 3, 1, -2}, {2, -3, -4, -1, -2}, {2, -3, 4, -1, -4}}
and
...
3
votes
6
answers
603
views
Repeating a list k times [duplicate]
I have a list, say $\{1,2,3,4\}$ and I would like to repeat this list k times to obtain a list of $4k$ elements that looks like $\{1,2,3,4,1,2,..,1,2,3,4\}$.
I was hoping something like ...
5
votes
5
answers
641
views
How to sort filenames in actual numerical order?
I have inherited a collection of files that are numbered... something like:
file-0, file-1, file-2, ... file-9, file-10, file-11, ... file-19, file-20, ...
When I Import them, they come in scrambled ...
7
votes
4
answers
276
views
Create a list of indexed variables and assign values in one line of code
It is easy to create a list of indexed variables
F/@{1,3,6,8}
I would like to assign values in the same line of code
...
4
votes
4
answers
209
views
Selecting elements from nested list based on condition
Assume that I have a nested list of the form
d = 0.1;
v = Table[{x, y, z}, {x, -1, 1, d}, {y, -1, 1, d}, {z, -1, 1, d}];
How do I select all elements {x,y,z} of ...
0
votes
2
answers
175
views
Sorting a list of functions by exploiting the recursive structure
Given a list of functions list and a vector of arguments {t, a}:
...
0
votes
2
answers
115
views
How to skip code in loop?
There is some box [a,b] and each box[a,b] have elements like
...
2
votes
1
answer
59
views
3
votes
4
answers
89
views
Is there a better way to calculate the number of codewords of weight $i$ in a list of codewords?
Background Info
I am interested in a better way of doing the following:
I want to find the weights of the following codewords (the weight of a codeword here can be defined as the number of nonzero ...
0
votes
1
answer
79
views
Trying to plot the Fourier transform solution to the heat equation on Mathematica [closed]
I have gotten the solution of the heat equation as
where f(y) is the initial heat distribution which I have been given as f(x) = e^([Sigma]x^2).
I am supposed to plot this at the value of sigma 1, 2 ...
2
votes
3
answers
177
views
How to express a list of lists of rules as functions?
Given a list of lists of rules as follows:
...
2
votes
1
answer
57
views
2
votes
2
answers
118
views
Multiplying elements of two lists in all possible orders
I have two lists:
U1 = {u10, u11, u12};
U2 = {u20,u21, u22};
and I want to get a third list that will be the product of these two lists in a particular order. the ...
2
votes
1
answer
60
views
How to modify a position on a list? [duplicate]
I have a set of points:
data := {{10, 15}, {20, 45}, {30, 97}, {40, 162}, {50, 221}, {60, 249}, {70, 231}, {80, 166}, {90, 75}, {100, -5}}
What I want to do is ...
0
votes
1
answer
97
views
How not to process the first list?
(I reconsidered my previous question as it didn't describe well what I wanted to implement.So I repost this)
There is a box [a,b] in order[x] generated in a random sequence.
...
3
votes
2
answers
250
views
How to map an unbalanced list of lists as functions?
Given:
Map[f, {{a, f, h, m, n, k},{a, b}, {z, d, f, h, k}, {c, d, e}, {c, p}}]
I like to have a list of ordered functions as ...
2
votes
4
answers
93
views
The first list is not processed
A randomly generated box[a,b] is in order[x] such that
...
2
votes
1
answer
40
views
How can I use Flatten[list, 1] in this list?
My code
list = Table[Expand[(k x - i)^2 - j^2 y^2], {k, 2}, {i, 2}, {j, 2}];
Flatten[list, 1]
I get
{{1 - 2 x + x^2 - y^2, 1 - 2 x + x^2 - 4 y^2}, {4 - 4 x + x^...
2
votes
2
answers
105
views
How to "complete" the table by making all of its rows to have the same number of elements?
Consider the following table:
...
1
vote
2
answers
72
views
How to delete a list from a list?
I don't know how to delete a list from a list.
For example, There is a list.
...
2
votes
7
answers
315
views
How can I get a list of symmetric polynomials?
Q1: Suppose I have an expression like this one:
$(1+x+y+z)^3$
How can I transform it into the following expression:
$$\{1,x+y+z,x^2+y^2+z^2,xy+xz+yz,x^3+y^3+z^3,x^2y+x^2z+xy^2+y^2z+xz^2+yz^2,xyz\}$$
...
1
vote
3
answers
91
views
Interpolating data which arent in the proper list form
I have some data which are structured poorly, and I want to interpolate them. This is the way they are structured:
...
7
votes
6
answers
484
views
Apply function to all first arguments of a nested list of rules
Currently, I have a nested list of rules of the form
lst1={1->a,2->{3->c,4->d,5->{6->f,7->{8->h,...}}}}
(where I don't know the length of ...
1
vote
0
answers
98
views
Optimize grouping of list of lists by elements
I have a sorted list of lists of size ~200,000 x 3. The data are such that the first element of each triplet loops through i = 1, 1.1, 1.2, ..., 199.9, 200, and for every value of i, the second ...
2
votes
2
answers
116
views
Convert list of variables to list of parametrized functions
I have a list of differential equations of some variables
eqns = {f[x,y,x',y'],g[x,y,x',y']}
e.g., f[x,y,x',y'] = x x' + y y'. ...