# Tagged Questions

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

169 views

### How do I perform the riffle function backward? [duplicate]

I know riffle will combine the lists {1,2,3} and {a,b,c} to be {1,a,2,b,3,c}. Is there a way to work backward and split the list {a,b,c,d,e,f} to be {a,c,e} and {b,d,f}?
444 views

### Aligning two lists

I have two lists, L1 and L2, each with a key and some data. Let us say the key is a person's name, a string, and the data follows. (To respond to rasher's query:) Let us also assume the lists are ...
497 views

### position of element in a list using a function

How can I find in a list l the positions of all elements satisfying a boolean function f. For example, how can I pick in ...
368 views

### How can I construct a distance table?

I have a list of city names (of arbitrary length), f.e. c = {"BAL", "NYC", "LAS", "AUS"}; and the distances between them : ...
426 views

### Find equal elements on a list

Consider the following code to produce the sequence $x_1,\ldots,x_{n+1}$ where $x_i=11\cdots1$ ($i$ digits 1). Is there an easier way to do this? ...
119 views

### How to find all possible correlations between n vectors

Given the Matrix ...
88 views

### Taking Mean for several elements of a list [duplicate]

i have the following question: Let us assume we have the following list: list={1.1,1.2,1.0,2.1,2.2,2,0,3.1,3.0,3.2} I need a function that always takes three ...
260 views

### Working with nested matrices

I have a matrix: A = {{a, b}, {c, d}} But each its element, itself, is another matrix too. ...
168 views

### How to load data into a Manipulate expression

I have data showing truncated octahedron geometry changing with time. How can I read those data into a Manipulate expression? To be specific, I want to manipulate ...
49 views

### Testing a certain function over multiple levels

I regularly want to test if a certain function, here foo, gives the expected result when mapping it over n - level - matrices. My naive approach is to write: ...
3k views

### How to pass a list as function argument?

