# Tagged Questions

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

135 views

### How to select states with equal times

Can anyone show me how to select the states that have equal times-dates. For example, i have two time series. First that have 10 observations, say from 2014/10/1 to 2014/10/10, and second that have 7 ...
250 views

### Replace list of symbols in an expression

I have an expression: exp = a+b+c and a list containing all the symbols of my expression: syms = {a,b,c} and I would like ...
138 views

### Conditional combining of nested lists

I have two nested lists like those {{a,A},{b,B},{c,C}...{z,Z}} {{a,1},{c,2}...{t,12}}. I want to combine them to get a new list that looks like this ...
293 views

### Why doesn't this pattern work?

I want the in-built function Count to count the elements in a list which are greater than a value. Example: ...
159 views

### Rotate points by 60° in 2D

I wrote this code, to rotate a list of points 60° about the first point in the list in 2D, but Mathemtica says: "Recursion depth of 1024 exceeded."
2k views

### Check if two lists are equal in any order

Suppose I have two lists, how can I efficiently check if the two lists are identical up to permutations of the elements? For example I would like the function to output: ...
175 views

### Matching a case when one element in a pair is Null

I've got a dataset of laitutdes and longitudes. Unfortunately, some of the dataset was from when a time when lat/longs weren't constantly recorded. So I need to remove the invalid data before working ...
114 views

### Mathematical operation on two lists by a “key” [duplicate]

I'm a complete newb here. Just looking for direction. I've got two lists like this... ...
74 views

### Summing subsets of array

