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

learn more… | top users | synonyms (5)

5
votes
3answers
328 views

Mean distance beween nearest 2 coordinates

I have as an example the following 2d-coordinates: ...
3
votes
3answers
116 views

Mapping at arbitrary nested list [duplicate]

This is a candidate for a duplicate (probably from the documentation) but I've ironically failed to find the direct analog so far. I have an arbitrary nested list, say: ...
1
vote
1answer
47 views

adding offset to a list of points [duplicate]

I'm trying to duplicate this behaviour: {a,b,c}+1={a+1,b+1,c+1} in two dimensions. In other words I want to have: ...
6
votes
5answers
140 views

Simple Enumeration of Coin Tosses

How do I enumerate a sample space with up to 6 coin tosses where 4 Heads ensures a win. For e.g {HHHH},{HTHHH},{TTHHHH},{HTTHHH} etc.I tried the following but I do not know how to do a variable length ...
0
votes
2answers
96 views

How to map the second highest value in each row of a matrix

I have a matrix with three or more columns called mat. I would like to map the second highest value in each row of mat into its ...
3
votes
3answers
64 views

How-to select an entry from a list of pairs that meets a condition depending the 2nd element of each pair

Processed data structure data = Transpose[{RandomInteger[{1, 20}, 100], RandomReal[{10^-8, 10^-1}, 100]}] You can download the actual raw data structure here. ...
1
vote
0answers
29 views

Fast arithmetic on matrix elements

I have a square matrix $U$ of dimension $L\times L$, I am interested in the following quantity $U_{1,j}U_{2,k}U_{3,l}U_{4,m}\cdots U_{L,q}$ summed over all permutations of the letter indices, ...
3
votes
2answers
176 views

Tracing 2d coordinates by using Nearest function

In 5 digital images I have determined the 2d coordinates of detected objects. The resulting coordinate list can be downloaded from here: http://pastebin.com/7bE0CEJ5 ...
4
votes
2answers
68 views

Find Instance with Set Membership Condition

Given two vectors $u=(x_1,\ldots,x_n,a_1,\ldots,a_s) \in \{-1,1\}^{n+s}$ and $v=(x_1,\ldots,x_n) \in \{-1,1\}^n$ and a bunch of fixed vectors $c_1,\ldots,c_k \in \{-1,1\}^{n+s}$ and $b_1,\ldots,b_k ...
25
votes
4answers
912 views

How to implement the general array broadcasting method from NumPy?

A friend of mine introduced array broadcasting in the Python NumPy package which is very convenient (and also highly efficient). The idea is perfectly shown in ...
8
votes
3answers
286 views

How to evaluate if a list obeys the Normal distribution?

I am processing a data when I encountered this problem. I use the way of plotting the "normal probability plot" to show the result The list I have is: ...
15
votes
2answers
300 views

Which elements of a large array are part of a set?

I have a large integer packed array arr. My array is multidimensional, but for simplicity let's consider 1D arrays for now. ...
6
votes
4answers
593 views

How to replace a space by a comma

in this expression = "{1 2 3 4 5 6 7 8}", I want to replace each space by a comma , to get ...
1
vote
1answer
62 views

How to find the detailed Dimensions information of a list

In 5 digital images I have determined the 2d coordinates of detected objects. The resulting array (list) can be downloaded from here: http://pastebin.com/7bE0CEJ5 ...
1
vote
1answer
53 views

Assemble rule replacement from pairs of positions

I want to create a rule replacement list, which I then use to create a SparseArray. The input is a list of positions of the from ...
0
votes
1answer
34 views

Repeating the first row of a matrix; subsequent rows depend on the first row

I had asked this question at an initial level before; thank you to all with your suggestions. Now this problem is getting complicated and I am unable to figure it out. There is a 10x10 matrix of ...
4
votes
3answers
154 views

Problem with Conditionals: Why does mathematica add an extra empty list to my output

I have a set of positions where I want to slice a list of numbers. If I Total the values in that list, and they are greater than or equal to 1, I want to remember ...
0
votes
0answers
46 views

Can't operate on vector within a list of rules

I'm trying to set up a list of rules which includes the following: ...
7
votes
3answers
1k views

Replace very small numbers by zero in the output of a list

I have a long nested list, but many elements are numbers of order 10^-18 or less, e.g. ...
5
votes
3answers
129 views

Changing the first row of a matrix; subsequent rows depend on the first row

I have generated a matrix of zeros. tab=Table[0,{i,10},{j,10}] tab is defined such that given ...
-3
votes
1answer
134 views

Why doesn't Thread always thread? [closed]

What is the rationale for Thread not threading as a side effect if the arguments of the function to be threaded can be fully evaluated? For example, ...
0
votes
0answers
58 views

How can I get the covariance result cumulatively?

I am trying to derive the covariance results for a $n \times 4$ matrix where $n$ is an arbitrary number. I am trying to derive the covariance for each row cumulatively. For example, I am trying to ...
6
votes
3answers
71 views

Using Select on a 2d table with a criteria that accepts 3 parameters

