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

learn more… | top users | synonyms (3)

6
votes
1answer
390 views

Find all permutations with reversals / cyclic permutations removed

I have a list of all non-cyclic permutations of n labels. How can I get rid of all elements which are redundant in the sense that they are the inverse of another one. For instance if n=4, the ...
2
votes
3answers
318 views

Maximum tuple value

Is there a simple way to make a maximum tuple value (similar to python)? For example, in python max([ (1,2), (1,3), (3,1), (4,0) ]) returns ...
12
votes
3answers
2k views

Data interpolation and ListContourPlot

I am fairly new to Mathematica and I have two quick questions on using it for a Hydrology and Hydrogeology class. One is about data interpolation and interpolating without any data defined in an area. ...
12
votes
3answers
531 views

Simpler way to fill date gaps with zero values

One basic problem when working with data like sales and dates is the case where you dont't have sales in all days, so you have to fill it to take information as average or to make a plot. See this toy ...
2
votes
5answers
159 views

Test First row of matrix

What is a good way to test the first row of a Matrix to check if one of the values equal a value. For instance, In this example, I want to get vector in the second row that has the bigger value in the ...
2
votes
1answer
137 views

Intersection of conditions

If I have a list of conditions: {cond1,cond2,cond3} and I want to use an If[] statement to test the intersection of these ...
3
votes
2answers
530 views

Dynamically remove element from list based on test

Suppose I have a list l = {a, b, c, d, e, f....} I would like to remove one of each pair {x,y} if some function ...
3
votes
1answer
221 views

How to partition MatrixPlot graphics?

Is there an easy approach - hopefully built-in - to partitioning MatrixPlot graphics into rows or columns (or both) of graphics sharing the same underlying options? ...
4
votes
2answers
505 views

Loop and do operations on Matrix, then graph the results

I'm trying to do some operations to a matrix in a loop, and then I want to graph the results. The results are pair of numbers. Can I store the results of each iteration on "something" and the use ...
1
vote
2answers
103 views

NSum generates a warning message when getting the sum of a list

I know what I'm doing can be done with Total: a = Range@3; Total@a And if I simply choose ...
9
votes
1answer
214 views

Ranking Function Allowing for Ties

I have a list that I need to be able to assign ranks to individual elements in, giving it a number related to its position if the list were to be sorted, allowing for ties. For example, ...
7
votes
3answers
433 views

How to Gather a list with some elements considered unique

I have a list of the form: list={{0,...},{1,...},{1,...},{0,...},{3,...},{3,...},{0,...},{0,...},{5,...},{5,...},{5,...},{0,...},{5,...},{0,...},...} So when we ...
5
votes
1answer
606 views

Splitting a list using SplitBy, by comparing adjacent elements [duplicate]

Suppose that I have the following list called mylist: mylist = {80.2, 80.3, 80.4, 327.6, 327.7, 327.8}; I would like to split ...
2
votes
4answers
313 views

plot data differences

I have the following data: ...
6
votes
2answers
312 views

removing elements that are contained in other elements

For example, I have a list of lists: l = {{a,b,c},{a,b,d},{d,e},{d},{a},{a,b},{f}}; And I want to remove all the lists that are contained in other lists: ...
2
votes
1answer
211 views

How to get the results of Tally split into two separate lists

This is a kind of a followup to my previous question. I am starting with a long list of plane coordinates, like this one: ...
17
votes
5answers
632 views

Map-Thread-Through-Apply a list of functions onto a list of (lists of) values

I have a list of functions: fns = {f, g, h} and a list of triples: ...
6
votes
3answers
260 views

Importing and manipulating strings - time data

I have a list of time durations, which are strings of the form: "hh:mm:ss". Here's a sample for you to play with: ...
6
votes
1answer
261 views

How to compile Map and MapAt

