# Tagged Questions

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

108 views

### Combining sub-matrices by replacing zero elements with symbols

I have a nested matrix as m: ...
303 views

### How to check if two nested lists have the same structure?

How can I check if nested lists like these have the same structure: ...
233 views

### First pair out of order

I would like to know how to efficiently determine the first pair of elements in a list that are not in order according to some predicate p. That is, list[i] > list[j] according to p, and i is the ...
227 views

Can I say this is a bad performance from the new V10 function SubsetQ? Here are some tests comparing it to ...
522 views

### How do I prune a list of pairs of numbers so that each number occurs on only one pair?

How do I select only the first pair of numbers in which a number occurs from a list of pairs of numbers? For example, I have ...
80 views

### Filling a matrix with a list of lists

I have a list of lists with different lengthes: {{a1,a2},{b1,b2},{c1,c2,c3},...} Now I want to create a matrix the following way: ...
1k views

### Convert a list of hexadecimal numbers to decimal

I know that to change a single number from hexadecimal representation to decimal, you can use: base^^digits. However, if you have a list of numbers, Mathematica ...
182 views

### How to apply list of values to a list of functions

I have the following: first= {1+a,2+a,3+a,4+a} and a list t={0,1,2,3} I want to evaluate the first element of "first" at ...
116 views

### Select sub-lists of common length from a list

Revised Question I have a list with nested lists with the following format: ...
179 views

### Delete duplicates from list of pairs

I'm fairly new to Mathematica, and I've finally stumbled upon something that's beyond my googling powers. I have a list of pairs, where each pair contains in its first entry a matrix and in its ...
100 views

### Replacing members of a list with elements sampled without replacement from another list

I have a list of element pairs: pairList = {{1,2}, {2, 3}, {3, 4}, {4, 5}}; I'd list to pick a subset of the elements in this list: ...
38 views

### How to combine two or more groups while selecting form the unbalanced panel data if the number of obs is less than a scalar in certain groups

I have an unbalanced panel data. I want to calculate group statistics for each group. However, if ith group has less than K obs, then I want to combine ith and (i+1)th groups to calculate group ...
288 views

### How do I write a condition for Position that uses both the current and previous element?

For example, given {57, 3, 40, 94, 9, 84, 81, 93, 76, 5, 7, 76, 38, 9, 23, 95, 49, 0, 30, 3} I'd like to get all the indices at which the elements cross from ...
473 views

### Turning a set of random walk data 45 degrees

I have a set of data that is just a "random" (generated by me, not by computer) sequence of length 2000 of 1's and (-1)'s. I used it to plot a 1-D random walk where +1 is step up, (-1) is step down, ...
142 views

55 views

### Count elements between matching opening and closing parentheses?

Suppose I have a List of the form: lst={"(", "x1", "x2", "(", "(", "x3", ")", "x5", "(", "x6", ")", ")", ")"} For each pair ...
1k views

### DeleteCases on list of Strings

Consider the following: data={"AB","CD","AF"}; Now I would like to delete all String from data which starts with "A". Result:...
928 views

### Specifying string patterns in DeleteCases

It seems that DeleteCases is not compatible with string patterns, at least directly (see, for example, this question). Is this true? If so, why is this the case? ...
54 views

### Selecting from a list [duplicate]

OK, I know this must be a simple problem, but right now I'm just stuck and need some advice with this :). I have the following list: ...
547 views

### Find (longest) overlapping elements between two lists

I am trying to write a function f that returns the overlapped sublist where A ends with this sublist while ...
125 views

### Creating sublists based on the first column

I have Excel file consisting of two columns such as: ...
130 views

### Block anti-diagonalize a square matrix?

In Mathematica there is a very convenient function called JordanDecomposition[]. It takes a square matrix A as an argument and ...
173 views

### Map at a subsequence of a list

I'm trying to construct a function somewhat similar to MapAt. A basic usage example should look like this: ...
68 views

### How to extract a contiguous s_1 x s_2 x … x s_d subarray from an n_1 x n_2 x … x n_d array, where the dimension d is a variable

Given a multidimensional array, such as the 3-dimensional 2 x 2 x 3 array { {{a,b,c},{d,e,f}}, {{g,h,i},{j,k,l}} } How can I extract an arbitrary 3-dimensional ...
44 views

### Writing a math formula to order results in a certain way [closed]

I am not very well educated in math and I have a math puzzle that I'm trying to solve. I have the following list and each object has 3 numbers. The first 2 numbers are better when they are as high as ...
349 views

### How do I plot results of complicated calculations in Mathematica?

I am new to Mathematica and am struggling with making plots of how features of solutions vary with parameters. For example, I can find the eigenvalues and zeroes of a Sturm Liouville problem (showing ...
185 views

### How to generate a range of numbers

Is there a quick and dirty way to generate a list of numbers from 1 to some arbitrary large number in order such that the digits of each number are only 0's, 1's, and 2's? I tried doing ...
58 views

### Length of Union Incorrect?

I am having a problem with the Union of sets not giving me the correct Length. ...
194 views

### MovingMap maps to second level unexpectedly

I'm trying to build a financial indicator in mathematica. I import some historical data ...
158 views

### Exporting a table to Excel in CSV format

I am trying to create a table which when exported in a .csv format and opened in MS.Excel has the following form; ...
73 views

### How do you hide/show a dynamic element in a list?

Here is the simplified version of the problem: THIS: {1,2,##&[],4,5} RETURNS: {1,2,4,5} ...
246 views

### Selecting sublists of different length if at least one element of the sublist fulfills a criterion

I have the following list, containing sublists with 1,2 or 3 elements. ...
371 views

### Is there an inequality operator (Less, Greater) for lists of elements (as opposed to elements)?

Like multi-column sorting. For example, {1,3,5} > {1,2,5} would return True, while ...
208 views

### Evaluate a list

I have a function $f(x_1,\cdots,x_n)$ that takes $n$ arguments, and I would like to evaluate it using a list of lists \$\lbrace\lbrace x_1,\cdots,x_n \rbrace,\cdots,\lbrace x_1',\cdots,x_n' \rbrace,\...
121 views

### Null before each element in a list [closed]

I have a list of colors that I am trying to use to color another list, I have a function that makes the list and I call that function and set it to a variable in another function. If I try to print ...
45 views

### FirstPosition returning an error message together with the correct answer

I have the following code: ...