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

learn more… | top users | synonyms (3)

11
votes
3answers
739 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. ...
10
votes
3answers
315 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
118 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
111 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
220 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
140 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? ...
3
votes
2answers
265 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
81 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
95 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, ...
6
votes
3answers
226 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 ...
4
votes
1answer
165 views

Splitting a list using SplitBy, by comparing adjacent elements

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 ...
1
vote
4answers
192 views

plot data differences

I have the following data: ...
6
votes
2answers
199 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
162 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: ...
15
votes
5answers
396 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
122 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
194 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 ...
6
votes
1answer
127 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
131 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
168 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
204 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 mathematica ...
1
vote
2answers
127 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 ...
16
votes
5answers
2k 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
203 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
375 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
203 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
255 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
165 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
156 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
190 views

Argmax in a List

I have a sequence of 100 lists. A sample list, list[1], looks like this: ...
19
votes
3answers
321 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: ...
6
votes
4answers
121 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
187 views

Conditionally replace rows in lists

I have a sequence of matrices/lists ...
3
votes
1answer
99 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
119 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: ...
8
votes
0answers
178 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 ...
26
votes
6answers
891 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
887 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 ...
0
votes
1answer
161 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
128 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 ...
8
votes
4answers
361 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
264 views

How to change specific values in a List

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

Mathematica list element sort

I have a list, say, ...
18
votes
11answers
639 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
140 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
128 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 ...
16
votes
8answers
422 views

Applying And to lists of Booleans

I'd like to take {True,True,False} and {True,False,False} and apply And to get ...

1 6 7 8 9 10 13