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

learn more… | top users | synonyms (3)

3
votes
3answers
214 views

Plot sublists as different colors

I have one big list with many sublists inside. All sublists consist of three numbers. For example: ...
3
votes
1answer
213 views

How to store values indexed by integer partitions for fast access?

I have a huge list of values indexed by integer partitions. If I store them simply in a list, then, when I want to access the value corresponding to some particular integer partition, I have to find ...
3
votes
4answers
338 views

Mapping over the last level of a list, or equivalent operations

I would like to style each element of my list using Style. But when I try ...
3
votes
3answers
680 views

Sum of Multinomial Coefficients

Basically, I want to write a function to compute the following sum $f(m,L):=\sum_{0\leq k_1,\cdots, k_n\leq m} \binom{m}{k_1,k_2,\cdots k_n}$ and $\mathrm{supp}(k)=L \subseteq \left \{ 1,...,n \right ...
3
votes
2answers
250 views

Using the elements of a subset in a Do loop

I would like to use the elements of Subsets in a Do loop. I have: ...
3
votes
3answers
653 views

Problem with Union and Intersection

Consider the following: list={{a,b,c},{c,d,e},{d,e,f},...{x_,y_,z_}}; I would like to apply Union on the elements of the list ...
3
votes
3answers
309 views

Combining heads of lists so that you can create a nested list from two sublists

I have a list such as list = {1,4,3,4,6,3,1,2,3,4 ... } and a range, say, range = Range[20000]. I want to obtain the following ...
3
votes
1answer
303 views

n-fold symbolic integral in Mathematica

I am trying to compute symbolically a n-fold integral (n is a parameter of a function) over, say, the cube [0,a]^n. My code looks like this ...
3
votes
3answers
5k views

Product of elements within a list

Please Consider : list={{5,2,6},{2,8,3}} I need to get the product of all the element within list : As of now I do this : ...
3
votes
3answers
2k views

How to change step size of ListPlot

The command ListPlot will plot lists with a unit step. Is there any way to change the step size of this?
2
votes
2answers
228 views

Permuting elements within a list

I have s = {2, 3, 5, 7, 1, 4, 6} (* always with diffente elements in {1,2....7}*) l = Length[s] n = 3 and n tells us that we ...
2
votes
2answers
141 views

adding vectors of unequal length [duplicate]

If I have hundreds of vectors of unequal length that I need to sum, what is the cleanest way to do so? So, if I have as input inp={{a,b,c,d},{e,f,g},{h}} I want ...
2
votes
3answers
150 views

Plotting lists, exact color values

I read some descriptions of similar problems but I cannot make them work in my example, I don't know why. I have list of 3 dim values to plot: x, ...
2
votes
1answer
207 views

How to make an efficient difference of sets function?

How to write a nice code that removes all elements from given set A, that occur also in set B? I would like to use DeleteCases[] for this purpose, but have no good ...
2
votes
1answer
499 views

How do I sort complex numbers?

Okay, so I posted something about sorting, and it was linked as a duplicate to This post However, I am having problems trying to sort a list that contains both real and complex numbers. I put them ...
2
votes
4answers
2k views

How can I create a list of functions?

Can anyone tell me, how to create a list of functions? I've tried the following code, but it doesn't work. ...
2
votes
2answers
348 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 ...
1
vote
3answers
149 views

Deleting one of each chosen elements in a list containing duplicates [duplicate]

I want to delete one of each (and not all) selected element in a list containing duplicates. For example i have the list: $\{1,1,1,2,2,3\}$ and i want to delete $\{1,3\}$ so the leftover should be ...
1
vote
1answer
89 views

Modifying a list of matrices with conditional statement

I have a list of around 100 matrices, that looks like this ...
1
vote
2answers
110 views

How to switch between a binary number as String and a as a list of digits?

I was trying with String Functions and I viewing any posts and have no results I want to know 1.- From cromo33 = Table[RandomInteger[], {i, 1, 33}] cromo33 ...
1
vote
4answers
255 views

Add Brackets to a string list

Hello stackexchange community! I have a stringlist with a value and his error for eg: {{"12","1"},{"13","2"}} Now i want to output this as something like this ...
1
vote
1answer
147 views

Ways to access lists inside lists

I have gone through some reference material but I am not getting really good links that will help me grow understanding of ...
1
vote
2answers
335 views

Scatterplots for subsets of multivariate data [Updated]

Update/Re-write There has been a lot of ambiguity over what i'm am trying to do with this question so I have decided to give it a full rewrite. I'm really sorry for the confusion. If you want to see ...
1
vote
2answers
427 views

Select rows from table by keys

I am looking for a way to iteratively select all sublists with the same ID (my 1st column, residual columns are AbsoluteTime entries). First, I obtained the list of ...
0
votes
3answers
109 views

How to get the indices of values in a list which are NOT an specific integer?

I got a real array A, where Dimensions[A] == {5000, 5000, 5}. Some of the values in A are ...
-1
votes
0answers
45 views

Building Pythonic Programming style to Mathematica with visually-accessible list comprehensions?

The question List comprehension in Mathematica has comment about this Functional style using lazy lists? where they build some sort of style for lazy lists: I understand it so that it is impossible to ...
-5
votes
1answer
322 views

Split dataset based on the first column [duplicate]

I have a dataset which I want to split based on the first column. The data looks like this ...
12
votes
4answers
386 views

Equivalent Nested Loop Structure

Consider the following examples: ...
9
votes
3answers
234 views

Truncating a list once all members of a set have appeared?

Consider if you would the case where we have some list of elements: list0 = {54, 4, 7, 9, 3, 54, 4, 20, 2, 456, 2, 3}; And we have some target list: ...
9
votes
4answers
2k views

How to sum up subelements of a list of unknown length

I'm simply looking for the {}+{} function for sublist elements of a list: (Parallel sums of elements) ...
8
votes
10answers
355 views
8
votes
5answers
309 views

Wrapping a function in count

I am working through the Programming Paradigms via Mathematica (A First Course) and am attempting to answer the following: Use recursion to count how many times the argument can have its square ...
8
votes
3answers
883 views

How can I get a running sum for a list?

I've got following data I'm reading from a file: ...
7
votes
5answers
339 views

How to display operations on list elements

When applying some arithmetic operation on two lists, I'd like to display the actual operations between the elements of each list. For example, {1, 1} + {1, -1} ...
7
votes
5answers
198 views

Selecting terms from a matrix

There are similar questions to this on the forum but none fit the purpose here: I would like to extract certain elements of a matrix depending on whether a factor is present or not, and create ...
7
votes
5answers
243 views

Better way to make a certain list with palindromic sublists

Here is my code, which works, but seems a little too long, I think might be a more refined version. ...
7
votes
7answers
490 views

How to pick an element of a row corresponding to the minimum in a particular column?

How can I find what value in column 1 of my list corresponds to the minimum value in column 2?
6
votes
5answers
194 views

How convert list of numbers to list of points on x-axis? [duplicate]

I have a list of real numbers, say: vec = RandomInteger[{1, 20}, 6] (* {2, 4, 7, 10, 13, 6} *) I want to convert each of these numbers to the corresponding ...
6
votes
4answers
166 views

Duplicate mapped elements in Riffle

What is the best way to do this? in: {a, b, c} {d, {e, f}, g} out: {{a, d}, {b, e}, {b, f}, {c, g}} ...
6
votes
3answers
190 views

Mapping a function over the parts of a deeply nested Array

I have two tensors: tensorS = Array[Subscript[s, #1, #2, #3, #4] &, {2, 16, 16, 19}]; tensorR = Array[Subscript[r, #1, #2, #3] &, {2, 16, 19}]; ...
6
votes
6answers
506 views

Convert a list of rules into 2 lists of integers

If I have a list of n number of rules, what is a concise way of breaking the data into 2 lists of the first and second part of the rule? This works, but seems like an unnecessary amount of code to ...
6
votes
2answers
125 views

Get brief help for a set of functions

When we are in console mode or working with a notebook we can get brief help about a function just by shift-entering ?function I would like to have a list like ...
6
votes
5answers
262 views

Removing reverse versions of lists from a nested list [duplicate]

I need to remove the reverse versions of lists from list of lists. I.e.: {{1,2},{2,2},{2,1},{a,1,2},{2,1,a}} I need to reduce to ...
6
votes
7answers
357 views

Sum of two functions, list processing

I am creating some simple graphs of functions defined by ordered pairs. Students are learning about "operations on functions", in this case, adding functions. If I have two functions defined by ...
6
votes
1answer
508 views

ReplaceAll inside an Iterator

I'd like to apply a set of rules to an expression defining the iterators of the table, like this: ...
5
votes
4answers
224 views

How can I get a list of the positions of the running minima in a list?

I want the positions of the (sequential) running minima in a list, that is, the positions of entries that have the minimum value of all the elements in that list, up to and including that entry. For ...
5
votes
4answers
199 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 ...
5
votes
3answers
282 views

Element-wise list operation on list of lists [closed]

Suppose a function F operates on list A: $$A=\{a_1, a_2,\cdots, a_n\}$$ I have a list of lists, B: $$B=\{A_1, A_2,\cdots,A_m\}$$ Is there a syntax to specify that F should operate on members of B, ...
5
votes
2answers
145 views

Sorting out atom types in an XYZ file

I am trying to rewrite the output of "VertexCoordinates" such that instead of a hybrid list of atoms and coordinates that result from using the following input program, I want all coordinates of the ...
5
votes
5answers
418 views

Counting 'False' values at the ends of a list

I have table like this: t = {False, False, False, 4.5, 6.789, 1.23, 0.98, False, False} and I want to know how many False values I have at the beginning and at ...