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

learn more… | top users | synonyms (4)

0
votes
1answer
87 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 ...
5
votes
2answers
124 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
51 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 ...
9
votes
2answers
248 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
98 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
69 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
95 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
70 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
127 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
73 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
113 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
48 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
51 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
80 views
5
votes
3answers
89 views

Problem with Compile and Flatten

I want to get two lists within a compiled function, where r is an integer: ...
4
votes
2answers
183 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
112 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
148 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
135 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
76 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
40 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
58 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
814 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
94 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
125 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
24 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]
0
votes
1answer
79 views

How to identify and remove errors in a list

After some searching, I did not find a solution to the following problem, which in my thinking should have some very easy/efficient solution. I'm looking at a list of images (faces), that I want to ...
7
votes
4answers
482 views

MovingAverage to include the average of the first and last elements in a list

Is there any way to take the average of pairwise elements in a list? Example: Given the list list = {a,b,c} I'd like to generate the list ...
4
votes
3answers
101 views

How to evaluate an expression over a particular list of tuples?

NOTE: This question is very similar to this one but I realized reading at the answers that I made a mistake in the equation AND I was not clear enough about what I need (my apologies): I want to ...
3
votes
3answers
83 views

Identifying locations of entries in an array

If I’ve got a big array displayed in Mathematica, is there a way for me to select a particular location on the screen and have Mathematica tell me “You’ve selected the entry in row 137 and column 92” ...
1
vote
3answers
177 views

Listing elements starting from 0

The first element in a list v in mathematica is denoted by v[[1]] and subsequent ones are then ...
0
votes
1answer
56 views

How to find the starting point of an oscillation (with noise)?

I've got a series of coordinates which start to oscillate from some time (and with noise), like this: ...
0
votes
2answers
47 views

Selecting the maximum value from the results returned by NSolve

I'm trying to select the maximum value from the answers Mathematica 7.0 is getting from a simple basic NSolve algebric equation : ...
1
vote
2answers
91 views

List Operations: how to combine two lists (pattern given)

Two lists (matrixes) are given: a = {{x1, y1}, {x2, y2}, {x3, y3}}; b = {{u1, v1}, {u2, v2}, {u3, v3}}; Expected return: ...
2
votes
1answer
54 views

How to show steps of “For” command

I wrote the command: list = RandomInteger[{0, 10}, {9, 3}]; For[i = 1, i <= m, i++, element=Total[ list[[i]] ] ] How can I make every step visible? If I ...
0
votes
1answer
58 views

Position vs Part [closed]

What's the difference between Part and Position? How can I "move" from the form used by Part to that of Position (and vicerversa?) Thanks!
2
votes
2answers
90 views

How do I partition a matrix?

I have a data file with fields x y z. When I import it to "data", I get a matrix if the form: ...
4
votes
1answer
165 views

Sow only if different from zero

I am trying to collect elements with Reap and Sow, where I am interested only in non-zero elements, that is I am trying something like that ...
1
vote
0answers
72 views

Manipulate - 3 sliders for a list of 3 elements [closed]

I'm trying to create a slider for a list of 3 elements. I know that I can create a 2D slider for a list of 2 elements and it's impossible to create a 3D slider for a list of 3 elements. So, I just ...
3
votes
1answer
61 views

Map with multiple arguments

I have a function f[m,n] and a list of arguments args = {{m1,n1},{m2,n2},{m3,n3},{m4,n4}, ...} that I want to apply to it. I ...
1
vote
1answer
53 views

How to reduce trigonometric expressions under special conditions

For the following problems I used "FullSimplify" and "TrigReduce" but I manage to reduce more ...
2
votes
1answer
52 views

Transformation syntax with shortcuts to a more explicit syntax for an equation

I would like to write the following code line without the signs @#%^&*?! Sequence @@ (XMLNote[#1, m] &) /@ attributes I have made this code but it seems ...
-1
votes
1answer
63 views

Help needed with assignment [closed]

Can I get some help with this: Write a module which as an input receives two matrices, the first matrix transforms in to the same matrix, but in the new matrix occur absolute values of the first, ...
1
vote
3answers
101 views

Use Do to evaluate an expression over two indices $i \ne j$ (over a list of tuples)?

I have an expression of the form: expr1[i_,j_] = Sum[\[Beta][j]*\[Phi][i, j]* C[i] I would like to evaluate this expression over i=1:4, j=1:4 with i!= j. One ...
1
vote
3answers
81 views

ListPlot the results of FindMaximum [closed]

I want to plot a list of the form whose elements are of the form {value, {x -> value_x, y -> value_y}} The list generated by FindMaximum applied on ...
5
votes
3answers
277 views

Generate a list of equations of curves and plot them

I want to plot a series of lines. This is how I did it: ...
2
votes
2answers
120 views

make trace of a matrix listable?

I have a list of 2 by 2 matrices and I want the list of their traces. I have been using Map[Tr,mylistofmatrices] But I wonder if there is a way to make ...
1
vote
0answers
54 views

Fast construction and reshaping of large tensors

I'm trying to construct a large matrix which is derived from some higher rank tensor (the rank of interest to me changes case by case, so it needs to be a general method). Currently, the process of ...