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

learn more… | top users | synonyms (3)

2
votes
2answers
133 views

Understanding `NestList` with multiple functions

General question For a function f[n, a], where a is a list and n is a whole number, what is ...
1
vote
5answers
191 views

Deleting missing data with CountryData

I need to delete all of the missing entries after executing this line: ...
3
votes
3answers
174 views

How to detect outlier in data of an unknown function $f(x)$

Suppose I have an unknown function $f(x)$ that is monotonic, convex and nonlinear by definition. I somehow evaluated it at 1000 nonuniform $x$ points. By ploting these data, I found a very obvious ...
5
votes
3answers
161 views

Missing control for depth of Inner

Working on a mechanics problem, I stumbled on something peculiar: Since Inner is a generalisation of Dot, it changes its ...
0
votes
1answer
101 views

Recursive functions taking list arguments

I wish to create a function that takes lists (e.g. {plus,plus,minus,0,minus,plus}) and uses the input list to calculate a corresponding value using a set of ...
2
votes
0answers
61 views

Choosing a List as VertexWeight for a TreeGraph

I would like to map every vertex of my TreeGraph to an List. ...
1
vote
2answers
47 views

How to add a part of a list to a function?

I want to be able to add a specific portion of a list to a part of a function but this fucntion intakes 6 variables where as the list is of example: ...
0
votes
2answers
93 views

Finding an idiomatic way to express a system of linear equations

I have an $n$ x $n$ matrix $T$, where $t_{ij}$ is the element at the $i\,$th row and $j\,$th column, and unknowns $x_i$, $1\leq i \leq n$, where $$x_{n} = 1$$ $$x_{n-1} = 0$$ $$x_i = \sum_{1\leq j ...
4
votes
3answers
207 views

Polynomial with alternating sign coefficients from the odd degree terms of a Truncated Power Series

I'm trying to make a function that will take any truncated power series I give it, strip away all the even degree terms, then change the sign of the coefficients of every other term. So that we have a ...
3
votes
3answers
80 views

Generating increasingly longer lists from a single list

I start with an array such as {{1,1},{0,1},{-1,1}}. (1) I want to create an array from this which replaces each array inside the array with 3 new arrays, one ...
1
vote
1answer
97 views

Transform a rule to a list of rules

How can this rule a -> {1, 2, 3} be transformed into this {a -> 1, a -> 2, a -> 3} by way of a function? ...
8
votes
3answers
175 views

Complicated list slicing

Say I have a list with the structure list = {{1, {x1, y1, z1}}, {2, {x2, y2, z2}}, {3, {x3, y3, z3}}, ...} I would like to slice it such that I end up with ...
0
votes
0answers
44 views

Using List/Histogram Data As A Weighted Function?

I have a list of data points that I would like to use as a weighted fucntion. The data represents the number of particles within a bin of a particle distribution. Ultimately I would like to multiply ...
15
votes
7answers
584 views

Enumerating tuples from a larger space such that all pairs of values are present at least once

I am trying to write a function that will accept a list of N lists and returns a list of N-tuples that represent all pairs of values from the original N lists at least once. To illustrate with an ...
1
vote
1answer
70 views

Easy way to perform multiplication of two 2x2 matrices, that contain list elements?

I have two 2x2 matrices, which elements are lists (so overall structure can be complicated). I need to perform matrix multiplication of these 2x2 matrices as if the elements didn't have its inner ...
5
votes
0answers
237 views

How to download and combine S&P 500 stock prices

I want to download historical S&P 500 stock prices and combined them into one big file, having only one column of date referencing all stocks. Here is what I have do so far. ...
6
votes
5answers
575 views

What is the best way to draw a shaded table?

I'm trying to format a raster-style table with row and column headings and in which each cell is shaded according to the value in the cell, and the value of the cell is displayed in as text in a ...
3
votes
7answers
150 views

Get the position of the right interval

I have a list of intervals: Intervals = {{0, 1}, {1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}} and a list of measurements: ...
15
votes
4answers
574 views

Exclude data from a list

Let's create some random sample data data = Table[{RandomReal[{-10, 10}], RandomReal[{-10, 10}]}, {i, 1, 300}]; Then we plot them using ...
10
votes
3answers
245 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
175 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 ...
3
votes
3answers
126 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
73 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
91 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
107 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
499 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
97 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
29 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
107 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
78 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
121 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
66 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
84 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
136 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
73 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
150 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
79 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
54 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
69 views

Modifying a list of matrices with conditional statement

I have a list of around 100 matrices, that looks like this ...
7
votes
4answers
416 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
100 views

Histogram from a list of matrices

I have a list of around 100 matrices, that looks like this ...
1
vote
1answer
82 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
66 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
47 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
137 views

Symbolic combinations

If I have 3 lists: {a,a},{b,b},{c,c}, then the desired output is ...
1
vote
2answers
47 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
154 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
187 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 ...