I have an array farr, size Nx*Nx. I have a function frk that maps index {n,m} to an integer (approximately ...
74 views

### Loops for Unit Root Test

I want to compute some unit root tests on a data generating process. I already split the sample in 100 single samples, but how can I do a unit root test on all of them and store the results in another ...
66 views

### replace an interval of values [duplicate]

I want to replace values in an interval [a,b] by 0 in a list of values. Example: {{.5,.2,.49,1,1},{.49,.5,.495,1}} I want to get: ...
272 views

### How to Remove Undirected Edges that are the Same [duplicate]

Given: theData = {1 <-> 2, 2 <-> 3, 2 <-> 1} I would like to remove any duplicates where I define a duplicate to be: ...
85 views

### How to get an element of a list , which is computed out of substituted variables?

What is the best way to get the element of a list, which is computed out of substituded variables? For example one wants to get the first element of the first row of ...
281 views

### DateListPlot with multiple data sets and incongruous timelines?

I am using Mathematica to analyze some sales data for my company. (A copy of the available data is here.) We are trying to analyze the sales trends for each month by item. DateListPlot works well ...
749 views

### Changing the x-axis for ListLinePlot with more Lists

I'm fighting with a seemingly very simple problem: I have two lists of data, and want to plot them with ListLinePlot. The two lists are only data-points, therefore ...
370 views

### What is the best way to flatten a linked list with lists as values?

By following the advice on this site I have ended up with a linked list like the following: acc = {{1, 2}, {{2, 3}, {{3, 4}, {{4, 5}, {{5, 6}, {}}}}}}; This was ...
256 views

### Extracting Coefficients from a List of Sines

I want to extract the coefficients from the following list: list={16.2219 Sin[16.2219 t], 6.60924 Sin[6.60924 t], 13.927 Sin[ 13.927 t], 2.91309 Sin[2.91309 t]} ...
82 views

### Transforming a nested list for textual output

Hello I have a data structure based on lists, with items, subitems and subsubitems, and I want to display a textual output with a description. ...
85 views

### How do I generate a list of delayed rules? [duplicate]

I want a list like this: {x :> Print[1], x :> Print[2], x :> Print[3], x :> Print[4], x :> Print[5]} I tried: ...
260 views

### List of tuples without forbidden pair

How do you get a list of tuples in Mathematica that do not include certain pairs of elements? For example, I'm trying to list sequences of matrices of a certain length, and I do not want two adjacent ...
113 views

### Manipulate filters in arrayplot with graphical user interface

I have a set of images which need to be filtered by different filters. So I have made an interface in which the user can choose his or her filter. However I now want to manipulate the degree of the ...
186 views

### Using Cases to get elements in a list

I have the following list: ...
294 views

### Sort eigenvectors of a list of matrices

I have a list of matrices and want to obtain a list of eigenvectors and eigenvalues for each matrix, both sorted by the size of the eigenvalue. If I write ...
488 views

### Product of elements of a list

Sum is for functions; Total is for a list. Product is for a function; what is the command ...
246 views

### Conditional string replacement

I have a list of text and need to replace an element based on the text that appears in the element before it. Example of my list: ...
109 views

### Solution of a set of quadratic congruences (Chinese remainder)

Edit: Please remove this question. I think there are mathematics error in what I am asking. You are welcome to edit the question if you can state the problem correctly. I have a set of quadratic ...
240 views

### Signed power set of a list

Given {a, b, c, ...} with $n$ elements generate a list with $2^n$ elements. For example, if the list were {a, b, c}, then the ...
110 views

### How to Increase Performance of Manipulate Recalculating List?

I have a list in the form of prices below. ...
426 views

### Repeating Digits

I have written ...
409 views

### Replacing elements of a nested list by some value

I have a list of list ...
192 views

### Counting the number of instances where items at the same position in two matrices are equal?

Given two matrices having the same dimensions: m1 = {{1, a, 2}, {4, 5, 0}, {g, a, d}} m2 = {{1, b, 2}, {7, 2, 0}, {a, a, a}} Is there a built-in function that ...
415 views

### Manipulating list of matrices

I have a list of around 100 matrices, that looks like this ...
263 views

### Sublist pattern matching

Is there any way to simplify the following pattern: {p___, {a___, x_, x_, b___}, q___} :> {p, {a, x, b}, q} Ie. where I remove duplicated elements within ...
240 views

### Finding the position of a single array in a list of arrays that contains wildcard variables

Consider two lists: superList = {{wc,wc,1,wc,wc}, {wc, wc,2, wc, wc}, {wc, wc, 3, wc, wc}, {wc, wc, 4, wc, wc}}; littleList = {a,b,3,c,25}; In ...
113 views

### The conflated two uses of SameTest within Intersection

Intersection works as expected in this case... a = Range[1,5];b=Range[3,7]; Intersection[a,b] giving... {3,4,5} However if ...
365 views

### Total by a criteria

I am developing a weighted KNN algorithm. In a step, I need to do the sum of weights of each class. For example: ...
214 views

### Looping through a list partition

I got the following list and I would like to loop and partition this list in the following way. ...
173 views

### Cases or Select for catching elements in a list?

I have A list that contains sublists like that: ...
356 views

### Pattern matching - comparing two lists

I would like to compare two different lists to see if the shorter one is a member of the larger e.g. is the list {2,3}, with that sequence of elements, a member of {1,2,3,4,5}? I have tried using ...
373 views

A friend of mine showed me this example, it's a test comparing LengthWhile to a self-made lengthwhile written in a direct and ...
132 views

### Partition a list dependent on consecutive list values

I have a list of 2D points which I partition every time the distance between consecutive list elements is bigger than a certain threshold. In a second step I select all the lists that start within a ...
227 views

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

### List Manipulation on Array with subscript elements

I am trying to write a function which operates on an array with subscripted elements. As an example i have the array a={$1_3$,$2_2$,$4_1$}, which means i have 3 amounts of value 1, 2 amounts of value ...
193 views

### Convert matrix rows into variables

Can anyone show me how to set all matrix rows to variables. For example, I have matrix w={{1,2,3},{3,2,1},{0,0,0}} and I need to set each matrix row to be separate ...
251 views

### Find maxima and minima of data like {time,value}

I have a list of time and values of the charge and discharge of a capacitor, and i want to separate in two list of {time,value of charge} , {time, value of discharge} I know there is a lot of the ...
241 views

### Get 'new' list of data by manipulation 'old' list

Assume I have the the following list of data: valuesOld = {5, 10, 15, 20, 25, 35, 40, 45, 55, 65, 80}; I would like to construct the following list: ...
134 views

### Remove all “not equal” clauses from an expression

I am banging my head against the following question: how can I have Mathematica take cond = 2 a >= 3 b && 70 a >= 19 && 20 a != 13; and ...
377 views

### Faster Integer Approximation of pi

I'd like to speed up this calculation: First[Sort[Table[{k,Abs[Round[k/Pi]Pi - k]1.{k,1,100000}],#1[[2]]<#2[[2]] &]] The code above generates a list of ...