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
0
votes
2answers
41 views

How can I create and plot (in the same diagram) 1000 different vectors in Mathematica?

I'm new to Mathematica and I got stuck. Also, I'm not a programmer, so I would like to ask the following question. I want to make 1000 different vectors, of which everyone contains 55 random elements. ...
0
votes
0answers
20 views

Extract all function arguments of a big expression [closed]

I have a big expression with the structure exp = a1*f[u1,v1]+b2*g[w2]+a2*f[u2,v2]+...a_n*f[u_n, v_n] and I want to get all pairs ...
6
votes
2answers
165 views

Applying functions to list elements selectively

I've got two lists that contain an element identifier and a number: ...
0
votes
0answers
38 views

Defining function with arbitrary length

I want to make some function with whose input is an arbitrary length of a list. For example, what I did in for explicit case as follow ...
1
vote
1answer
35 views

$P=QR$ decomposition of given list

For given arbitrary lists, I want to decompose the list into two parts and assign individual lists. i.e., I want to decompose, $P=QR$. And I can think of its decomposition in two cases: ordered and ...
6
votes
3answers
264 views

How to use Intersection[] but keep the original list order

I want to keep the original order of l1: ...
1
vote
1answer
186 views

Ridges on Breather surface

BreatherSurface is given in Mathematica code. Taking clue from this view or otherwise how to obtain table of $ (u,v,x,y,z) $ points and its plot of any one single ridge where the cusps have infinite ...
4
votes
0answers
60 views

Visualising 'The Moessner Miracle' in higher dimensions

I thought it would be interesting to try and represent "The Moessner Miracle" in higher dimensions. This is my first attempt for higher dimensions anywhere so I'm not sure if the logic is ...
0
votes
0answers
23 views

Prove that list of numbers with positive sum has positive circle route [closed]

I came across a question - in case there is a list of numbers - [ 1, 3, -5, 2, -2, 4, 5] and we know that the sum of all the numbers is positive (8) How can we know that we go in a circle way thru the ...
0
votes
0answers
33 views

How does one specify that an input variable is an integer? [closed]

Essentially, I want to combine 4 square matrices using the ArrayFlatten command. However, I am specifying the matrix dimensions as an input variable as follows, ...
0
votes
2answers
62 views

Use solutions of FindRoot in subsequent calculations

I want to solve the equation $b e^a = 2$ in $b$, for values of $a$ ranging from $0$ to $10$ and each time $a$ to be increased by $0.1$. So I have: ...
0
votes
1answer
39 views

Split OR conditions into full cases

I have a list of inequalities with AND/OR conditions (A,B,C,D are all inequalities): ...
2
votes
1answer
35 views

Find common and uncommon inequalities in two lists

I have two lists of inequalities: l1={a>b&&c>d} l2={a>b&&c<d} Meaning that, some inequalities in the lists are the same, while other ...
2
votes
1answer
69 views

Exporting multiple lists (x1,y1…n) (x2,y2..n)of different lengths into same excel files separated by spaces of two columns between each (x,y) list?

I have multiple lists like this this with different lengths and different x, y values, ...
3
votes
3answers
168 views

Join two lists according to False condition

I am new to MMA. I have a question of joining two lists according to a condition. Suppose I have two lists with same number of elements, ...
2
votes
1answer
59 views

ListLinePlot trace looks fuzzy with too many data points

I'm plotting a list of data (v) where some of the points are very close together. No problem if AbsoluteThickness[x] is set to x=0.5, but the trace begins to look fuzzy if x>2.5. This is mainly an ...
3
votes
1answer
57 views

Efficient way to get all $k$-factors of a graph $G$?

In Graph factorization, a $k$-factor of a graph $G$ is a spanning $k$-regular subgraph which has the same vertex set as $G$. Now I have a random graph $g$ (i.e. complete graph for simplicity) and I ...
1
vote
1answer
72 views

Listmanipulation with DateObject

I work with a list containing DateObjects. I want to transform the dateobject to a "Month". The list contains 6 parts. Fot simplicity, the list looks like: ...
3
votes
3answers
5k views

How to Output Lists without Commas or Brackets?

When trying the below code, is there a more elegant way to output the numbers without the commas or brackets? Grid, as suggested in other threads, is not behaving ...
1
vote
1answer
53 views
0
votes
0answers
24 views

Given sum of sequences, choose two sequence elements and make other sequence zero with making some sequence vanishes and others keep untouched

Slightly modified from my previous question Making function for a given input of sum of sequences, choose two sequence $a_i, b_j$ and substitute all other sequence zero At this time I want to make ...
1
vote
2answers
37 views

Making function for a given input of sum of sequences, choose two sequence $a_i, b_j$ and substitute all other sequence zero

Suppose I have a sequence a,b,c,d,e,f,g and for given sequence whose element is expressed as a1,a2,a3, ... , c1,c2,c3, ... g1,g2,g3, and so on. And suppose from these sequence with some manipulation ...
4
votes
4answers
190 views

Is there an easy way to copy a TableForm column and convert it into a vector?

Is there an easy way to take a column output from a TableForm command, like this: ...
2
votes
0answers
58 views

Delete columns of table where the sum of column adds to zero

Given, data = {{1, 0, 1, 0, 1}, {2, 0, 2, 0, 2}, {3, 0, 3, 0, 3}, {4, 0, 4, 0, 4}, {5, 0, 5, 0, 5}}; Delete the columns whose sum totals to zero. Specifically,...
0
votes
0answers
48 views

a variable as all values from a list

