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

learn more… | top users | synonyms (5)

-1
votes
0answers
44 views

Do loop, inconsistent results [duplicate]

Ive been at this problem for a couple of days now and no success. I'm very new to mathematica and hope someone can help. ...
1
vote
3answers
88 views

Polar histogram and bins

I have a list of polar coordinate points: list = Transpose[Join[RandomReal[{1, 60}, {1, 100}], RandomReal[{0, 2 Pi}, {1, 100}]]] I need to divide the ...
1
vote
1answer
43 views

How to make a substitution that involves a nested list? [closed]

I need to make a substitution for the variable $x$ from this. sub = {{x -> 2}, {x -> 5}} I want to give to $x$ one of these two values, say $2$. If I ...
-2
votes
1answer
37 views

Add a given scalar to every element in a list [closed]

I wish to add a give scalar to every element of a list. How can I do this? Thanks in advance.
-1
votes
1answer
38 views

How to convert nested lists into “standard” lists? [closed]

What is the easiest way to convert a nested list in a "standard" list? For istance how can I fastly convert {{16.5807}, {17.1458}, {16.1343}} into ...
3
votes
3answers
89 views
10
votes
8answers
797 views

Best way to emulate MATLAB's bsxfun using Map and similar functions

Given a matrix, we want to subtract the mean of each column, from all entries in that column. So given this matrix: ...
4
votes
2answers
63 views

Append fixed value to random selection of list

