# Tagged Questions

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

958 views

### How can I merge two lists in a special way?

It's been over a year since I've used Mathematica, and I'm having a total brain fart on a home project. I'd like to take an existing list of lists, say, ...
860 views

### How can I transform a list of binary digits into integers?

I want to transform a list of binary digits into integers. With the Table function, I produce four lists of binary digits of length 32. Then I tried to turn these ...
136 views

### How can I make my code simpler?

I want to find similar letters ...
372 views

### Find all the last weekends in a year

In order to obtain the weekends of a year you'd use something like this: ...
2k views

### Removing elements from a list which appear in another list

There are two lists {a, b, c, a, d, a, e} and {a, c, a}. I need to remove those elements from the first list which appears in a second list, to get {b, d, a, e}
139 views

### Error in setting matrix elements [duplicate]

Possible Duplicate: How to Set parts of indexed lists? For better organization of my code, sometime I use data objects in the form: ...
478 views

### Efficiently extracting an array subset given a separate array

I have two arrays. The first array consists of tens of millions of rows and three columns with a string, a number, and a string. ...
1k views

### How can I get a running sum for a list?

I've got following data I'm reading from a file: ...
2k views

### Ways to compute inner products of tensors

One way to evaluate the following sums is combining Table and Sum: $u_{abcd} = \sum_{e=1}^3 v_{aeb}w_{ced}$ $q_{ab} = \sum_{d,e=1}^3 v_{d e a}w_{deb}$ It will look like ...
1k views

### How find the first element of a list greater than zero (or another criterion) when there is a symbol in the list?

I need to find the position of the first element of a list that is either greater than zero (or some other criterion) or a symbol. Something like lst={0,0,k,1,4} ...
1k views

### Optimising 2D binning code

I have a set of (x,y,z) data, 45,000 to be precise and I want to bin the z values in 256 equidistant bins based on their (x,y) values. The final array should be a set of 256x256 array with each slot ...
426 views

### Handling holidays in financial time series

I have two lists: list1and list2, which are financial time series with only 2 variables—date and price. The problem is: these ...
370 views

### Concatenate strings from different levels of list

After a lot of trouble I've finally come pretty close to what I want to do. I now have a list that looks like this: ...
60 views

### How to ContourPlot a Table? [duplicate]

Possible Duplicate: Why is ContourPlot not displaying this curve? Why do I have to put Evaluate[] here I'm trying to plot certain contours of a function $f:\mathbb R^2\to\mathbb R$. What I ...
353 views

### System Identification with large Input/Output Data

I have some questions about system identification. I made some measurement of current step (input) and voltage response(output) and I want to fine the parameters of my impedance. The sample rate is ...
172 views

### RecurrenceTable with vector

Mathematica can do a RecurrenceTable with a vector, here is a simple example: RecurrenceTable[{x[n + 1] == 2* x[n], x[0] == {1, 2, 3}}, x, {n, 3}] with output ...
849 views

### Ignore missing data while doing a Mean

I want to compute the mean of a list while ignoring missing values, but I don't find a lot of information on how to deal with Missing data in Mathematica. I have a list like : ...
255 views

### Modify a sub-part of a sub-list only

I have this list: a = {{{0, 0}, {1, 7}, {2, 0}, {3, 2}, {4, 7}}, {{0, 0}, {1, 0}, {2, 1}, {3, 2}, {4, 7}}} and I'd like to transform it to this: ...
1k views

### Elementwise join

I have two tensors of arbitrary but equal rank n (and equal dimensions): A and B, and I want to get a third tensor of rank n + 1,...
184 views

### Implementing Remainder Tree

I want to implement Remainder Tree based on this. With the answers on SE I've come up with: ...
531 views

### Distributing elements across a list of lists

I have two lists: u = {{1, 3}, {2, 6}, {3, 9}} v = {0, 4} and I want to obtain this list from them: ...
120 views

### Nested List Product

I want to apply Times on the elements of a list such that: ...
177 views

### How I can use Apply or Map with If?

I have list of objects: list = {{1, 1, 0.05, 0.05}, {2, 2, 0.05, 0.05}, {13, 13, 0.05, 0.05}}; list = {{x,y,Vx,Vy},{x,y,Vx,Vy},...}; And ...
268 views

### Thread over a nested list top to bottom until non-list elements are found

I have a nested list: list = {1, 2, {3, 4}, f[a], {2, h[b]}} I would like to apply a function g to all elements of the ...
2k views

### How can I get every distinct size-n combination of a list?

Let's say I have a list: {a, b, c} I would like to, for say $n=2$ get every distinct pair from that list. That is, the expected result should be, for some ...
116 views

### How do I define a function that, when given a list of parameters, plots a family of functions?

So far I've got this: draw[a_, b_] := Plot[{f[a, b[[1]], x], f[a, b[[2]], x]}, {x, 0, 5}] The function draw will be used like ...
894 views

