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

learn more… | top users | synonyms (3)

3
votes
0answers
150 views

FindPeaks finds Minima, but not all of them [closed]

I have 10 sets of data, which are the result of measuring the way of a mass falling down over time, bringing a wheel into rotation when the mass hits the ground and then the wheel lifts the mass up ...
3
votes
3answers
102 views

Selecting sublists of different length if at least one element of the sublist fulfills a criterion

I have the following list, containing sublists with 1,2 or 3 elements. ...
5
votes
2answers
357 views

Is there an inequality operator (Less, Greater) for lists of elements (as opposed to elements)?

Like multi-column sorting. For example, {1,3,5} > {1,2,5} would return True, while ...
1
vote
0answers
65 views

Disease Network Model Using NDSolve

I have a basic disease model using NDSolve: ...
1
vote
2answers
103 views

Evaluate a list

I have a function $f(x_1,\cdots,x_n)$ that takes $n$ arguments, and I would like to evaluate it using a list of lists $\lbrace\lbrace x_1,\cdots,x_n \rbrace,\cdots,\lbrace x_1',\cdots,x_n' ...
-1
votes
1answer
50 views

Null before each element in a list [closed]

I have a list of colors that I am trying to use to color another list, I have a function that makes the list and I call that function and set it to a variable in another function. If I try to print ...
4
votes
1answer
118 views

Map at a subsequence of a list

I'm trying to construct a function somewhat similar to MapAt. A basic usage example should look like this: ...
24
votes
7answers
681 views

Faster position list construction from a “take instructions” list

Take some list, e.g., {1,2,3,4,5}, and a "take instructions" list, say {1,1,2,1,1}. The latter is read as "take the first ...
5
votes
1answer
156 views

Slow exponential evaluation over lists

This question,which is still unanswered, might be relevant because it involves NIntegrate over lists and it also has Exp. In ...
0
votes
2answers
80 views

Convert Range to List of Strings

I need to generate the result given by ...
9
votes
2answers
377 views

What is the fastest way to get the nth distinct permutation of a list?

What is the fastest way to write a function nthPermutation[xs_List, n_Integer] which is equivalent to Permutations[xs][[n]] but ...
4
votes
1answer
107 views

Last Position function

The FirstPosition[] function can be use to locate the first position of an occurrence in a list. For example ...
1
vote
3answers
149 views

How can I make a summary of all the commands of Mathematica?

I would like to have a simple way to get summary information about all the many commands built into Mathematica. How could I do this? Is there a site I may refer to?
1
vote
0answers
40 views

Substitution does not work while substituting with a value from list

I am writing a program which iteratively solve and make substitution from a list. As I have shown in the code substitution works when I enter the value directly (Input 100). When I extract the same ...
6
votes
2answers
140 views

Checking if one partition is a subpartition of another

Say I've got two partitions of an list (not necessarily containing numbers, and not necessarily distinct), and I want to check that one is a subpartition of the other. Let's look at some examples: ...
1
vote
1answer
90 views

How to plot multiple yearly data in one graph

There is a dataset: for each year a single data for 6 seas. I would like to have a graph to visualize paralel changes. This is what I attempted to reproduce ...
1
vote
2answers
79 views

Avoid nesting of functions [closed]

is there a way to avoid the "nesting" of functions like f[f[f[a, b], c], d] where a, b, c, d are lists and f is a function that merges two lists with certain ...
4
votes
1answer
151 views

MovingMap maps to second level unexpectedly

I'm trying to build a financial indicator in mathematica. I import some historical data ...
3
votes
1answer
63 views

Finding position of non empty matrix entries

I have a series of circles in space and I am trying to find the intersections of a given line and the circles and storing that in an array using Table. As the line ...
1
vote
2answers
77 views

Find maximum of 'y' coordinates from a list of duplicate 'x' coordinates

I have a multidimensional-variable list, suppose for example {{x1,y1},{x2,y2}..}. I have duplicate values for the 'x' coordinates and I need to find for the duplicate 'x' elements the corresponding ...
3
votes
2answers
104 views

Generating Z^*_n

I'm using Mathematica to illustrate basic number theory concepts in a graduate cryptography class. To generate elements of the multiplicative group of integers modulo $n$, i.e. $\mathbb{Z}^*_n$, I can ...
1
vote
1answer
90 views

Missing elements using FinancialData

I have a list of stock symbols which I selected with FinancialData["Menbers"] that looks like the following list: ...
3
votes
4answers
108 views

How to combine the elements of two lists using a user-specified function

I have two lists of integers. From these lists I want to produce a list where each element is a fraction derived from a corresponding pair of elements in the original lists, the smaller integer of the ...
1
vote
2answers
160 views

Manipulating elements of a matrix, to loop or not ?

I have a grid of values generated from a MATLAB evaluation. Most of these elements are 0, some 0.5 and the remainder 1. I'd like to write a mathematica script which reads in the CSV and then, in every ...
0
votes
2answers
70 views

How to change list to a list of points

I have a list of angles {a1, a2, .... , an} and I would like to have a list of points ...
1
vote
4answers
95 views

Group data in table by 2nd column while consolidating values in 3rd column

