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

learn more… | top users | synonyms (5)

5
votes
5answers
146 views

Choosing sets from Subset[list]

Say I have a set, S, and I take Subsets[S] (the power set of S). For example: S={a,b,c} Subsets[S]={{}, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}} How can ...
8
votes
0answers
138 views
0
votes
0answers
21 views

Adding a list up to a starting value [duplicate]

The code that i need has a starting value of 5. From this starting value on a list of numbers is added consecutively like this list {-0.1,-0,3,-0.1,0.1,-0.1} ...
1
vote
2answers
283 views

How to optimize this code?

I am implementing a code that works correctly but it takes too much time. I did not see how to optimize it to be run quickly. Here is my code: ...
3
votes
1answer
58 views

How to collect elements in one list with the constraints provided in a second list

I wish to collect the items in the first list provided the constraints in the second list. For example in the lists shown below the first list shows a bunch of strings and the second list shows the ...
0
votes
0answers
52 views

(Sparse Array) Can Mathematica delete some of the 0's from a list?

This question continues form Can Mathematica delete some of the 0's from a list? This time I want to delete zeros before the first positive integer. I have a list: ...
1
vote
2answers
84 views

Partial comparison between lists contained in larger matrices [closed]

Please presume we have two nested matrices m1 and m2: ...
3
votes
3answers
286 views

Mandelbrot set—efficiently iterate over a list of initial points

OP edit: This is a Mathematica-specific question about an approach it attempted for a fractal visualization problem described HERE. I'm using the Mandelbrot set there and here as an example, but the ...
0
votes
1answer
51 views

generation a nested matrix with a partly comparison of two other nested matrices [closed]

(this problem is maybe challenging because of its partly comparison) there are two nested matrices: mainmatrix1: ...
4
votes
3answers
201 views

Creating a nested matrix from two lists

I have a matrix and two lists: ...
1
vote
1answer
89 views

How to do this Function with compile

There is 4 lists, 3 of them are at same length (l0, l1 and l3). ...
11
votes
3answers
301 views

Partition a list based on specific elements? Grab the sublists beginning with a certain marker elements

Say I have the list {{a}, {0, 2, 5}, {5, 4, 1}, {a}, {1, 1, 0}, {1, 4, 2}, {3, 3, 0}, {a}, {3, 2, 0}, {1, 4, 1}} I would like to make sublists of everything ...
2
votes
2answers
48 views

Remove an element of a list [duplicate]

I want to check if any element of a list contains Missing["NotAvailable"] If so I want to delete the entire list. If I am correct I need to have some ...
6
votes
4answers
241 views

Average dataset with many repetitions?

I have a dataset where each item is of the form: <|"p1" -> x1, "p2" -> x2, "r1" -> y1, "r2" -> y2|> The interpretation is this: ...
5
votes
6answers
161 views

Replicate and expand a list

I have two lists a and b of the same length. And another list a2 which contains all elements ...
11
votes
1answer
242 views

Why does Outer sometimes return a packed array, and sometimes not?

For example In[342]:= test3 = Flatten[Outer[Plus, Range[1000], Range[1000]], 1]; // AbsoluteTiming Out[342]= {0.0198735, Null} returns PackedArray ...
1
vote
1answer
89 views

Manipulating Some Lists in Compile

Consider a list of lists, such as: Z={{1,4,3},{2,1,3},{3,1,4}} Z is an $n \times n$ matrix (here $3 \times 3$) which ...
2
votes
2answers
73 views

Multiplying a table with constants

I have a table with coordinates {{x1,y1},{x2,y2}} that I want to multiply with a separate constant for x and one for y so: ...
2
votes
6answers
196 views

How to extract the elements which the require the second elements to be the smallest?

Consider this code: ls1=Table[{x,Abs[Sin[y+z]]+Abs[Sin[x+y+z]]},{x,0,1,0.1},{y,0,Pi,0.1},{z,0,Pi,0.1}]; ls2=Flatten[ls1,2]; ListPlot[ls2] What I want is to ...
2
votes
1answer
71 views

Interpolation of a multivariate function with duplicated 2D abscissa points

I want to interpolate a function q[a,b] I have a data file which has the form {a,b,q} a sample is following ...
3
votes
2answers
82 views

`IntegerPartitions` without duplicates

I need to apply a function to integer partitions of many integers, but only the partitions without duplicate numbers. Select[IntegerPartitions[n], DuplicateFreeQ] ...
1
vote
3answers
248 views

How to repeat a matrix on it's side?

I have the following matrix in Mathematica: mat = {{0,0,1,1}, {0,1,0,1}} I want to repeat this matrix N number of times on the side. For example if N = 3 then ...
3
votes
1answer
57 views

sorting eigenvectors of a final combined matrix

I have two matrices m1 and m2 as below: ...
1
vote
1answer
23 views

Coefficient of function with general argument

I would like to obtain the coefficients of a general function f in a list. For example, the coefficient list of ...
-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
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
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
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

SameTest using in summation over a list

I have a list ...
0
votes
2answers
142 views

How to select 3-tuples of positions from a list with variable time-steps?

Below is a natural log list of ordered time data with variable time-steps. I would like a functional approach that selects 3-tuples of positions sublists based on the first selected elements that ...
10
votes
4answers
262 views

How to make FlattenAt work with Span?

This works: MapAt[h, {a, {b, c}, {d, e}, {f}}, 2 ;; 3] (* {a, h[{b, c}], h[{d, e}], {f}} *) but this doesn't: ...
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 ...
10
votes
8answers
796 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: ...
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: ...
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 ...
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+...}}}} $$
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
2answers
84 views

Change function acting on sum to function acting on each object individually

Given a function like Conjugate[] acting on a sum, how I can change an expression like ...
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 ...
7
votes
2answers
189 views

How to implement JoinTo efficiently?

AppendTo is not efficient so I'm not quite sure of the best way to implement its analogue for joining (e.g. in python this would be extend function). So how can this be improved: ...
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 ...
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. ...
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
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, ...
4
votes
3answers
109 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 ...
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

Map level inconsistencies with Missing values [closed]

Negative Level specs interact with Missing values, eg: ...