I have the following function lFreqPhylo[a_, Q_, b_, p_] := Sum[Log[freqFunction[r[[p]][[i]], L[[p]][[i]], a, Q, b, {i, 1, nbranches[[p]]}]; The objects L, r ...
35 views

### Unexpected results from Thread [duplicate]

I've run into an issue where threading two lists with a generic function, f: Thread[f[{{1,1}, {2, 2}, {3, 3}}, {4, 5, 6}]] ...
189 views

### Is there a better way to create my rotational-symmetric (180 degrees) rectangles?

I have created a simple way to create rotational-symmetric (180 degrees) rectangles, but my stuffit function bothers me. No matter what I tried, I couldn't get it ...
102 views

### Apply function to output of previous function

I am trying to write a function that takes 3 tuples. Each tuple contains two lists which are first divided. This results in 3 lists. Then I want to take the Mean of all the columns. I can do this ...
121 views

### Matrix and string variable

There are $100$ .dat data files which contain numerical parameters. m={1,2,.....,34}; n={8,10,12,.....19}; l={67,68,69,...96} ...
121 views

### If statement and elements of an imported data

I import a data file: SetDirectory["C:\\Users\\SE7EN\\Desktop\\mathematica\\test"]; dd = Import["data.dat", "Table"] Out[2] = {{1}, {2}, {3}, {4}, {5}, {6}, {7}} ...
64 views

### Manipulating lists with constant values [duplicate]

let us assume we have some data in the following form. Table[data[[1,i,{1,2}]],{i,1,Length[data[[1]]]}] This would give all $x-y$ pairs of the first file. What I ...
127 views

### How to find the maximum values and the place of the max value in the list? [duplicate]

I have given an example to find the maximum value and its place in the list. Is it possible to find the local maximum in the sub-list of this list means local maximum in the each row of the list and ...
271 views

### Converting unevaluated lists to strings

I have a list like l = {2 - 3, 12 - 4, Times, aab} I want to end up with {"2-3", "12-4", "Times", "aab"} I have tried ...
156 views

### Strange behavior of BinCounts

Bug introduced in 8.0 and fixed in 10.0.0 Just try this example: ...
200 views

### Building adjacency matrix from set data

I have two sets: games and players. Players pick their games. As such I will have data say g1={p1,p3,p5},g2={p2,p4},g3={p2,p3,p5}. My interest though is to build the connections among players because ...
205 views

### Selectively converting numerical strings to expressions

I have a list of strings representing different types of data ...
67 views

### Grouping Nested Lists Based on Differing Values of Single Element

I've a list of lists representing k-rows of truth table having n elements each in a nested list consider ...
95 views

### Generating list of functions from list of expressions

I know how to create a function from concrete expression like Function[{x, y}, x^2 + y^2] But what if I have a list of expressions list1 and I know the set of ...
99 views

### Manipulate which creates and deletes Manipulators dynamically

I want to plot a function in a Manipulate in which the number of terms varies and a Manipulator for the coefficient of each term ...
195 views

### Select positive value from a vector

I am wondering how to pick out the positive Omega value from soln, and make these positive values into a row vector. I know how ...
89 views

### How to discriminate Weatherdata latitude and longitude from a more detailed list

From this list of weather data how can I discriminate only latitude longitude for each station? For example from the following sample I would need only the coordinates: "50136","","Aoluguya|Mohe, ...
130 views

### How to drop the identical rows and columns of a matrix?

I'm currently trying to find a way to eliminate from a square matrix of generic dimension the duplicate (up to sign) rows and columns, obtaining a smaller dimensional matrix. I searched around here ...
107 views

### How do you add options to a function that is being mapped?

Simple example: Normally: ListPlot[list, Joined->True] If I want to map ListPlot how do I keep the ...
323 views

### From a list of (x,y) pairs, generate a new list of (x,ymean) pairs, where ymean is the average of all y's with the same x in the original list [duplicate]

This seems like the sort of thing where Mathematica can give a very simple solution. I have a list of points {x,y}: ...
122 views

### Merging two lists by prepending elements

Being a newcomer to Mathematica, I have the following question. Given x = Range@9~Partition~3; and y = {a, b, c}; I want ...
98 views

### How can I get a certain kind of iteration?

Can I get this type of do-loop in Mathematica? Do[Print[j," ",k," ",l], {j,k,l, {a, b,z}, { c, d,y} }] I want this to work so that, in the first iteration, ...
328 views

### ListDensityPlot with discrete bins [duplicate]

We consider a table of the form data = Flatten[Table[{i,j,f[i,j]},{i,1,ni},{j,1,nj}],1] The function f[i_,j_] has been made ...
116 views

### ParallelTable and expensive functions

I would like to build up a 2D-Table using ParallelTable as follows ...
79 views

### How to take single item out of List? [duplicate]

I often get Lists that contain a single item, like {name} or {{2,3,4}}. Is there a function ...
118 views

### Extracting “records” from a matrix

From a rank 3 matrix like ...
1k views

### What is the Mathematica way of joining two tables?

Is there a special Mathematica way of joining tables of data together, so that I would get similar functionality as if I was running a database with sql? For example, I have one particular table here,...
145 views

I'm a little confused with the TemporalData structure in Mathematica, in the sense that it doesn't seem to behave like a list. What I'd like to do is plot the sum ...
157 views

### Find positions where two matrices differ

I have two matrices A and B of identical dimensions. What's the simplest (shortest) way to find the indices of differing ...
109 views

### Drop last element of parts of a list [duplicate]

just a simple question for now I guess: I have a list: list={{1, 2, 1}, {1, 10, 1}} I simply want to Drop the last element of the two entries of the list, that ...
207 views

### How do I select only those lists whose elements are all above a certain number?

I'm essentially doing coin flips, using RandomReal to populate a bunch of lists, each with 8 elements. I then want to select only those lists for which all elements are greater than a certain number, ...
389 views

### How to define a list that contains all primes less than x?

how can I define my own list in which I have all primes less than x?
40 views

### save all inputs as list [duplicate]

I received three results of calculations: {k->0.190729} {k->0.197575} {k->0.249319} Could you help me write the results in the following form: <...
529 views

### How to insert elements of a list into list of lists?

I have two lists. E.g. ...
151 views

### Having problems with ListPlot and a PaddedForm wrapper

I defined a function f[x_] = x^3 2 x. Then I had to construct a table showing vertically, the values of f corresponding to x on ...
585 views

### Faster “stuttering” accumulate?

Given some list of arbitrary precision numbers, e.g. (actual lists are 1M+ elements long): test={0, 2, 2, 47839283, 2, 0, 0, 2, 0, 1, 2, 0} I need to accumulate ...
378 views

### Generating complete lists of polynomials

I would like to generate a list of all $3$-variable Laurent polynomials with non-negative integer coefficients using a looping construct so that I can, one-by-one, check them for specific ...
691 views

### List density plot for non-uniform data

I am trying to make a density plot to show the data that can found here. I tried with GNUplot previously. The result of GNUplot density plot for a rectangular set of data. I am able to do this only ...