I currently have a list in the format: {Group, State, num} {{a, CA, .5}, {a, AK, .2}, {a, MX, .1}, {b, CA, .8}, {b, AK, .8}, {b, MX, .1}, {b, HI, .7}} I ...
1
vote
1answer
51 views

Listing all values in an array

I am trying to populate an array variable using a do loop as follows Do[rayseg[1, i] = i, {i, 1, 5, 1}] This does what I want it to do, however I want to be able ...
3
votes
3answers
115 views

Change matrix elements at specific locations?

Let's say I have an array a={{1,2,3}, {4,5,6}, {7,8,9}} I want to have all elements along the diagonal multiplied by 2. ...
0
votes
3answers
61 views

Delete nested lists with Missing[“NotAvailable”] [duplicate]

I have a list of stock symbols and related information containing some entries Missing["NotAvailable"]. I would like to delete all nested lists which contain a ...
0
votes
1answer
61 views

Select nested lists based on string pattern

I would like to select nested lists out of a master list based on certain string pattern as in the following example: ...
1
vote
2answers
179 views

How do I disorder a list in Mathematica?

Given a list like this (the original list is much longer), how I can get a completely unordered list and save it in plain text? I change the file names (names at random), using a length of 5 digits, ...
0
votes
0answers
62 views

Unknown number of variables in a logical statement

Resolve[ ForAll[{i, y[i]}, Implies[i >= 0 && i < 3 && Implies[i < 3, y[i] > 0], Sum[y[i], {i, 0, 2}]>0]]] returns ...
0
votes
2answers
42 views

Selecting elements from a list [duplicate]

I have the following array of numbers: a = {{0, 2, 5}, {3, 5, 1}, {4, 0, 5}, {8, 3, 4}, {0, 8, 6}}; then I make a list of the first row with ...
0
votes
0answers
58 views

Improve performance of processing transactions in a large file

I want to work with a table which has 296,705 transactionslines and 172,147 transactions. ...
2
votes
1answer
75 views

Removing characters from non-strings

I have a large list of lists that contains mixed data, some real, some strings. The lists are of various lengths and depths. Some of the real data values have an asterisk appended to them, e.g.: ...
0
votes
2answers
68 views

Select over many lists with changing selection criteria

I have many individual timeseries I am trying to align and compute the mean and other statistics for. The problem I am having is that I am only interested in aligning a particular part of each ...
1
vote
1answer
33 views

Export nested list with complex structure

I have a list that looks like this l = {elem1, elem2, ...} Where elem_={t, {d1,d2,d3} } How can I export it? I tried ...
1
vote
1answer
49 views

Let's do this list-rearrangement prettier [duplicate]

Suppose that i have a list in this format= $list=\{ \{a,obj1 \} ,\{c,obj2 \}, \{a,obj3 \}, \{b,obj4 \} \dots\}$ I want to construct a new list in this way: $ newlist= \{ \{ \{a,obj1\} , \{a,obj3\} ...
6
votes
6answers
512 views

Determine if all the zeros in a list occur at the end

I have a collection of (short) lists of nonnegative integers. For each, I would like a predicate that decides if all of the zeros in the list appear at the end. For example, ...
6
votes
3answers
237 views

How to build a matrix from a set of vectors and other matrices using ArrayFlatten

I want to build a 6 by 3 matrix, from the following: one vector is 3 by 1, then a matrix, which is 3 by 2. These will go to the top 3 rows. Now the bottom 3 rows, I'll have 3 vectors each is 3 by 1. ...
2
votes
3answers
136 views

How to extract both first and last rows of each group from unbalanced panel data

This is a follow up question form my last question click here. I have unbalanced panel data such as : ...
5
votes
2answers
230 views

Generate cyclic list from a list

Given a list (for example, {3, 5}) I would like to make a function genCyclic[n_, list_] which generates a cyclic patterns of ...
1
vote
0answers
69 views

Find algorithm or generator formula with automated procedure and pattern recognition

I am trying to find a generator formula for the discriminant of a polynomial and believe it would be an interesting problem for the Mathematica community to know how to automate evaluation of certain ...
5
votes
4answers
221 views

How can I get a list of the positions of the running minima in a list?

I want the positions of the (sequential) running minima in a list, that is, the positions of entries that have the minimum value of all the elements in that list, up to and including that entry. For ...
3
votes
3answers
140 views

List manipulation: Dropping first or last row or column of a matrix

How do I drop the first/last row or first/last column from a matrix? The general case is answered here but I am new to Mathematica and it the arbitrary case is unnecessarily complex. Suppose I am ...
0
votes
1answer
56 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 ...
4
votes
3answers
162 views

Replace elements in matrix to make it symmetric using automated procedure

I am generating a matrix using (mat2 = Array[Subscript[a, ##] &, {4, 4}]) // MatrixForm but would like to force Mathematica to make it symmetric. Thereby I ...
0
votes
2answers
48 views

Constructing a table from a constraint on another table

I have a 1000X6 table, where in each row the first three columns are dependent on the second three. I then make smaller tables of 1000X2 from these first three columns and basically ...
1
vote
3answers
168 views

Defining functions when there are a lot of parameters

Suppose I have two lists of parameters: $\delta=\{\delta1, \delta2, …\}$ and $\gamma = \{\gamma1, \gamma2, …\}$. The question is: how can one use $\delta$ and $\gamma$ (the parameter vectors) within ...