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
52 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."
7
votes
5answers
453 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: ...
2
votes
2answers
101 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 ...
6
votes
2answers
69 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... ...
1
vote
1answer
51 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 ...
0
votes
1answer
40 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 ...
2
votes
3answers
122 views

Concisely returning a position in an array with an index variable [on hold]

We have an array and an index in the array: exampleArray = Table[{a, b, "q"}, {a, 1, 10}, {b, 1, 10}]; arrayIndex = {5, 4}; Very simply, we can return the value ...
2
votes
2answers
31 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: ...
3
votes
4answers
95 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: ...
2
votes
3answers
67 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 ...
2
votes
1answer
60 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 ...
4
votes
3answers
97 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 ...
8
votes
3answers
212 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 ...
4
votes
5answers
207 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]} ...
1
vote
1answer
58 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. ...
0
votes
2answers
34 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: ...
6
votes
2answers
226 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 ...
2
votes
2answers
79 views

Joining two lists with diverse properties [closed]

I want to make a list from two independent ones. ...
1
vote
1answer
61 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 ...
4
votes
4answers
157 views

Using Cases to get elements in a list

I have the following list: ...
2
votes
1answer
100 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 ...
5
votes
2answers
134 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: ...
0
votes
0answers
67 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 ...
5
votes
4answers
170 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 ...
1
vote
1answer
61 views

How to Increase Performance of Manipulate Recalculating List?

I have a list in the form of prices below. ...
9
votes
5answers
357 views

Repeating Digits

I have written ...
4
votes
6answers
234 views
4
votes
5answers
136 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 ...
3
votes
1answer
129 views

Manipulating list of matrices

I have a list of around 100 matrices, that looks like this ...
4
votes
4answers
131 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 ...
4
votes
4answers
114 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 ...
3
votes
2answers
72 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 ...
6
votes
6answers
252 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: ...
4
votes
2answers
136 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. ...
3
votes
3answers
130 views

Cases or Select for catching elements in a list?

I have A list that contains sublists like that: ...
5
votes
4answers
222 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 ...
13
votes
2answers
324 views

Bad performance of LengthWhile?

A friend of mine showed me this example, it's a test comparing LengthWhile to a self-made lengthwhile written in a direct and ...
3
votes
2answers
84 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 ...
6
votes
2answers
126 views

Bad performance from SubsetQ?

Can I say this is a bad performance from the new V10 function SubsetQ? Here are some tests comparing it to ...
6
votes
3answers
198 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 ...
3
votes
2answers
110 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 ...
1
vote
1answer
35 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 ...
2
votes
4answers
217 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: ...
2
votes
3answers
76 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 ...
3
votes
3answers
245 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 ...
5
votes
5answers
135 views

getting at the right parts of a list

I have a way to solve my problem, but it seems like there should be something better. Also I realize that I probably don't have a good enough handle on how to get at parts of lists the way I need to. ...
14
votes
12answers
556 views

Join lists with nested list

Is there a way of smarter way of joining list of the form l1 = {a,{b,c}}; l2 = {d,{e,f}}; l3 = {g,{h,i}}; To obtain ...
6
votes
3answers
147 views

Remove Successive Duplicate From A Large List (200k by 4 matrix)

I am interested in removing successive duplicate rows from a very large list (~200k rows by 4 columns) using Mathematica.The built-in 'DeleteDuplicates' seems to remove all duplicates, I am interested ...
0
votes
0answers
43 views

Convergence Problem using FindFit

I have the following input where there is a convergence problem in the FindFit as shown in the attached figure.The figure shows 2 plots: one of the real data and the other of the fitted line. Any ...
0
votes
0answers
61 views

list numbering problem

I have a list that is generated from a unparsed matrix, and another list that is generated by a parsed matrix. However, since the second one is parsed, the numbering of the elements in the list have ...