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

learn more… | top users | synonyms (3)

1
vote
1answer
76 views

Absolute uncertainty and error propagation with lists [closed]

I am trying to do some error propagation using mathematica. This is my second day using the program. I am trying to take the derivative of a numerical function that is made up of the following lists. ...
1
vote
1answer
56 views

How to perform multi-columns selection and/or !MemberQ on large lists with speed?

This question (2 subquestions) is connected to How to speed up Select with MemberQ for large lists? Q1: I would like to have an alternate version of the form below to do a multi-columns selection on ...
12
votes
4answers
628 views

What's the function that takes X[Y[z___]] to Y[X[z___]]? (“swap heads”)

I've seen the operation described in the title before (basically, swap the heads of the first two levels of an expression), but I can't find it... Does anyone know the function (or idiom/incantation) ...
3
votes
0answers
65 views

Partitioning Table

I have a long vector array in the following format: ...
0
votes
0answers
63 views

Equation Autogeneration

The following is resubmitted as edit here to reflect suggested formatting corrections so indentations separate the lines neatly. I also fixed the unknown D variable which I actually meant to state as ...
1
vote
2answers
46 views

Insert several rows and problem with Return

I wanted to write myself a function that makes it possible to Insert several rows into one list. ...
0
votes
0answers
44 views

Output of List formatted strangely

I'm running a monte carlo simulation which uses random input data and performs calculations on it, and then outputs a 100 by 100 sized array with my data. The code works without a problem but for some ...
1
vote
1answer
73 views

I want the length 3 words on alphabet {0,1,2} with no two consecutive 1's [closed]

I tried this code but it doesn't work. DeleteCases[Tuples[{0, 1, 2}, 3], {_ 1, 1, _}].
0
votes
0answers
39 views

FinancialData, comparing returns accounting for different holidays

At the moment I am trying out the FinancialData feature of mathematica. I am a bit struck with the problem of dropping returns for dates of a list of different stocks not being equal for all stocks ...
1
vote
0answers
47 views

Learning mathematica, ListPlot [closed]

I am trying to teach my self Mathematica. I am working with the following example: ...
0
votes
1answer
47 views
0
votes
0answers
58 views

Adding error bars in bar chart using a list

I know this must be a very basic question, but I don't know much of Mathematica and was not able to find any answers online. I have imported an Excel file with two sets of values. ...
9
votes
1answer
153 views

Lexicographic ordering of lists-of-lists?

I was surprised to discover that Mathematica does not sort lists-of-lists (LLs) lexicographically by default. For example, applying Sort to ...
0
votes
1answer
56 views

Transforming a vector in a loop without modifying the original vector

How can we apply a duty on elements of vectors but they remain unchanged for the next processes: For instance we have a process governed by these lines. However, in one loop process some elements of ...
0
votes
0answers
59 views

Data manipulatation with MapAt and Join

I would like to make data like: {{a1, a2}, {b1, b2, b3}, {c1, c2}, {d1, d2, d3}} -> {{a1, a2, b1, b2, b3}, {c1, c2, d1, d2, d3}} by using ...
0
votes
0answers
44 views

vector product defined on kronecker delta [duplicate]

I have some vectors such as : a={{0}, {0}, {0}}; b={{1}, {1}, {1}}; c={{1}, {1}, {0}}; I wanted to product a by ...
1
vote
1answer
47 views

2D plot using Manipulate command [closed]

Can anyone tell me what the problem is with the following code: y[x_ a_] := Sin[x (1 + a x)] Manipulate[Plot[y[x a], {x, 0, 6}], {a, 0, 2}] However, the ...
0
votes
2answers
85 views

vectors constructed with $0,1$ permutation

Our desire is to construct $2^N$ vectors with indices $i=1,..,2^N$ with elements by permutation of $0$ and $1$. For example ($N=3$): We write below code ...
1
vote
1answer
50 views

Sum over multiple indices that take specific values

Pretty simple question: how do I sum over multiple indices that can only take specific values all together? To clarify: let's say I have the following sum: $\sum p_{a,b,c} f(a,b,c)$ where $f$ is a ...
0
votes
0answers
49 views

How to efficiently find period orbits in a series defined by recurrence relation?

I have a series defined as $z_{n+1} = z_n^2 + c$, which is the series for the Mandelbrot set. I have defined it, in order to plot the set, as ...
1
vote
1answer
67 views

Manipulate of Region Plot

I try to illustrate a generation of an amoeba to a tropical curve, namely. ...
0
votes
1answer
83 views

Matching entries then finding positions of two lists

I'm trying to analyse data with Mathematica. I have a big array with various columns representing timestamps and then lots of data. I have some code that will produce a list of timestamps when the ...
11
votes
3answers
456 views

Subtracting two plots from each other after shifting one

I have the following lists representing energy spectra that need to be subtracted from each other to produce a difference spectrum. ...
0
votes
2answers
46 views

Troubleshooting Program Meant to Swap Elements

