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

learn more… | top users | synonyms (3)

0
votes
1answer
34 views

Create a Table depending of two variables [closed]

I tried to create a table depending of two variables as: W= Table[{G[[i]], G[[j]]}, {i, 1, 3}, {j, 1, 3}] I wanted it to look like ...
6
votes
3answers
90 views

Comparing elements of a set and deleting elements based on a criterion

I have a function that has two inputs. The first input is a set of 2-element sets, and the second input is a single 2-element set. My function complements each 2-element set with the second ...
0
votes
0answers
39 views

Procedure argument value change [duplicate]

I'm trying to create my own hamiltonian cycle algorithm using Mathematica for school, and I'm stuck on a syntax issue. I get the following error: ...
3
votes
4answers
204 views

How to switch from List of rules to Association?

Considering we have a list of rules: ...
8
votes
0answers
91 views

ListConvolve Memory Hemorrhage

I wrote a routine that convolves an impulse response array with a test array and checks for the RMS difference between that convolution and a data array. I do this iteratively so that I can modify the ...
0
votes
2answers
58 views

Writing a function with variable arguments [duplicate]

I want to write a function which takes multiple arguments varying from 1 to n, where each argument is a triplet. sublistProduct[{$a_1,b_1,c_1$},{$a_2,b_2,c_2$},...] = { $\Pi_{i=1}^{i=n}a_i ...
1
vote
2answers
58 views

How to make function accept list of rules as an argument?

Considering the list of rules: r= {"a" -> "1", "b" -> "2", "c" -> 3, d -> 231, "e" -> 1.25}; I want to have a function ...
2
votes
3answers
99 views

DeleteDuplicates in a list of 2-tuples under condition

Having a list of 2-tuples, I would like to delete such 2-tuples that have 0 at second position, but only those, whose first element is not unique in the list. E.g. ...
1
vote
3answers
97 views

How to manage list of list of rules?

Considering we have a list: str = "{1 -> {a -> aa, b -> bb}, 2 -> {2a -> \"{b -> bb}\"}}" Bringing this to expression gives: ...
4
votes
1answer
64 views

Automatically assign Variablenames to multiple checkboxes

I want to implement the option to import data from Excel and then the ability to trim this data in order to fit the needs. The import from Excel: (source) ...
2
votes
5answers
72 views

Find list item before first negative value [closed]

If I have a list like this: ...
6
votes
4answers
285 views

How to delete Missing[“NotAvailable”] from list of rules?

Considering we have a list of rules: ...
1
vote
1answer
93 views

Accumulating elements of lists taking the criteria out of another list

In order to find the critical values for the significance of a discrete distribution, for example BinomialDistribution[20,0.6], i need a function which works on the ...
1
vote
0answers
36 views

Combine nested list entries [closed]

I have a list with stock index data (which I load from a database) as follows: ...
5
votes
3answers
213 views

Count elements of a list

Let's create a random list n = 100; data = Table[{RandomReal[{0, 2}], RandomReal[{-1, 1}]}, {i, 0, n}] Now we divide the $(x,y)$ plane into four sectors with the ...
3
votes
1answer
184 views

How can i subtract a surface from another

I have one surface which i got with using analytical solution. And one by ListPlot3D. My question is how can be withdrawn from the one from the another. ...
0
votes
1answer
115 views

Manipulating list based on Euclidean distance

I have an array of 101 matrices. Each matrix contains information like id, position (x,y,z), time etc about a collection of particles, looks like this ...
1
vote
1answer
88 views

Summing terms in Table

I have a table that looks like Table[m, {k, 10}, {j, k}, {i, j}] where, m is a square matrix that depends on the indices $i, ...
1
vote
2answers
70 views

Circular Playing up in a Grid

As we know, there is a possibility to emphasize some elements of a Grid by highlighting its cell with ...
8
votes
4answers
727 views

Replacing a for-loop with something functional

I'm a physics grad and have been using Mathematica mostly for data visualization. The evaluation part I normally do with C/Python, but I've been wanting to try out Mathematica for these tasks, too. ...
2
votes
3answers
124 views

How to insert a Matrix into a larger matrix

I have a 4x4 matrix v1 v2 v3 v4 myM={{a1,a2,c1,c2}, v1 {a2,a3,c2,c3}, v2 {c1,c2,d1,d2}, v3 {c2,c3,d2,d3}} v4 And I want to ...
3
votes
2answers
84 views

Combining sub-matrices by replacing zero elements with symbols

I have a nested matrix as m: ...
6
votes
6answers
226 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: ...
3
votes
2answers
69 views

SameTest issue?

Folks, I am trying to construct and algorithm which finds all of the remaining groupings (of three items, in this case) from a list of items for which no two items are in groups that have previously ...
1
vote
2answers
52 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: ...
0
votes
1answer
67 views

Unexpected results from output with NumberForm and ScientificForm

I wrote this little function to help me export tables with formatted numbers to files: (By the way, if you have suggestions on how to make it more efficient and compact, it would be great) ...
3
votes
2answers
257 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 ...
2
votes
2answers
60 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 ...
9
votes
2answers
462 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 ...
1
vote
1answer
50 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 ...
4
votes
2answers
91 views

Select sub-lists of common length from a list

Revised Question I have a list with nested lists with the following format: ...
0
votes
1answer
25 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 ...
13
votes
7answers
755 views

How to sort digits in a string while keeping other characters untouched?

Now there is a string with digits and letters, for instance, "95uge678r3gi89hgfe30kgh063d51". And the expected output is ...
4
votes
5answers
258 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 ...
8
votes
3answers
369 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, ...
0
votes
4answers
80 views

Find all disjoint subsets of equal length

Suppose that $A$ is a list with $n$ elements where $n$ is even. I want to write a function that returns all pairs $(A_1,A_2)$ where the sets $A_1$ and $A_2$ each have length $\frac{n}{2}$, $A_1 \cap ...
0
votes
3answers
69 views

How to iterate through a list of rules?

Let's consider I have a list of rules: {Aa -> 1/2, Av -> 2/5, Bx -> 3/7, Ce -> 4/9, ...} I want to find all keys that contain the letter "A" and ...
4
votes
2answers
107 views

How can I insert an element every $n$th position in a list?

How can I insert an element every $n$ positions in a list? For example, inserting a zero as every 4th element to turn {1, 2, 3, 4, 5, 6, 7} into ...
0
votes
0answers
23 views

Returning multiple results from compiled functions in M10 [duplicate]

I have found a similar question from 2012 here. It has been 3 years now and we have version 10. Have there been any attempt to solve this problem either by Wolfram or by the community - how to return ...
1
vote
3answers
61 views

Selective data append to nested list

I have a list of database id and stock indicies which I use to withdraw the related price data. lis = {{4470, "^AEX"}, {4471, "^AFLI"}, {4472, "^AORD"}} I use ...
2
votes
1answer
50 views

Evaluate recursive funtion as a whole before computing a recursive step

I'll try to make a basic example of my problem with $n$ being an array of elements, ex. $\{1,2,2,3,3,3\}$: If i have a sum which needs a computed value i would like to compute it beforehand and store ...
6
votes
2answers
129 views

How can I generate a $2n$-point moving maximum of a list as efficiently as MaxFilter?

This is based on the prior question, Moving maximum function?, where @rasher provided two winning solutions (i.e. clearly the most efficient): MaxFilter[list, 1] ...
0
votes
1answer
36 views

operating lists [closed]

I have 2 lists 25 items, as I do so that data entering this formula ...
13
votes
1answer
153 views

Unexpected slowness checking for empty list?

I thought I had a firm understanding of the differences between Equal and SameQ, but this has me puzzled: ...
5
votes
6answers
562 views

Can Mathematica delete some of the 0's from a list?

I have a list: {1,2,3,0,0,4,5,0,0,0}. I want to delete the 0's occurring after the last positive integer. In other words, I ...
1
vote
1answer
40 views

Change date format in nested lists

I have a list of index symbols and data as follows: ...
1
vote
3answers
134 views

Deleting one of each chosen elements in a list containing duplicates [duplicate]

I want to delete one of each (and not all) selected element in a list containing duplicates. For example i have the list: $\{1,1,1,2,2,3\}$ and i want to delete $\{1,3\}$ so the leftover should be ...
2
votes
2answers
35 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 ...
0
votes
4answers
65 views

Delete data were y = “NS” in a list with elements {x, y} [duplicate]

I have a list of data {x, y}and not all of them have actual values. They show as {x, "NS"} or ...
9
votes
6answers
539 views

Flatten nested lists

I have a list as follows lis= {a, {{{b}, {c,d,e}}, {{f}, {g,h,i}}}} which I would like to flatten to ...