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

learn more… | top users | synonyms (3)

10
votes
3answers
241 views

Using 0 to create new columns in a list with Part

I just discovered a nice way to create intermediary columns in a list, and I would like to know if I can have some problem with it. It Works like this: Imagine I have this list, 5x3: ...
4
votes
2answers
147 views

How to exclude some indices in defining Table?

Suppose I define a table using Table[n, {n, -n0, n0}] (where n0 is some positive integer) but I want n not to take the value ...
2
votes
3answers
99 views

Compare 2 lists

I want to compare 2 lists. One is very large and I need to compare many times. Lets say Length[list1] I need to know how many times list1 occures in list2. Eg. list1={1, 0}, list2={1, 0, 1, 0, 1, 1} ...
1
vote
1answer
56 views

Lists of integers coprime to another list

I have two lists of integers. The first, p, is a list of primes (for example, {2,3,5,7}). The second is a list ...
-1
votes
4answers
74 views

Eliminate symbols from Lists

I'm working with a list of roots of a 3rd order polynomial family, so i get a list this way: ...
0
votes
3answers
105 views

Manipulate list in function

I have some problems with lists and functions. Basically I just want to cut all entries from the right side, which contain 2. ({2,1,2} should become {2,1}) ...
5
votes
5answers
489 views

Efficient Indexed Sort

Suppose I have a preference for animals given by: orderOfAnimals = {"dogs", "cats", "fish", "elephants", "giraffe", "hamsters", "poodles"}; I'm given many data ...
0
votes
4answers
89 views

How to express “if any component in a vector satisfies that …” in Mathematica

For example, l is a list of vectors. I need to delete from l all the vectors with any component larger than 1. How should I do ...
0
votes
1answer
22 views

MapThread with incompatible length (How to Map twice in the same line)

l and b are two lists of vectors with different length. I need the list of vectors that is constructed by adding each member of ...
1
vote
4answers
81 views

Removing all values from a list that satisfy a given condition

Suppose I have a list, list = Table[{n}, {n, 1, 5}] (* list = {{1},{2},{3},{4},{5}} *) and I want to remove all values from this list that are greater than 3, so ...
0
votes
1answer
48 views

Error: in the part assignment is not a symbol [duplicate]

I am trying to set part of a Doubly-indexed list aInitialPopulation to cNumHeg. Specifically I am trying to set the 3rd part of the list aInitialPopulatiom[[cNodeNumber]] to cNumHeg. My (attempted) ...
4
votes
7answers
120 views

Distributing identifiers

I have a list that looks like this: {{"a",},{2010,0},{2011,10},{2012,27},{"b",},{2011,11},{2012,66},{"c",},{2010,19},{2011,20},{2012,}} I want to turn it into: ...
0
votes
1answer
63 views

Finding duplicates in a list

I have a list of integer, and I want to know if the list contains any duplicates. My code is working, but I feel there is a more straightforward way of doing this ...
2
votes
1answer
113 views

Excluding cases from Map

I'm doing operations of the form: PowerMod[#, -1, 126]+# & /@ Range[1, 125] When a number is not invertible, I don't want it to be included in the result ...
4
votes
2answers
74 views

How to sum values in the list that belongs to same week

I need to sum values that belongs to same week. For example, I have the list x with one column and n rows. Format: ...
3
votes
3answers
113 views

Finding the first position in a list that is over a certain value

Let's say I have the following list: L = {2,4,6,8,10} How can I get Mathematica to find the index position of the first value in the list that is over 4 (6 in ...
2
votes
3answers
66 views

How to manipulate one column of a table using the value in another column

Let's imagine I have the following table structure data = {{a, b}, {c, d}, {e, f}}; and I want to transform it into the following table ...
1
vote
3answers
123 views

A rule replacement problem: list -> list

Suppose I have a vector function f[x_] := {x[[1]]^2 - x[[2]]^2, Sin[x[[1]]] + Cos[x[[2]]]}; Then I want to make a list of gradients at some values: ...
1
vote
2answers
68 views

replace two elements in a list with the sum of those two elements?