I wrote a program that is supposed to take a list (of arbitrary length) of pairs of the digits of binary numbers (e.g. ...
0
votes
1answer
76 views

How to remove the list bracket in some expression?

I have two problems with the List bracket {}. First, I want to get a specific component of LeviCivitaTensor, so I should use ...
3
votes
2answers
120 views

How to speed up Select with MemberQ for large lists?

I have two large lists: list1 and list2. I would like to select elements of list1 only if they appear in list2. Since the list1 has dimensions of (335000, 2) and list2 : (122000, 4), it's taking a ...
0
votes
1answer
50 views

What is this Counts[] output format?

I need to create a list of the distinct elements in a list along with the number of times each appears. The function Counts[] is supposed to do this, but it puts the results in some weird format I've ...
6
votes
2answers
187 views

Is there a built-in equivalent to Python's enumerate?

Python's built-in function enumerate takes an iterable over $(a_0, a_1, \dots )$ as argument and returns an iterable over the sequence of pairs $((0, a_0), (1, ...
1
vote
3answers
85 views

Partitioning List Into Sublists of Length 2 With The Pairing Being Random

I've done a bit of Googling with hopes of finding an answer, but to no avail. I'm looking for a way that I can have Mathematica take the elements of a list, say ...
1
vote
1answer
68 views

Tiny question about Indexed[x,n]

Maybe I should apologize for this silly question, but the documentation for Indexed is very short and not explicit. I have an equation with variables ...
3
votes
2answers
93 views

Help with list manipulation

I often need to merge two lists like the following: $A=\{\{0.1\},\{0.2\},\ldots,\{1\}\}$ $B=\{\{x_1\},\{x_{21},x_{22},x_{23}\},\{x_{31},x_{32},x_{33}\},\ldots,x_N\}$ in a way to ideally obtain a ...
0
votes
3answers
65 views

Logarithmic x-axis for ListPlot?

I have a list of points that I am trying to plot. Is there a way to make a ListPlot where the y-axis increases normally by 1 every interval but the x-axis ...
0
votes
1answer
55 views

Mathematica Code Involving For Loops Not Completing All Iterations [closed]

First of all, thank you for taking the time to read this. I'm working on a portion of code related to the genetic algorithm that is not producing the expected results. What the code is supposed to do ...
4
votes
1answer
121 views

Applying function to cartesian product of two lists

I have two lists X = {1, 2, 3}; Y = {5, 6, 7, 8}; I want to apply function g[x,y_,z_] to all pairs from X*Y, so I need to ...
1
vote
2answers
68 views

Create a table of Mean Values and Standard Deviations from data list

I need to create a table of the Mean Values and Standard Deviations of 18 columns of data from a table. I know how to compute the Mean and Standard Deviation for the different columns, but am unsure ...
5
votes
1answer
112 views

Find all “chains” in the poset of divisors

I want to input a set of divisors of an integer $n$ and return all subsets of these divisors ${d_1,d_2,...d_k=n}$ such that $d_1$ divides $d_2$, $d_2$ divides $d_3$, ... and $d_(k-1)$ divides $d_k$. I ...
1
vote
1answer
46 views

Using HoldForm for a changing list

I have a 'list' of the form an expansion: F = (A[1] + A[2])(B[1] + B[2]), such that F[[1]] produces the result ...
1
vote
0answers
49 views

Problems with indexes in a Do-cycle and CoefficientArrays

I have a system of linear equations with variables $A_n$ and need its coefficients in a matrix form (Transform linear system into a matrix form). I'm trying to do that through a ...
2
votes
1answer
75 views
4
votes
2answers
182 views

How to convert a list of 3D points to a list of distances?

How do I apply a function (this case EuclideanDistance) between element i and i+1 on a list ...
5
votes
3answers
110 views

Levelspec range with negative levelspec

Documentation states A negative level -n consists of all parts of expr with depth n. However, it is not clear what do ...
-1
votes
1answer
144 views

Strange bug involving a list, “Objects of unequal length” [closed]

sortedTally is a list generated from Tally sortedTally[[1]][[1]] is a list If I print: ...
1
vote
3answers
132 views

List of prime powers

I have a list of not necessarily distinct prime powers. For example: {2,3,4,25,2,3}. I want to combine (multiply) the highest prime powers for each prime. In this case 25*3*4 = 300 since 25 is the ...
1
vote
1answer
74 views

Pattern matching list of elements with different heads

I have a function, which I want to accept only a list of kind of elements belonging to a group. The task comes down to finding an elegant pattern suitable for easy to read function prototype. As an ...
0
votes
0answers
38 views

Constructing a function for expanding general $n$ products

I have the following quantum mechanically motivated product: $\langle0\vert(A_1b_1 + A_2b_2 + A_3b_3)(B_1b_1 + B_2b_2 + B_3b_3)(C_1b_1 + C_2b_2 + C_3b_3)$, where $b_i$ is an annihilation operator ...
0
votes
1answer
54 views

How to count column occurrences in a matrix?

I have a matrix of data, and I want to count the number of columns that match, and have some way to organize them by frequency. But I don't want to count the entire column, but consider the matrix ...
12
votes
6answers
812 views

Deleting Lonely Numbers From a List

Suppose I have a list of integers like so: list = {1,2,5,6,8,10,11,12,14,16,17,18,19}; I'd like a function that will take this list and return a new list with ...
2
votes
1answer
88 views

Grouping large dataset across a large range of values

I have a large data set that I would like to group based upon the quantiles of one specific column. My test data set is about 2.1 million rows by 9 columns (the actual data set will be much larger). ...
0
votes
4answers
123 views

Do loop not working as expected

I am trying to get rid of data in a list. Every three elements I want to delete. Example below: ...
0
votes
0answers
23 views

How to generate a list 'without index' (i.e. {i1, i2, i3…} instead of {i[1], i[2], i[3]…}) [duplicate]

What are ways to generate a list of the form (and arbitrary length)? [i1, i2, i3]