# Tagged Questions

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

134 views

### Combining two tables and highlighting certain values

I have got a variable list: ...
184 views

### Faster position-based duplicate removal in a ragged array?

Take a ragged 2D array: rArray={{4, 2, 1, 0}, {2, 2}, {0, 0, 3, 3, 3}, {4, 0}, {3, 4}} I need to "deduplicate" this, where a duplicate is any element of a ...
100 views

### Eigenvalues and Eigenvectors Order [duplicate]

Say I have a list of eigenvalues and eigenvectors produced from a matrix $M$ using the command {eig1,eig2}=Eigensystem[M], which will return the eigenvalues with ...
236 views

### Cases vs Select, Pattern vs Pure function [duplicate]

What is the difference between having Cases with selection condition presented by pattern and a with pure function as condition? ...
67 views

### 3D-Plot of a list of complex numbers and a list of real numbers

I'm a newcomer to Mathematica, and I'm having trouble with the following question. Say we have a list of complex numbers list1 and a list of real numbers ...
124 views

### Recursive list contruction

I am attempting to implement the exercises from The Little Schemer in Mathematica, and running to a bit of a challenge with rember (remove member). Given a list and a value, the function just returns ...
196 views

### Removing elements from a nested list based on their global count

I have a very large table containing sublists, such as for instance: {{1, 2, 3}, {4, 5, 6, 7}, {1}, {1, 8}, {9, 10}, {11, 6, 12, 13, 14, 15, 16}} I want to ...
252 views

### Fastest way to sum the upper triangle

I feel like this is an recurring question: if there's a symmetric matrix whose diagonal is not all 0, how could I get the sum of the part of it that's above the diagonal as fast as possible? Small ...
610 views

### When to use @@@ vs. /@ [duplicate]

So much thanks to Szabolcs in improving sequence.. for complete explanation. I am so glad to read all explanation which fundamentally remove the problem. But in number 4 of its explanation pointed to <...
434 views

### delete zero rows in a matrix

If there is a matrix with some of its rows equal to zero: (its zero rows are randomly distributed and does not have an ordered arrangement): same as: ...
51 views

### Adding up a list of subscripted elements [closed]

I have a list of entries with subscripts. I want to add just the entries. How can I do that in the presence of subscripts? For example: list = {1a, 2b, 3c} And ...
100 views

### How to compare and remove x-coordinates (and the associated y-coordinates) that are less than previous x-coordinates?

I am using Mathematica version 9.0 and am trying to compare and remove x-coordinates, and the associated y-coordinate, that are less than previous x-coordinates. Below is an example using sample data. ...
55 views

### Deleting duplicates of plus or minus symbolic quantities from a list [closed]

Let's say I have a list l = {a + bc - d, -a - bc + d, a + b};. Now I want to apply DeleteDuplicates[l, crit] to this list, such ...
198 views

I have ...
54 views

### Transform a vector DE into a set of scalar DEs [closed]

I have the vector equality: {{a,b},{c,d}}.D[{x1[t],x2[t]},t]=={{e,f},{g,h}}.{u1[t],u2[t]} I want to solve this using DSolve. ...
53 views

### Saving Dot-ed eigenvectors in a special comparison

We have produced a 4*4 matrix in any iteration containing nx from 0 to 2 by steps of 0.5. and in any iteration we have saved sorted orthogonalized-eigenvectors based on their eigenvalues with this ...
253 views

### Displaying a list of percentage values according to their classification

I have a list of percentages as follows: percent = {21.15, 42.3, 57.68, 73.06, 84.6, 90.37, 96.14, 99.99, 99.99, 99.99, 99.99} I want to classify these ...
335 views

### “Part specification is longer than depth” warning in Position function [duplicate]

I'm working on a project which analyzes financial data. I download the price and dividend information for the SPY ETF which tracks the S&P 500: ...
92 views

### How to find the same number in sublists of list

Intersection[Table[Table[Sqrt[p1]/r1,{r1,0.1,0.7,0.1}],{p1,0.5,5,0.5}]] I am trying to find same numbers in the sublists. But Intersection is not working for this....
69 views

### calculate relationship between cause and effect (rows/columns/delta etc.) on tableform

I tried to enter this Excel (on the right of the picture) information to program. following these codes has been used: ...
161 views

### Efficient List of Lists

I'm running some analysis that requires the creation, row by row, of a large list of lists. The big list is called "Nodes" and it will ultimately contain hundreds of thousands of rows. The first few ...
76 views

### How to count the number of values in a discrete function?

I have a discrete function of an integer variable $n$ defined like this : ...
264 views

### Replace matrix rows conditionally while avoiding For loop