I have a long list (say, million of elements, like this one: {{{1.0, 2.0}, 3}, {{4.0, 5.0}, 6},...} I would like to compile a function ...
8
votes
1answer
280 views

Elementwise, compilable min function

I am trying to implement efficiently a transfer-matrix like algorithm. On each iteration, I have two vectors $x=\{x_1,\dots,x_n\}$, $y=\{y_1,\dots,y_n\}$ with real numbers and I need to compute the ...
2
votes
2answers
168 views

Constraining a random function

This question is a follow-up from here. I have a function that generates a list of correlations between some random variables: ...
4
votes
1answer
227 views

Timing differences between multiple executions of identical code

I have a list of pairs of numbers and I'd like to change the sign of the second element in each pair i.e. $(a,b)\rightarrow (a,-b)$. I'm sure there are many ...
3
votes
2answers
464 views

hexList[[1]] returns a list of decimal numbers

Sorry for not being clear about this question earlier. I appreciate the answers I got, but the edits I made should make the question more understandable. I have been working with hex in ...
1
vote
2answers
259 views

Combining lists with common elements efficiently [duplicate]

Possible Duplicate: Computing the equivalence classes of the symmetric transitive closure of a relation I am required to process sets consisting of 2-element subsets of integers by ...
21
votes
5answers
7k views

How to find the phase difference of two sampled sine waves?

I'm trying to measure a phase difference between two Sine functions I've acquired with a computer. I'm uploading one of the .txt files with the data I'm working with here: txt file. To remove the ...
6
votes
2answers
294 views

Merging different size, different order table

I'm a beginner in Mathematica, so this may be a simple request. I have generated some columns of names and data. I want to merge them into a single list of names, with a column for each attribute. ...
0
votes
1answer
851 views

How to get data from For loops to plot it?

How can I get data from For loops to use in ListStreamDensityPlot? I tried AppendTo, but it ...
9
votes
2answers
250 views

Combining nested lists that meet certain criteria for a permutation

I have the following list representing a permutation on 26 characters: ...
12
votes
1answer
497 views

How to extract and replace submatrix of a doubly-periodic matrix?

How can I effectively extract and replace a rectangular subpart of a toroidal matrix, i.e. one where boundaries are connected at opposite ends? Since the submatrix can overhang the edges, a simple ...
1
vote
3answers
270 views

Replace values of a list containing words and numbers

I'm trying to import some data in a .txt file which contains numbers and words. I import a list which consists of four rows of measured data acquired with an oscilloscope, but the acquisition program ...
1
vote
2answers
256 views

Proper way to deal with lists and map

So, I wanted to do something that I assumed would be really simple. Given two lists, $A = \{a_1, a_2, ...\}, B = \{ ... \}$, I wanted to take a function $f(a, b)$ and generate a list with $\{ f(a_1, ...
6
votes
3answers
392 views

Argmax in a List

I have a sequence of 100 lists. A sample list, list[1], looks like this: ...
19
votes
3answers
417 views

How can I regroup elements in a list into a tree based on their values?

I have a list of elements in an outline, here is an example that is only 3 levels deep: ...
7
votes
4answers
156 views

Is there a good way to map a function over a list to lists exclusively of a certain depth?

Let's say I have some ragged list. If some elements have some depth $n$, then is there a way I can map a function to only those elements? I.e., for some list foo, ...
6
votes
2answers
321 views

Conditionally replace rows in lists

I have a sequence of matrices/lists ...
3
votes
1answer
162 views

How can I find the average of the ordinate of an indefinite number of lists of points?

Suppose that I have three lists: list1 = {{0, 1}, {0.1, 10}, {0.2, 100}}; list2 = {{0, 1}, {0.1, 10}, {0.2, 100}}; list3 = {{0, 2}, {0.1, 20}, {0.2, 200}}; In ...
6
votes
2answers
194 views

DateList Segmentation of data

I've been trying to separate large segments of DateList formatted data (years worth at a time) into individual days using the Split function. The data has the form: ...
7
votes
0answers
243 views

Using Compile to speed up Function with PermutationProduct

I have the following fairly simple routine dot involving PermutationProduct that I wish to speed up using ...
35
votes
6answers
2k views

Find zero crossing in a list

I'm looking for a function that finds the index of the zero-crossing points of a list. Before I go making my own subroutine to do this, I was wondering if anyone knows of any built-in Mathematica ...
9
votes
2answers
3k views

How to get Matlab data imported with the same dimensions?

I have some Matlab image data with the following dimensions (output is from Matlab): >> size(im) ans = 86 86 3 45 The data imports just fine ...
6
votes
1answer
391 views

Count sublists which match pattern

I have a list which looks like this: data={{12,0},{0,0},{20,1},{0,0}, {0,-1}}. Now I would like to count the number of sublists which: have both slots zero the ...
2
votes
1answer
149 views

How to arrange elements of a list

A file consists out of (x,y,z) data and I need the z-values arranged like this: {{z[1],z[2],...z[idimx]},{z[idimx+1],z[idimx+2],...z[idimx*2]},{....}} With ...
16
votes
6answers
1k views

Best way to extract values from a list of rules?

Mathematica has a lot of list manipulation functions, and, also because I don't work with lists often, at times I'm a bit lost. I'll find a way, but I'm sure it's not the most efficient. Case in ...
5
votes
6answers
368 views

How to change specific values in a List [duplicate]

In a list lst I want to change all values > 255 to 255. Why is this code not working? ...
4
votes
2answers
293 views

Mathematica list element sort

I have a list, say, ...
18
votes
11answers
1k views

Generating an ordered list of pairs of elements from ordered lists

I have a pair of ordered lists. I want to generate a new ordered list (using the same ordering) of length n by applying a binary operator to pairs of elements, one from each list, along with the index ...
2
votes
2answers
151 views

Comparing elements of the $n^{\text{th}}$ sublist in a ragged list with the $n^{\text{th}}$ member of a sequence

I have a list of lists that are not of the same length (for example, {{6}, {14}, {6, 26, 30}}), but I have to compare every element in the $n^{\text{th}}$ sublist ...
4
votes
1answer
149 views

MapThread with several cells as output

Assume I have defined the following function: FF[{x_, y_}] := {x^2 + y^3, 3.5*x*y} I would like to apply FF on a list of ...