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

learn more… | top users | synonyms (5)

2
votes
2answers
56 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
260 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
181 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
247 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
91 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
76 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
201 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
92 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 ...
4
votes
2answers
106 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
5answers
275 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
67 views

sorting eigenvectors of a final combined matrix

I have two matrices m1 and m2 as below: ...
1
vote
1answer
27 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
vote
1answer
45 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
42 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
92 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
42 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
99 views

SameTest using in summation over a list

I have a list ...
0
votes
2answers
148 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
266 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
72 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
827 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
147 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
218 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
94 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
510 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
85 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
33 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 ...
10
votes
2answers
268 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
171 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
59 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
103 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
63 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, ...
5
votes
3answers
142 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
332 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
169 views

Merging Financial Time Series

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

Map level inconsistencies with Missing values [closed]

Negative Level specs interact with Missing values, eg: ...
3
votes
1answer
109 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 ...
6
votes
4answers
925 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 ...
1
vote
0answers
66 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 ...
8
votes
6answers
216 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 ...
0
votes
2answers
45 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 ...
8
votes
3answers
138 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: ...
4
votes
2answers
133 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
101 views

Explicit Contraction of Tensor Indices [duplicate]

Is there any easy way to explicitly contract indices of several given tensors. For example, ...
4
votes
2answers
74 views

putting two lists in one ListLogPlot by one modified list

I imported two sets data one: ...
5
votes
3answers
238 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
50 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 ...
4
votes
0answers
156 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 ...