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

learn more… | top users | synonyms (5)

1
vote
1answer
51 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: ...
3
votes
3answers
77 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
1answer
55 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, ...
6
votes
5answers
143 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
103 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 ...
5
votes
3answers
353 views

Mean distance beween nearest 2 coordinates

I have as an example the following 2d-coordinates: ...
8
votes
3answers
309 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: ...
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 ...
15
votes
2answers
306 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. ...
3
votes
2answers
190 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 ...
6
votes
4answers
617 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 ...
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 ...
1
vote
1answer
55 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
0answers
53 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: ...
1
vote
1answer
72 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 ...
-3
votes
1answer
142 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, ...
1
vote
1answer
91 views

Why does my threaded function need to be substituted?

In my code I have ...
5
votes
3answers
135 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 ...
6
votes
3answers
73 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 ...
6
votes
2answers
152 views
6
votes
2answers
122 views

How to map a function over 2 lists? [Syntactic Analysis]

I have two lists words = {"the", "man", "hit", "the", "table"} grammarTerminal = {{N,"man"},{N,"woman"},{N,"table"},{D,"the"},{D,"a"},{V,"hit"}} and a ...
3
votes
1answer
130 views

Creating a custom color plot with tones of colors

Here is a sample set of data ...
3
votes
3answers
93 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
4answers
166 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 ...
2
votes
1answer
39 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 ...
4
votes
3answers
161 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 ...
3
votes
5answers
84 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 ...
1
vote
1answer
41 views

How to make a repetive procedure with LinearModelFit [closed]

I start with a list of lists: ...
-1
votes
1answer
63 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 ...
0
votes
1answer
53 views

Timing and memory use is critical:fast partitioning of binary sparse array

I do experiments were I measure a signal, and I need to know at what time points it is above a threshold. If at a given time point, the signal is above the threshold, then a '1' gets put into the ...
3
votes
1answer
81 views

How to make a table with from two lists?

I have two lists. ...
2
votes
3answers
90 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 ...
6
votes
3answers
138 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
2answers
44 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 ...
1
vote
2answers
79 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}] ...
0
votes
0answers
32 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 ...
3
votes
1answer
92 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 ...
6
votes
2answers
72 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 ...
3
votes
6answers
261 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 ...
6
votes
1answer
68 views

Matrix Multiplication after “Flatten”

Say we originally had two matrices, $A$ and $B$, both $n \times n$, whose product $$ C= A.B $$ Now I flatten $A$. I can obtain a flatten $C$, from the following multiplication $$ ...
-1
votes
1answer
264 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 ...
6
votes
1answer
120 views

List consisting of positions of the matrix elements and the elements themselves

Given a 2D matrix I would like to make a list with elements consisting of positions of the matrix elements and the elements themselves. Let the matrix be ...
3
votes
3answers
118 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: ...
0
votes
3answers
47 views

Calibrating the length of a list [duplicate]

Suppose you want to create a uniform square grid of initial conditions on the (x,y) plane. This can be done using ...
2
votes
2answers
98 views

Repeatedly apply a bivariate function with one argument running over a list

I'd like to know how, given symbols f and g, and a list {a,b,c,...}, to produce the ...
4
votes
8answers
206 views

How to Select from a List based on another List? [duplicate]

I could do this with Append[], If[], and a Do[] loop, but I'm sure there's a more elegant "Mathematica-like" way. Example: Selected the elements of b where the corresponding element of a is >3. ...
3
votes
1answer
108 views

Minor question about optimally increasing last item of a list

What is the best way to increase the last item of a list by one? I've come up with ++list[[Length[list]]], is there something more efficient?
2
votes
3answers
76 views

How can I create a dynamic Matrix inside a function?

I have a function where a n parameter is handed and a list of values is calculated inside of it. I then need to solve a linear system of equations that require me ...