I have a table sets := Table[{i, j, k}, {i, 1, 10}, {j, 1, 10}, {k, 1, 10}] and I want to use a function that accepts three parameters and returns a boolean, as ...
3
votes
4answers
153 views

Sum the first element of a list

Suppose I have a list of the following: list={{1,2},{1,6.5},{1,6},{1,0}....{1,36}}. Let say the Length of the list is 300. I would like to sum the first member of ...
3
votes
3answers
85 views

How to pair-up nearest elements from different lists

I have two long lists (of different lengths) of complex numbers. There seem to be some close pairings, so I'd like to explicitly pair elements from each list with their nearest counterpart in the ...
3
votes
5answers
80 views

Insert or Remove randomly

I have a series of characters such as "ABCVABVCCAVB". I wish to randomly remove or insert character. I could make to remove case like deleting all A, or B,... but I wish to remove or insert only 1 ...
2
votes
1answer
36 views

Sort List by first term in case and select cases which certain number in the first term

Suppose I have the following list: list = {{1,3.4},{2,6.7},{3,0},{1,2},{2,8.6},{3,7.9},{1,0},{2,7.8},{3,5}}; I will like to sort the list by the first term in ...
-1
votes
1answer
62 views

Jumping from one dimension (1D) to two dimensions (2D) Part II

Here is a sample data file data = {{-10,3,1},{-7.5,12,3},{-1.5,5,2},{2,4,4},{3,7,4},{6,9,5},{7,1,5}, {8,3,1},{9,12,2},{10,8,5}}; The first element of the list ...
0
votes
1answer
71 views

Jumping from one dimension (1D) to two dimensions (2D)

Here is a sample data file m = {{-10,3,1},{-7.5,12,3},{-1.5,5,2},{2,4,4},{3,7,4},{6,9,5},{7,1,5}, {8,3,1},{9,12,2},{10,8,5}}; The first element of the list ...
1
vote
0answers
125 views

Autocorrelation of 3D Points

I'm trying to compute the autocorrelation of a list of points $(x,y,z)$ in 3D. Can the CorrelationFunction or maybe ...
6
votes
3answers
130 views

How to remove duplicate elements from two separated lists efficiently?

I have two lists of elements: indices = {Prime /@ Range[5000], Prime /@ Range[100, 300]} // Flatten; values = RandomReal[100, 3] & /@ Range[Length[indices]]; ...
2
votes
3answers
78 views

Applying boolean logic to a 2D array

How can I make a function that creates a particular size 2D matrix that determines "True" or "False" if a random value between 0 and 1 is at or below a certain number? Below is what I have written but ...
3
votes
3answers
111 views

How can I make custom accumulated sequences like the following?

First of all, I don't really know how to formulate the question, so if you understand my question and know a better way to phrase it, please revise. I have the following Matrixes: ...
-1
votes
1answer
236 views

Tweaking a code for basins of attraction

NOTE: Whoever finds a working way for obtaining the basins of attraction in the $(x,\mu)$-plane will add his/her name along with @Quantum_Oli in the list of the acknowledgements of the resulted ...
3
votes
1answer
87 views

Extreme Slowdown with Fold

I am doing a finite difference model, and need to create a list recursively. For a small list, Fold is extremely fast, but when the list becomes large enough, Fold becomes extremely slow. Here is the ...
2
votes
2answers
68 views

Problem with ArrayFlatten to concatenate matrix

I would like to concatenate 2 matrix : - the first which is a line of 2 elements - the second which is a matrix of 2-2 elements I use the following code : ...
3
votes
6answers
253 views

Joining strings in every third element in a list

How do I join a string to the first and every third element in the list? Example: list={1,2,3,4,5,6,7,8,9..} ={"string1",2,3,"string4",5,6,"string7",8,9..} I ...
2
votes
2answers
41 views

Partition a list into TradingChartformat

I want to make a stock chart by using TradingChart with my own data. But, the imported data is in the format ...
5
votes
2answers
87 views

Overlap between lists of sublists with different dimensions

I have two lists of sublists. The sublists in the first list contain three elements while the points in the second list contain four e.g.: ...
1
vote
2answers
72 views

Sum of a set of elements in a array?

For a function I do this (Integrate over circular range): NIntegrate[x*y Boole[Sqrt[x^2 + y^2] < 3], {x, 1, 5}, {y, 1, 5}] ...
21
votes
5answers
3k views

Finding all elements within a certain range in a sorted list

Suppose we have a sorted list of values. Let's use list = Sort@RandomReal[1, 1000000]; for this example. I need a fast function ...
0
votes
0answers
31 views

Printing the name of variable in a list as a string [duplicate]

I have a list of objects MyList = {OII,IOI,OIO} where every object is a vector (the names are for ease of use, since they stand for 011, 101, 010). For example ...
6
votes
2answers
67 views

A problem about matrix/vector extension via $\tt ArrayPad$

Given that I have a vector and matrix as follow: vec = Array[Subscript["P", #] &, 6, 0]; mat = Array[Subscript["P", #1, #2] &, {5, 4}, {0, 0}]; And I ...