I have a list: G[3] = {2, 4, 2, 4, 2, 4, 2, 4, 2, 4} (there's a 3 in there for the 3rd Prime) Recursively defined by: ...
0
votes
1answer
52 views

Finding list position in array [closed]

Lets say I have the list {{1,2},{1,3},{2,4},{1,3,5}} Is there a way I can get the positions of the lists starting with 1? ...
1
vote
1answer
61 views

Modifying a list of matrices with conditional statement

I have a list of around 100 matrices, that looks like this ...
7
votes
4answers
403 views

Computing a map between two lists

What I want is a little difficult to explain. So I try to it with an example. I have 2 lists, each of which has $(n-1)^2$ elements. Each element is an integers between 0 and $n-1$, inclusive. For ...
1
vote
1answer
92 views

Histogram from a list of matrices

I have a list of around 100 matrices, that looks like this ...
1
vote
1answer
80 views

How to form a variable from matrix elements

I have matrix with n rows and 2 columns, say m = {{x11, y12}, {x21, y22}, ..., {xn1, yn2}. Now, I want to form three new variables for example: ...
2
votes
2answers
49 views

How to delete certain unwanted elements from an array

Suppose I have an array like so array1 = {{Null,2,3,4,5}, {a,b,c,Null,e}, {w,x,Null,y,z}} Is there some way to selectively remove any element I ...
1
vote
1answer
41 views

Multiway Systems Rules List Management

I'm working with a multiway system and I have a number of different mutation rule lists. I need an efficient way of managing which rule lists I apply. Here is the basic multiway system code that I'm ...
1
vote
2answers
130 views

Symbolic combinations

If I have 3 lists: {a,a},{b,b},{c,c}, then the desired output is ...
1
vote
2answers
41 views

Exporting mixed data of matrices and vectors / lists

thank you for reading my question. I have a problem trying to export mixed data from Mathematica. I have different matrices and vectors, which should be combined to a output file. Here a ...
3
votes
1answer
144 views

Making a list of rules from the list of elements

Starting from the list: {f[q1, q2], f[q3, q4], g[q1], g[q2, q3, q4], d[k1 - q1], d[k2 - q2 - q3 -q4]} I would like to get the result: ...
3
votes
3answers
184 views

Pare down list recursively

What is the best way to pare down a list whereby the $n$th number is removed from the list recursively? This ...
1
vote
0answers
100 views

How to create a complex variable from dated list values

Can anyone help me to construct a variable "PI" from values of variable x. Variable x represents a group of two time series rj and ri on equal dates(joined two dated lists with states).Variable x have ...
5
votes
4answers
301 views

How to extract a part of matrix satisfying certain condition(s)

I have a following matrix ...
2
votes
4answers
87 views

Selecting every n-th element from a list [closed]

I have a list: data = {4, 5, 7, 8, 9, 5, 3, 2, 1, 2, 13, 12}; I want to take those elements in the list which are located at equal distances, say, every third ...
3
votes
2answers
96 views

MapThread problem

I would like to do the following: ...
4
votes
3answers
126 views

Extracting columns from multidimensional list

Perhaps a very easy question but I posted this on the Wolfram Community and didn't get any answer.. Suppose I have data like: ...
1
vote
0answers
59 views

Programming for matrix manipulation

I want to write a programme which operates on nd x nd matrices. The programme looks the matrix as a n x n block matrix where ...
4
votes
2answers
119 views

Can't figure out how to apply these functions repeatedly

I have the following problem, and even though I've tried Fold & Inner, Sow & Reap, et al. I can't figure out the clean way to do this. Here's the problem. I have a list that starts as ...
3
votes
2answers
60 views

Fast functional method for multiplying duplication numbers in a large list

Consider a list of symbols: mySet = {a, b, b, c, a, b, c, d}; I would like to form the product of duplication numbers. In the example above, I have 2 ...
2
votes
3answers
84 views

Manipulating array

I have got an array like this: A = {{{1, 4, 5}, {3, 7, 15}}, {{5, 6, 9}, {7, 8, 2}}, {{9, 10, 1}, {11, 12, 3}}} I make differences in each sublist a following ...
1
vote
2answers
113 views

How to select states with equal times

Can anyone show me how to select the states that have equal times-dates. For example, i have two time series. First that have 10 observations, say from 2014/10/1 to 2014/10/10, and second that have 7 ...
1
vote
2answers
72 views

Replace list of symbols in an expression

I have an expression: exp = a+b+c and a list containing all the symbols of my expression: syms = {a,b,c} and I would like ...
0
votes
4answers
60 views

Conditional combining of nested lists

I have two nested lists like those {{a,A},{b,B},{c,C}...{z,Z}} {{a,1},{c,2}...{t,12}}. I want to combine them to get a new list that looks like this ...
0
votes
1answer
73 views

Rotate points by 60° in 2D

I wrote this code, to rotate a list of points 60° about the first point in the list in 2D, but Mathemtica says: "Recursion depth of 1024 exceeded."
7
votes
5answers
796 views

Check if two lists are equal in any order

Suppose I have two lists, how can I efficiently check if the two lists are identical up to permutations of the elements? For example I would like the function to output: ...
2
votes
2answers
115 views

Matching a case when one element in a pair is Null

I've got a dataset of laitutdes and longitudes. Unfortunately, some of the dataset was from when a time when lat/longs weren't constantly recorded. So I need to remove the invalid data before working ...
6
votes
2answers
81 views

Mathematical operation on two lists by a “key” [duplicate]

I'm a complete newb here. Just looking for direction. I've got two lists like this... ...
1
vote
1answer
56 views

Summing subsets of array

I have an array farr, size Nx*Nx. I have a function frk that maps index {n,m} to an integer (approximately ...
0
votes
1answer
54 views

Loops for Unit Root Test

I want to compute some unit root tests on a data generating process. I already split the sample in 100 single samples, but how can I do a unit root test on all of them and store the results in another ...
2
votes
3answers
134 views

Concisely returning a position in an array with an index variable [closed]

We have an array and an index in the array: exampleArray = Table[{a, b, "q"}, {a, 1, 10}, {b, 1, 10}]; arrayIndex = {5, 4}; Very simply, we can return the value ...