I have a small Problem with lists and variables. I want mathematica to calculate a formula I derived for 200 values of w between 0 and 5 in ascending order. (maybe I can define w along the lines of) <...
3
votes
1answer
79 views

Removing empty elements

I have data from people being asked for a result of the swab test - (1=pos, 2=neg, 3=not received, 4= inconclusive,9=ignored, empty cell= not applicable). I'm looking for a way to get rid of the not ...
3
votes
2answers
119 views

Find different combinations of 3 lists with given constraints

My inputs are 3 lists of unequal length: A={a,b,c,d} B={i,j,k} C={v,w,x,y,z} And I want to find the combine set X which looks like ...
7
votes
3answers
281 views

Partition a nested list such that no repeated elements in every subsets?

I have a large list and for simplicity, let's take the simple list as an example: lists = {{1, 2}, {1, 6}, {2, 3}, {2, 5}, {3, 4}, {3, 6}, {4, 5}, {5, 6}} I would ...
0
votes
1answer
63 views

Performing mathematical operation on the y coordinates in a list of coordinates

I have a list that contains a set of coordinates in the form {{x1,y1}, {x2,y2}, ...}. I want to edit the list in manner that it takes the log() of all the y coordinates only. Essentially, I want ...
0
votes
1answer
49 views

Selecting data around peak position

I'm trying to write code that imports experimental data, finds peaks in it and cuts data around specific peak for further analysis (Fourier transform & model fitting of spectra). Currently, I'm ...
3
votes
4answers
60 views

Making function $S$ such that inputs as an list $\{1,3,2,4, \}$ and produces $s_{1234}$

I want to make $S[\{,\cdots, \}]$ as follows First input of $S$ is given list $\{1,2,3,\cdots, n\}$ and it produces $s_{123\cdots n}$ Further, if the ordering of the list is given differently, still ...
12
votes
4answers
505 views
0
votes
0answers
41 views

How to use compile with input form a list?

as a minimum example this is how I usually use Compile ...
2
votes
1answer
50 views

Efficient way to partition a list into equivalence classes given an equivalence class function (not an equivalence relation)?

Suppose I have a list of elements and a function f which maps each element of list to an ...
0
votes
0answers
66 views

Separating pieces of a term

In a list I have, there are two pieces per term like so: "name (country)". Is there a way to separate the name and country into separate "columns" so it appears as "name, ...
0
votes
2answers
69 views

NMinimize over a list of integers

I'd like to minimize some function (of 3-4 variables) over a big list of integers, but not consecutive. Like arr = {5, 10, 7, 101,...} I did not understand this ...
4
votes
2answers
162 views

An operation on a list [closed]

I have a nested list, and I want each sublist to be connected by a <-> symbol between the first and third elements and between the second and fourth elements. For example, ...
5
votes
4answers
303 views

List rearranged

I have a very long list from which I will display part of it as, a={{1, {3, 5, 8, 9}}, {2, {4, 6}}, {6, {1}}, {10, {1, 3, 5, 6, 7, 8}}}; For plotting purposes, I ...
2
votes
3answers
84 views

Swapping items in a table

I have a code that generates various tables like ...
6
votes
1answer
78 views

Transforming a checkerboard using Transpose and ReshapeLayers

In the paper for RealNVP, they introduce a "squeezing" operation that takes a matrix and transforms it to have more channels, according to the following transformation (before and after): As you can ...
0
votes
0answers
87 views

how to change list of some scalars into vectors?

I have a pair of equations f= {eq1,eq2} that are (x,y) dependent. I take derivative by (x) and (y) for each equation, for example, Grad[f, {x, y}] . {1, 1}] and ...
1
vote
1answer
82 views

Dropping specific elements from list

list[1] = {{1, 1, 0}, {1, 0, 1}, {0, 1, 1}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, {-1, 0, 1}, {1, 0, -1}, {-1, 0, -1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1}}; ...
1
vote
0answers
31 views

How do I input n-Dimensional random numbers into a function accepting n variables [closed]

Apologies if this is overly simple but I wasn't able to find an answer online. Question Say I have a function defined as follows (and not two separate instances of random numbers), ...
0
votes
1answer
77 views

Lists of labelled vectors, how to output a list of tuples which sum to zero

list = {{1, 1, 0}, {1, 0, 1}, {0, 1, 1}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, {-1, 0, 1}, {1, 0,-1}, {-1, 0, -1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1}}; list2 = {{2, 0, 0}, {0, 2, 0}, {0, 0, 2}, {-2, ...
1
vote
1answer
49 views

Delete rows from 3D matrix and convert it to 2D matrix

I have a 3d matrix of dimension $11 \times 1000 \times 3$. I need to remove the first 10 rows from all 2D matrix so that the output is $11 \times 990 \times 3$. After that I need to convert it into a ...
1
vote
2answers
49 views

Find Columns That Match Row Vectors in a Matrix

Suppose I have the following matrix whose row elements are given by the data listed below. ...
1
vote
1answer
83 views

List of lists with non-repeating elements

I have the following lists: l1 = {{a,b},{a,c},{a,d},{a,e},{a,f}}; l2 = {{b,c},{b,d},{b,e},{b,f}}; l3 = {{c,d},{c,e},{c,f}}; l4 = {{d,e},{d,f}}; l5 = {e,f}; I want ...
0
votes
1answer
64 views

Deleting all elements in a list where the output of elements from a function is zero

I tried using DeleteCases to delete elements in r1 where g2==0 to get a defined arithmetic ...

1
2 3 4 5
143