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

learn more… | top users | synonyms (3)

2
votes
1answer
33 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
vote
1answer
75 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
0answers
46 views

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

Please let me know if I should attach all of the code. I have only decided to attach the problem code to make it easier to read. So hopefully it is enough. sortedTally is a list generated from ...
0
votes
3answers
107 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 ...
0
votes
1answer
65 views

Elements inside arrays seem to be strings rather than signed numbers

When I have code like b = Array[Subscript[be, #] &, {3, 1}] b = b /. {Subscript[be, k_] :> Subscript[-be, k] /; k > 1} I am noticing that Mathematica ...
28
votes
9answers
728 views

Sequentially numbering a nested list

I've got a nested list {a, b, {c, d}, e, {f, {g, h}}} which I want to magically transmogrify to ...
8
votes
3answers
314 views

Numbering nested list according with Depth (or Level)

(This question is slightly similar with Sequentially numbering a nested list, but not exactly the same.) What I want Say I have a nested list ...
1
vote
1answer
64 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
4answers
116 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: ...
3
votes
2answers
105 views

Replace missing data

I have vectors of equal lengths where I want to replace the zeroes (missing data) with their preceding values. So far I have written: ...
5
votes
2answers
632 views

How to plot several functions without jumping? (multiple eigenvalues of a system as functions of 2 parameters)

I've been working on this research problem for months with some success by no global/proper solution to the problem. So I have square, Hermitian matrices of various sizes ($8,20,38$ dimensions) with ...
0
votes
0answers
31 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 ...
11
votes
6answers
740 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 ...
0
votes
1answer
45 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 ...
0
votes
3answers
96 views

How to cross over the corresponding elements of matrices (genetic algorithm) [closed]

I'm working on some genetic algorithm code, and I'm seeking help to select the corresponding elements of a matrix in order to perform crossover on the chromosomes in population of individuals I want ...
0
votes
0answers
21 views
4
votes
3answers
93 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 ...
4
votes
5answers
278 views

Pattern matching in nested lists

I'm sure this has been asked before, but I can't find the right combination of search keywords to find it. Apologies. I want to do a ReplaceAll on a list of lists, ...
0
votes
0answers
30 views

How to Remove a Specific Element From a List [on hold]

I have a list of elements of which 0 is a member. I want to express this list without any of the 0's. How do I tell Mathematica to remove only the 0's from my list? The 0's can show up more than ...
0
votes
1answer
65 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 ...
1
vote
2answers
83 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: ...
3
votes
3answers
80 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” ...
7
votes
4answers
453 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 ...
0
votes
0answers
47 views

How to change dimensions of a matrix? [on hold]

I have two sets of data that I'm working with, both of which should be 1024 x 1024 matrices (they're from the same instrument). However, when I go to manipulate them, the dimensions of one are read as ...
1
vote
2answers
156 views

Complex numbers from two arrays with Real and Imaginary parts

I have two arrays, containing the real and imaginary parts of a list of complex numbers. Re = {{Re_number1},{Re_number2},...} Im = {Im_number1},{Im_number2},...} ...
0
votes
2answers
43 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
3answers
165 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 ...
-1
votes
2answers
57 views

Convex Combinations of List Elements

Let's say I have two lists $L_1=\{a_1,...,a_5\}$ and $L_2=\{b_1,...,b_10\}$. Is there an easy way to make new lists from convex combinations of these two lists' entries? Let me be more specific: 1 ...
0
votes
1answer
48 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: ...
1
vote
1answer
44 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
44 views

Position vs Part [on hold]

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!
1
vote
1answer
98 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 ...
2
votes
2answers
86 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: ...
11
votes
6answers
392 views

For a given expression: if it appears, remove it, but if it is absent, add it

While reformatting Szabolcs's code from (42660) I noticed this interesting operation: ...
0
votes
0answers
31 views

Generating vectors with restrictions on a lattice

Suppose we are given a certain adjacency matrix that contains the information for a given lattice. I want to generate a configuration of vectors that satisfy a restriction. Specifically, if I have ...
45
votes
9answers
2k views

Levels: how do they work?

I cannot understand how Mathematica manages levels, and so it's always a painful try-and-fail to use Flatten. Can someone please give me a very clear definition? ...
1
vote
0answers
63 views

Manipulate - 3 sliders for a list of 3 elements [on hold]

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
57 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 ...
10
votes
1answer
275 views

Drop selection of columns from a ragged array

I have an application where I need to drop some arbitrary list of columns from a ragged array (where of course the shortest array rows have at least all the specified columns). E.g., given a ragged ...
2
votes
1answer
60 views

Evaluate recursive funtion as a whole before computing a recursive step

I'll try to make a basic example of my problem with $n$ being an array of elements, ex. $\{1,2,2,3,3,3\}$: If i have a sum which needs a computed value i would like to compute it beforehand and store ...
1
vote
1answer
46 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
48 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 ...
2
votes
3answers
146 views

Delete rows based on specific periods

I have data (.xlsx format): two columns - data in first column imported as DateObject (dates with specific time), data in second column are numbers (113388.28, 865165.98 etc.). I want to delete the ...
83
votes
7answers
22k views

Elegant operations on matrix rows and columns

Question The Mathematica tutorial has a section 'Basic Matrix Operations', describing operations like transpose, inverse and determinant. These operations all work on entire matrices. I am missing a ...
-1
votes
1answer
60 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
4answers
105 views

Drop row if sum of part of row is equal to zero

My problem is the following: Suppose I have a matrix A which looks the following: ...
1
vote
3answers
95 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 ...
5
votes
5answers
2k views

Delete duplicate elements from a list

If a list contains duplicate elements, for example list = {a, 1, 5, 3, 5, x^2, x^2}, how can the duplicate elements be removed? The result would be ...