(This question might be an application of this other question, but there might be another solution specific to this application that I'm not aware of.) I am currently in a situation in which (in a ...
4
votes
4answers
216 views

Matrix of Columns, I want just a regular matrix!

I've been at this problem for a couple of hours now and no success. I'm very new to Mathematica I hope someone can help. I have the following ...
5
votes
4answers
133 views

Add to matrix missing elements (for list of time series)

This question is an extension of the 43122. I’ve looked through many interesting post (like this) but (as always) missed the direct matching. So the setting is simple: ...
1
vote
1answer
87 views

Continued fraction with different numerators [duplicate]

In Mathematica, is it possible to form the continued fraction of the following formula? $$ f = a_1+\cfrac{b_1}{a_1+a_2+\cfrac{b_2}{a_2+a_3+\cfrac{b_3}{a_3+a_4+\cfrac{b_4}{a_4+...}}}} $$
6
votes
1answer
116 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 ...
7
votes
6answers
487 views

Partial sum of a list

The problem I have is really basic but I just can't get my head around it. Suppose I have a list of ordered pairs A = {{a, b}, {c, d}, {e, f}, {g, h}, ...}. I ...
1
vote
0answers
32 views

Using Coefficient for Conjugate[variables] (Mathematica ignores my assumptions)

I have a sum and I use Coeffcient[] to extract certain terms. For example, I want all term in the following sum that contain ...
5
votes
3answers
167 views

Add up data values for matching entries [duplicate]

Is there a function that extends Tally in the following way (essentially need an answer to this guy's homework question): the a ...
2
votes
2answers
95 views

Selecting divisors of a large number that meet some criteria using the factors list

I have a list that represents a factorization of a number: its format is identical to the output of FactorInteger. I need to select the divisors that meet some ...
0
votes
1answer
57 views

make constant some elements of a list

how to give some elements of a list a value that be same always, and cannot change anyway. ...
0
votes
1answer
61 views

Why the list rule is strange in the Cloud? [closed]

If we have some data,for example: data = Table[{i, i + 1, i + 2}, {i, 10, 80, 10}]; data[[All, 1]] Export["test.xls", %%] the output is: {10, 20, 30, 40, 50, ...
6
votes
4answers
915 views

How can I avoid using a For-loop in my code?

I am trying to avoid using For because I heard that For is not cool in functional programming. Below is a problem that the first ...
4
votes
3answers
110 views

How to get a line density from list density plot?

I have a list density plot from a list ls={{x1,y1,z1},{x2,y2,z2}}.... How can I extract the line density with a fix y, such that ...
4
votes
2answers
119 views

Finding the positions DateList dates in a range in large data set

There are similar questions to this like list search but this question is focused on finding at subset of dates in DateList format within a range of specified dates ...
3
votes
6answers
329 views

How to do this job without creating a new list?

I have a list {{x1,y1},{x2,y2}...} a list {z1,z2...}, I want to create a new list ...
3
votes
2answers
155 views

Merging Financial Time Series

I am trying to merge two or more financial time series. For example, ...
3
votes
0answers
63 views
3
votes
1answer
107 views

How to asign the points below a line to a specific value?

I have a list {{x1,y1},{x2,y2}...}. I want to create a list {{x1,z1,0},{x2,z2,0}...} with $z1<y1, z2<y2\cdots$, so that I ...
8
votes
6answers
210 views

An expression for the “perimeter elements” of a matrix

For example (5x5): m = Array[x[##] &, 5 {1, 1}]; MatrixForm@m I want to get a clockwise ordered list with the "perimeter" elements (they could be any kind ...
7
votes
3answers
132 views

Grouping by total length of elements grouped

How might one split a list of irregularly-long sublists into groups, each of which is shorter than a specified length? For example, given the following input: ...
1
vote
0answers
46 views

FindPeaks “expecting an image” [closed]

I am trying to use FindPeaks for a list of data, but when I have tried to use it it returns an error. I went to the help menu for the function to check that everything is in the correct format, and ...
0
votes
2answers
43 views

How to restructure a list of {x,y,f[x,y]}-triples for use with Interpolation? [duplicate]

I have lists of triples {{x1, y1, f[x1,y1]},{x2, y2, f[x2,y2]},... }, which I would like to interpolate. In order to use Interpolation[], I seem to need a list ...
4
votes
2answers
129 views

How can I get a list of the exponents of a polynomial? [closed]

I have a polynomial 1 + x^2 + x^4 + x^8 + x^9. I want a list of the exponents. {0,2,4,8,9}.
2
votes
1answer
65 views

Explicit Contraction of Tensor Indices [duplicate]

Is there any easy way to explicitly contract indices of several given tensors. For example, ...
5
votes
3answers
940 views

Generating random symmetric matrix

Suppose first that I want to generate a matrix whose elements are independent and identically distributed (i.i.d.) with distribution dist. This is easy: ...
5
votes
3answers
231 views

Find when two lists are parallel with autocorrelation

I am working on a signal processing project with two oscillators. The first oscillator has a frequency $f_1$ that is independent, and the second oscillator has a frequency $f_2$ that increases, and ...
3
votes
1answer
84 views

Solving a list of equation which takes so much time

I try to solve a list of equation in a following way but it Mathematica solves equations after 30-40 minutes or don't solve them at all. The functions that I use are ; ...
1
vote
0answers
81 views

How to get the values out of Alternatitves?

Saying we have something like: SomeFunction[ ... { Alternatives[1, 2, 3] :> "something" } ... ] How can I know if ...
18
votes
2answers
2k views

Finding a subsequence in a list

I have a list and I want to find (in this particular case the first) appearance of a any of some subsequences, of possible different lengths. None of the subsequences is a subsequence of each other. ...
4
votes
0answers
149 views

Tracking coordinates [closed]

I have a list (=data) of 2d coordinates, whereby: Dimensions[data] = {l, m, n}. The coordinates (index n) are belonging to ...
10
votes
4answers
261 views

Handy / flexible directory tree operations

Is there any shorter / more handy / more flexible way to get directory tree as a nested Rules/Associations list? I tried to incorporate ...
3
votes
2answers
91 views

Creating all permutations of list with “alignment”

I need to find all permutations of a list satisfying a condition but I'm lost about how to do so. Given a list I want a write a function to produce all permutations such that the list is "top aligned" ...
1
vote
0answers
48 views

Concise use of list addressing

I very often work with Lists of Lists (trend data exported from other programs). Sometimes the start times of the important data ...
3
votes
3answers
139 views

Declaring lists

Do I have to declare a list before using it in a loop? for example: For[i = 1, i < 10, i++, A[[i]] = i]; The output is: ...
1
vote
0answers
57 views

Finding correct combination of functions

I am trying to write code where I have an array $S$ or numbers in any order [5,4,2,1,....] Then I have a specific set of functions that I can write. ...
5
votes
3answers
327 views

Mean distance beween nearest 2 coordinates

I have as an example the following 2d-coordinates: ...
3
votes
3answers
115 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
137 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. ...