### Join lists in a list of lists

What's the best way to join two consecutive lists in a list of lists ? For example if I have the list x = {{1}, {2}, {3}, {4}} and I want to get in x <...
192 views

### How can I replace part of list and have the replacement affect the initial list?

I have a list: list = {{1,1,0.05,0.05}, {2,2,0.05,0.05}}; and I want to do this change ...
181 views

### Random sample with gap sizes

Lets say I have 101 instances of data with multiple attributes. In particular case, one attribute has 7 unique values. I want to get ...
349 views

### How to generate patterns by a list of integers

I have a list of integers {3,4,2,2}. This list will give patterns {x_,_,y_,y_,_,_,z_,z_,w_,w_,x_} and ...
703 views

### How to represent a list as a cycle

I want to select distinct cycles (represented by List). The cycle {a, b, c, d} must be the same as {b, c, d, a} or ...
148 views

### How can I assign some part of data from one list to another list?

I don't know this is correct question or not,but I have a doubt. I have two Lists names are list1 and ...
860 views

### Using Transpose with a list as the second argument

I'm having difficulty understanding the Transpose function. I know what the transpose of a matrix is, not a problem, and I see that applying the ...
789 views

### Using MapThread on list of lists

Just a light weight question for learning. If you think this was asked before, please feel free to close it. I am trying to learn MapThread more, and wanted to use ...
317 views

### How can I find these patterns' signatures?

I think I can explain it best starting with an example. I have the following lists: ...
180 views

### All values for a function with two arguments without Outer

Given two lists $l_a = \{a_1, a_2, a_3\}$, $l_b = \{b_1, b_2, b_3, b_4\}$ and some function $f$ accepting two arguments, how can I produce a list of all values $f(a, b)$ for $a\in l_a$ and $b \in l_b$ ...
255 views

### Transformation rule on a list of non-negative integers

I am trying to create a transformation rule that takes a list of non-negative integer values of any length, finds a non-zero entry in the list, adds 1 to all preceding numbers, subtracts 1 from the ...
839 views

### If-statement does not evaluate if condition is true [duplicate]

Possible Duplicate: How to avoid returning a Null if there is no “else” condition in an If contruct I know there are other ways to solve this problem. Just because I'm curious I tried: ...
535 views

### The locations of (row-wise) minimum elements in a list

I have a list representing a 2D matrix, such as this 3 ⨉ 2 one: {{2.1, 1.01}, {0.01, 7.2}, {7.8, 2.0}} Does anyone know how to find the minimum of each row, ...
5k views

### Filtering Lists in Mathematica [duplicate]

Possible Duplicate: Select/Delete with Sublist elements? I need help in filtering long lists of x,y coordinates.Lets use the following list as an example: <...
958 views

### Making NIntegrate behave like a listable function

I have a function defined by $$f(t)=\int\limits_0^t g(x) dx$$ $g(x)$ is a complicated function (specifically the Mittag-Leffler function which has recently been implemented in Mathematica 9 as ...
219 views

### Unexpected result from Flatten

Consider the following three evaluations involving Flatten: Flatten[f[f[f[x, y], 1, 2], f[x, y]], Infinity, f] f[x, y, 1, ...
627 views

### Any built-in function to generate successive sublists from a list?

Given lst = {a, b, c, d} I'd like to generate {{a}, {a, b}, {a, b, c}, {a, b, c, d}} but using built-in functions only, ...
686 views

### Combining two lists [duplicate]

Possible Duplicate: How do I obtain an intersection of two or more list of lists conditioned on the first element of each sub-list? I would like to combine two lists. ...
436 views

### How to sum over duplicates?

I have a list of the form: {{1, 0, 1}, {2, 1, 2}, {1, 0, 3}, {2, 4, 2}, {2, 1, -1}, {1, 0 ,0}} that I would like to sort such that I calculate the sum over the ...
843 views

### How do I obtain an intersection of two or more list of lists conditioned on the first element of each sub-list?

Given two lists like list1 = {{1, 1}, {2, 4}, {3, 9}, {4, 16}}; list2 = {{2, 6}, {3, 9}, {4, 12}, {5, 15}}; I would like to produce an output like ...
571 views

### How to partition a list and leave in the last sublist which is of different length? [duplicate]

How to partition a list and leave in the last sublist which is of different length? In[75]:= Partition[{1,2,3,4,5},2] Out[75]= {{1,2},{3,4}} I want it to be <...
245 views

### Filter list with different list in it

I have a list like: {{{4, 14}, 1}, {{4, 15}, 1}, {{4, 16}, 1}, {{4, 17}, 1}, {{4, 18}, 1}, {{4, 14}, 3}, {4,15}, {{4, 16}, 2},{4,18}} Now I want to ...