I have the following variables: myMatrix={{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}} myIndices={1,3} I need to replace the rows ...
56 views

### Position not working? [closed]

I have the list: myList={0,0,0,a,b,c,0,0,d} I need to find the positions of all elements that are non-zero. I do like this: ...
94 views

### Problem Using Evaluated Replace with Associations

If I define some function like: toISOdate[data_List]:=DateString[data,{"Year","-","Month","-","Day"}] and try to applicate it in an ...
252 views

### How to imitate list comprehensions for constant arrays?

In Python, ['a'] * 10 generates ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'] and ...
61 views

### Inputting values into the variables without having to input the matrix all over again

I'm practicing using LU decomposition on Mathematica. I am able to find the L & U matrices, specifically the variables. However, i find it tedious having to input the newly found values and form ...
70 views

### Count participation of variable list

I have the directed edges of a graph given by a list of variable (vertex) pairs. ...
64 views

### How to extract part of association?

Considering an association: asc = <|"a"->1, "b"->2, "c"-><|"e"->3, "c"->4|>, "d"->5, "e"->6, "f"-><|"g"->7|>|> How ...
250 views

### List all “duplicate” elements in Tally

Tally[list,test] can use a custom function test to judge if elements are equal. But the output will only give the first element ...
121 views

### How can I write a loop to get many values from a solution?

I am looking at the value of x[t] at day t = 200 over several years. I tried to do it using a For-loop but it didn't work. This ...
82 views

### Find sub-sets of vanishing additions or subtractions from a list?

Let's say I have a list L containing n numerical numbers. Now I want to find all sub-sets of ...
256 views

### Import a column of data, make a matrix from it and export it WITHOUT curly braces

I'm new here and with Mathematica, too. I want Mathematica to import data from a txt file (it has one column of data). These entries are z-values. From this I want to make a matrix - 508 entries make ...
160 views

### Find position avoiding For loop

I have a list: {a,b,c,d,e,f} And a function sizeFunc[element_] which returns the size ...
67 views

### Dropping rational coefficients

I have a list of expressions (they all are exact numeric quantities, not containing any variables), some of them have integer or rationals coefficients, or complex coefficients with rational or ...
32 views

### Accessing the elements of a list of values [closed]

I have a list of polynomials (all with the variable x) called lyle and a function that accesses this list and evaluates it at ...
114 views

### Replace elements in some region in a list

I want to replace some elements in list. Assume that we have A={{1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16}} and we want to replace elements <...
66 views

### Sort and Save Matrices Eigenvectors to a Larger Matrix

We are going to sort and save all orthoginalized-eigenvectors of 4*4 random matrices (produced in any iteration) to a larger matrix such as storagematrix. Since, produced random matrices are 4*4, ...
182 views

### Match a variable name pattern [duplicate]

I have a list of variables: {RBI,RCD,ASD,FGH} I want to select only those whose name starts with R. Using the pattern Rx_ ...
155 views

### Join nested lists based on first and last elements within each list

I have a nested list like this: test1 = {{1, 3}, {1, 4}, {1, 7}, {2, 1}, {3, 5}, {4, 1}, {5, 2}, {6, 1}, {7, 6}} I want to join the lists together depending on ...
155 views

### Identify a scalar, a list

I have a symbolic scalar m2 and a symbolic list (representing a 3x3 matrix) A. I want a function which does something like: <...
78 views

### Convert a list of lists of rules to a list of values [closed]

I have a list of the following form: thisVeryExcitingList={{x->1},{x->2},{x->3}} I would like to convert it to the form ...
204 views

### Move element inside a list

I need to change the position of a single element in a list. Example: I start with: {a,b,c,d,e,f} I want to move the a before ...
245 views

### Improving a selection routine

How can this code for extracting the smallest (absolute) real value be improved? and would it be simpler using associations? ...
106 views

### Delete Element within a List based on the Order [closed]

I want to do the following, deleting the element of a list that do not match an increasing order as example: {1,2,3,4,6,5,7,8}->{1,2,3,4,6,7,8} I've thought of using DeleteCases but I'm not able to ...
179 views

### Do not expand matrices in Mathematica calculation

Here is an example of a problem I'm having. Consider that I have defined: omega={{p[t]},{q[t]},{r[t]}} x={{a},{b},{c}} R={{1,2,3},{4,5,6},{7,8,d}} What I would ...
539 views

### For loop in Length computation code

Here is a code I wrote that is supposed to give the length of list after some splitting and regrouping. But it is inefficient. Is there a way to rewrite in more professional and efficient way? I guess ...
60 views

### Dynamic insertion of variables

I have a list of eigenvectors of a given matrix. I need to programmatically modify this list by multiplying each vector by a variable #i, e.g. ...