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

learn more… | top users | synonyms (3)

4
votes
1answer
248 views

Use single ListPlot for multiple sets of data (on separate graphs)

This is the code I have working for a single set of data. Is there a way I can structure this to have multiple sets of data? ...
3
votes
2answers
718 views

Trying to generate a list of data to plot a graph with error bars. Need help creating the looping function

This is the sets of data I want to put into a form which will allow me to plot error bars from the min and max data. ...
13
votes
9answers
549 views

Thread over list in different levels

I have these two lists, both with the same length in the first dimension: ...
3
votes
1answer
160 views

How to efficiently take complement of two big lists?

I have a giant list l1 and some smaller lists l21, l21, ..., ...
1
vote
3answers
172 views

Logical operations on a list [duplicate]

Possible Duplicate: Applying And to lists of Booleans I have two lists filled with logicals: ...
11
votes
4answers
379 views

What's fastest way of defining 10^5 down values?

I want to define isGood[___] = False; isGood[#] = True & /@ list where list is a list of several million integers. ...
5
votes
3answers
160 views

Comparing Unequal Lists of Surnames to Establish Over or Under-Representation

I've been using Mathematica to explore historical records. I have two long lists (one is 69k, the second 17k) of unequal length. They are like so (FWIW, the first list is the first 40 entries from the ...
4
votes
3answers
358 views

Generate a Combination of letters by a number

I'm trying to write a function f. example: ...
5
votes
3answers
3k views

Local max/min of Mathematica data sets

Is there a way in Mathematica to find the local maxima of a set of points? Suppose you have ...
4
votes
3answers
709 views

Transform a Sum into a List

I want to turn a sum like this sum =a-b+c+d Into a List like this: sumToList[sum]={a,-b,c,d} How can I achieve this?
4
votes
2answers
242 views

How can I use Max[] in a function that is passed a list not find the max of the list

For most functions in Mathematica, passing them a list will call the function on each element of the list. For example: ...
0
votes
3answers
980 views

How to make all values positive?

So I have a list of data that contain both positive and negative values, and I am wondering what I have to do in order to make all the numbers positive.
3
votes
3answers
298 views

How to pull scalars out of a function that should act on lists?

Suppose I have A = a vecA B = b vecB where a and b are supposed to be arbitrary scalars ...
0
votes
2answers
101 views

How to evaluate the sum using values from the data being input

I have a problem in evaluating a sum using values from data I input. Suppose I have data = {1, 3, 5, 6, 8} If I want to evaluate the sum of my data (1+3+5+6+8), I ...
2
votes
1answer
132 views

Specifying form in MemberQ

This seems like a very simple question, the answer to which should be obvious to me. So I won't be offended if this question is closed. But I'm having trouble figuring out the answer. I would ...
1
vote
1answer
412 views

Using 'Reduce' to solve a set of inequalities, specified by a list

I have a two lists $LHS$ and $RHS$, both of size $n$. I want to solve a system of inequalities of the form: $$LHS[1] \leq RHS[1]$$ $$LHS[2] \leq RHS[2]$$ $$LHS[3] \leq RHS[3]$$ $$\vdots$$ ...
2
votes
1answer
125 views

Generating continuous products or sum

This is kind of a continuation of this question. I want to automate these 2 steps on Mathematica once I give an integer $N$. generate a list of variables $\{a_i\}_{i=1}^{i=N}$ then for some ...
12
votes
4answers
1k views

Reshape vectors exactly like in MATLAB

This gives a 64×1 column vector in Mathematica: ...
6
votes
4answers
976 views

Alternatives to While Loops?

I am using Mathematica to run a probabilistic simulation. Essentially, I have a list of members of a population (they only have one, numerical, attribute, so it's just implemented as a list of ...
2
votes
2answers
365 views

Mathematica: summing over n abstract indices

This probably has a one line answer, but I'm totally stuck. I have two tensors, i.e. two objects that depend on NN abstract indices which i've labelled ...
12
votes
4answers
473 views

Calculate proportion of values for dates

At work, we were discussing when is it the best time to change to winter tires for bikes and/or cars. Using WeatherData[] and ...
14
votes
6answers
453 views

Splitting a list by specifying section headers

I have a list of strings called mylist: mylist = {"[a]", "a", "a", "[b]", "b", "b", "[ c ]", "c", "c"}; I would like to split ...
6
votes
1answer
362 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
266 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. ...
11
votes
3answers
508 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
147 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
134 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
481 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
214 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
463 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
102 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
197 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
393 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
529 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
294 views

plot data differences

I have the following data: ...
6
votes
2answers
283 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
207 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
593 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
225 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
256 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
249 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
146 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
224 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
409 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
236 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
6k 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 ...