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
3 answers
584 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 ...
valar morghulis's user avatar
0 votes
0 answers
30 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 ...
Stiv Zhops's user avatar
0 votes
0 answers
38 views

Matrix Dimension Changes

I am trying to run the following code: ...
Lelouch's user avatar
0 votes
1 answer
41 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....
phy_math's user avatar
  • 801
3 votes
2 answers
113 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 ...
Seigel's user avatar
  • 33
12 votes
6 answers
2k views

The Battleship game: Identify objects within a matrix

Toy data ...
eldo's user avatar
  • 47.5k
7 votes
6 answers
551 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 ...
Ulrich Neumann's user avatar
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 ...
lesobrod's user avatar
  • 1,197
9 votes
8 answers
860 views

Shuffling two lists into each other

Given a subset s of Range[n] and two lists a and b, with ...
მამუკა ჯიბლაძე's user avatar
1 vote
1 answer
74 views

Value of a function over permutations of two lists

I want to do the sum (in Ising lattice gauge theory) ...
QFTheorist's user avatar
2 votes
3 answers
240 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 ...
Phillip Dukes's user avatar
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 ...
AG1123's user avatar
  • 561
0 votes
0 answers
42 views

Selecting from a list of associations

From a list of Associations ...
eldo's user avatar
  • 47.5k
2 votes
3 answers
186 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 ...
ConfusedCabbage's user avatar
0 votes
1 answer
68 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 ...
QC123_367's user avatar
  • 481
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 ...
eldo's user avatar
  • 47.5k
1 vote
1 answer
73 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 ...
Laurenso's user avatar
  • 1,000
3 votes
6 answers
602 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 ...
gen's user avatar
  • 195
5 votes
5 answers
636 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 ...
bill s's user avatar
  • 68.3k
7 votes
4 answers
275 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 ...
Phillip Dukes's user avatar
4 votes
4 answers
207 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 ...
ConfusedCabbage's user avatar
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}: ...
Tugrul Temel's user avatar
  • 5,470
0 votes
2 answers
112 views

How to skip code in loop?

There is some box [a,b] and each box[a,b] have elements like ...
hare's user avatar
  • 294
2 votes
1 answer
59 views

Getting empty ListLogLogPlot from a Transpose

...
Julian Yussef's user avatar
3 votes
4 answers
88 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 ...
QC123_367's user avatar
  • 481
0 votes
1 answer
76 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 ...
yen's user avatar
  • 1
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: ...
Tugrul Temel's user avatar
  • 5,470
2 votes
1 answer
57 views

What is the matter with EdgeList[] of a directed graph?

Given: ...
Tugrul Temel's user avatar
  • 5,470
2 votes
2 answers
117 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 ...
Fatima RAZA's user avatar
2 votes
1 answer
59 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 ...
Patrycja's user avatar
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. ...
hare's user avatar
  • 294
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 ...
Tugrul Temel's user avatar
  • 5,470
2 votes
4 answers
93 views

The first list is not processed

A randomly generated box[a,b] is in order[x] such that ...
hare's user avatar
  • 294
1 vote
1 answer
39 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^...
John Paul Peter's user avatar
2 votes
2 answers
100 views

How to "complete" the table by making all of its rows to have the same number of elements?

Consider the following table: ...
John Taylor's user avatar
  • 4,632
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. ...
hare's user avatar
  • 294
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\}$$ ...
deltaxxkkk's user avatar
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: ...
100xln2's user avatar
  • 427
7 votes
6 answers
483 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 ...
cstover's user avatar
  • 323
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 ...
TradeMark's user avatar
2 votes
2 answers
115 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'. ...
Joalito's user avatar
  • 123
0 votes
0 answers
26 views

How can I find the coefficient of some function of varying inputs in a list? [duplicate]

I have a list klist={4 K[{1}, {1}], K[{2}, {2}], (2 K[{2}, {1, 1}])/("Ndim")} where K[{list_1}, {list_2}] is some ...
00123456's user avatar
2 votes
3 answers
179 views

Evaluating a 2D function from a list and add the result to the list

Suppose I have a list like this data = {{1, 2, 3}, {4, 5, 6}} and a function f[x_, y_] := x^2 + y^2; I would like to evaluate ...
Dinesh Shankar's user avatar
1 vote
2 answers
70 views

Listable (on certain level) custom function

I wish to make custom listable function (for 2D points) with the next behaviour: ...
lesobrod's user avatar
  • 1,197
0 votes
0 answers
59 views

Plotting list of points to a special graph

Given Mathematica code of eigenvalues in different variable-paths , I want to add experimental data in the path Gamma-X ; X-Gamma ; and M-Gamma . Here is the code : ...
Med Ch's user avatar
  • 117
3 votes
4 answers
164 views

Calculate the Mean of lists of the same length

I have the function ...
Nitaa a's user avatar
  • 698
6 votes
2 answers
389 views

Why Does Part Work Much Slower on Modified List?

Consider the following list: tabb = RandomReal[{0.0000001, 10^5}, {10^6, 80}]; I want to extract, e.g., the columns from 1 to 20. It is reasonably fast: ...
John Taylor's user avatar
  • 4,632
6 votes
4 answers
412 views

Subdivide a sequence

Yesterday I couldn't solve a problem which seemed to be rather simple. I tried RepleaceRepeated, SequenceReplace and similar ...
eldo's user avatar
  • 47.5k
1 vote
4 answers
136 views

How to prune from a list every element which doesn't share e.g. both its 1st and 2nd elements with SOME element in a specified other list?

This is a followup question to this one. Let a and b be lists of lists like this: ...
tell's user avatar
  • 320
6 votes
4 answers
650 views

Find a certain path through a matrix

I would like to get a functional solution and nice display form for the following problem: 1. Example data ...
eldo's user avatar
  • 47.5k

1
2 3 4 5
188