Skip to main content

Questions tagged [list-manipulation]

Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.

0 votes
1 answer
47 views

Apply an equation based on two sets with different indexes

Apply an equation based on two sets with different indexes Simple example If I have the following elements in the form of two sets with different indexes: $m=\{m_1,m_2,m_3,m_4,m_5\}=\{1,2,2,2,1\}$ $p=\...
Emad kareem's user avatar
7 votes
2 answers
274 views

How can I sort all levels except the innermost level?

How can I sort all levels except the innermost level? The number of levels is unknown. For example: list = {{{d, c}, {b, a}}, {{4, 3}, {2, 1}}} If we needed to ...
internet's user avatar
  • 785
0 votes
2 answers
72 views

Other methods extract the x-coordinates and y-coordinates from a list of multiple coordinate values and list them separately in two individual lists?

x={0.04,0.06,0.04,0.08,0.08,0.05,0.05,0.07,0.07,0.06} y={0.25,0.4,0.22,0.54,0.51,0.34,0.36,0.46,0.42,0.4} The two lists above represent sets of x-coordinates and y-...
csn899's user avatar
  • 4,521
2 votes
3 answers
295 views

Filling the areas enclosed by two curves and calculate them

I know that there are plenty of posts on this, but I just cannot find the right one that solves my issue. The issue is that I have two datasets that I plot them using ...
KratosMath's user avatar
  • 1,309
3 votes
1 answer
228 views

How to optimize performance with DeleteDuplicates?

Does anyone know how to improve this for speed performance? The code works fine, but DeleteDuplicates makes it really slow for large lists. ...
internet's user avatar
  • 785
7 votes
3 answers
412 views

Unsorted Intersection

a = {0, 3, 1, 2, 3}; b = {5, 1, 2, 3, 4, 7}; c = {3, 1, 8, 5}; ...
eldo's user avatar
  • 81.7k
1 vote
1 answer
33 views

Print List based on conditions

How do I print only the values of p which are all True? In addition, is this an efficient use of a Loop in this situation or can this be improved without using a lietral for loop? ...
Steve237's user avatar
  • 491
0 votes
0 answers
67 views

How to speed up this code? (related to list manipulation)

This code is a program for generating a 2D roughness surface. There is no problem when the image size (m * n) is small (e.g., 50 * 50), but when it gets larger (e.g., 500 * 500), errors occur and the ...
GaAs's user avatar
  • 157
2 votes
2 answers
98 views

How can I make a list of exercises from a list of triples to write equation of the plan passing through three points?

I use proflycee to make a tex file like this ...
Thuy Nguyen's user avatar
  • 1,131
6 votes
4 answers
262 views

How can I permute pair of elements in a list?

How can I find all permutations (ways of exchanging positions of pairs in brackets) in a list? The position of elements not in pair should not change. ...
internet's user avatar
  • 785
6 votes
3 answers
173 views

How to replace sequences in a list based on specific patterns?

I have this list: list = {V1, A1, B1, A2, B2, B1 A1, V2} I want to replace sequences like A1, B1 with ...
internet's user avatar
  • 785
0 votes
1 answer
57 views

Finding kernel of a set of polynomial functions [closed]

I have a list of polynomials fi[x_] and polynomial fractions qi[x_] (with i as an iterator) ...
siddhesh's user avatar
0 votes
1 answer
41 views

Defining Objects using a Table or Loop

Suppose I want to define weight[] on a list. For instance I want weight[a]:=3, weight[b]:=5, etc. I tried to do this using the ...
VertexVexed's user avatar
9 votes
7 answers
411 views

Create sublists whose totals exceed a certain threshold and that are as short as possible

list = {2, 1, 8, 10, 1, 4, 4, 5, 3, 4, 4, 11, 12}; th = 10; It is easy to create sublists whose totals don't exceed th: ...
eldo's user avatar
  • 81.7k
9 votes
1 answer
181 views

List[...] + Association[...], or Association[...] + List[...], when does the order matter?

Values of a list can be added to an association's values like so, ...
Carl Verdon's user avatar

15 30 50 per page
1
2 3 4 5
641