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

learn more… | top users | synonyms (3)

1
vote
1answer
98 views

Constructing new lists using Table

I tried to modify an old notebook to show a spreadsheet style output in a table. I am not getting any errors when it runs, so I think the data I am gathering and the new variables I added, ...
2
votes
1answer
70 views

How can I use parts of lists with Dynamic?

I'm a newbie - what am I doing wrong? I want to use parts of lists (vectors) in calculations but Mathematica will not evaluate anything that involves parts of lists that update dynamically. Is there a ...
2
votes
4answers
175 views

How to remove hours, minutes, seconds from list

How to remove 0 that represent hours, minutes, and seconds from a date list say a ...
0
votes
1answer
48 views

Deleting list elements at a certain level

I have a large list of 3 by 3 matrices such that the dimensions of the list for an example 100 matrices would be: {100,3,3} I have written a function that locates all the matrices I do not want and ...
0
votes
1answer
53 views

Simple arithmetic operations on elements of a list [duplicate]

How can I shift the first element of a list by 148.38 and the second element by -38.45? The data ...
2
votes
1answer
61 views

second part of a list with something like BinLists

I have a list that looks like this testList = Transpose@Table[{RandomInteger[{0, 100}], RandomReal[]}, {100}]; i.e. basically two lists in one. Using BinLists ...
1
vote
1answer
93 views

Why doesn't Thread work in this case?

The following function is supposed to pick the element of the list with highest weight, i.e., with Thread [f[{{a,1},{b,2}}]] it should make the variables ...
3
votes
3answers
128 views

How to pick the maximum of a list? Improving efficiency

I need to find the element of a list, with the highest weight. Example: ...
4
votes
5answers
135 views

New nested list from three lists

I have three lists. x = {a,b,c,d} y = {A,B,C} z = {{1,2,3},{4,5,6},{7,8,9},{10,11,12}} and I wish to construct the following list out of these three lists ...
2
votes
1answer
33 views

In each sublist, replace the value in the right part by the value in the left part

Consider the following nested list {{a,1/x},{b,2x},{c,Sqrt[x]},{d,1-1/x}} I'd like to come up with the same list where the variable $x$ is systematically ...
3
votes
3answers
177 views

Trouble with Position[]

I am in trouble with Position, Although my example works as expected it throws a warning. Position[{{a,b},{a,c},{a,b}}, _?(#[[2]]==b&), {1}] During ...
0
votes
1answer
51 views

Position of elements in a list satisfying some criteria - Understanding the syntax [closed]

From this post: if one wants to know the position of the elements of a list that satisfy some criteria, (s)he can do something like that: ...
1
vote
1answer
55 views

List Manipulation and Removing Cases

I've imported a large data set, manually removing headers in the .rtf file where it originates. However, when I import this data, I receive this output: ...
0
votes
1answer
60 views

How to use Hold on a variable defined as a graph

I'm working on doing operations on different graphs and getting their probability node degree distributions using a simple algorithm. If I have many defined graphs, for example: ...
5
votes
5answers
493 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 ...
1
vote
1answer
57 views

How to make a table of successive values

I want a list, where each entry is of the form {x,y}. I want x to go from $-\pi / 2$ all the way up to $\pi/2$. I also want ...
0
votes
1answer
42 views

Elegant ways of solving this file batching task

There are a batch of data files in a folder (dir = "D:\\Documents\\datadir"), each of which consists of a list of data items, one per line. Each data item is a pair ...
1
vote
1answer
32 views

Applying MeanFilter to a large Nested Array [closed]

I have a large nested array. Let's generalize it to this: Data = {{a1,a2,},{b1,b2},{c1,c2}} I need to make a new array where ...
15
votes
8answers
1k views

Selecting a sublist based on Length

If you have a simple list of lists as follows: test = {{1, 2}, {4, 5, 6, 7}, {5, 4, 3}} How do you ask Mathematica to return the sublist of greatest length? ...
0
votes
2answers
64 views

NSolve gives {{ x -> #}}, How do I make x = #; I need to use the x value again later

I want to use: demand = {1.92, 2.07, 2.37, 2.72, 2.87}*10^6; NSolve[SetV == demand[[1]]/(Cpf (1 - χ)), χ] I want to make a vector of solutions ...
-2
votes
1answer
57 views

Create a matrix by crossing a list

I've a list L of elements. I want to create a matrix by laying each elements of L in both rows and columns where each ...
2
votes
3answers
85 views

Comparing two lists lexically

I have two lists of integers a and b of equal length, and I would like to define a>b as ...
1
vote
2answers
297 views

What quantity is this “length” called?

tmp = {x, y, z}^{1, 2, 3} Times @@ tmp Length[%] This gives a length of 3. But I was expecting 1. What is exactly this "length" of x*y^2*z^3 called? I would ...
1
vote
1answer
157 views

Mathematica List Selection

I have a list which contains these elements : ...
1
vote
1answer
121 views

Finding the index of (x,y) pairs in a list

I have a large list of $(x,y)$ pairs, and I want to find the index of a particular pair in order to extract some data from another array. By way of an example, ...
0
votes
1answer
56 views

Why `Delete` does not work?

I'm trying random thing in Mathematica just for learning and I can't solve this problem. I want to use the Detele function to delete some elements in a list but ...
2
votes
1answer
65 views

Displaying a list in form of an upside down pyramid graphic

I was wondering how to display a list like this: list={{0,1,1,0},{1,0,1},{1,1},{0}} in form of an upside down pyramid, that is the first element of the list is ...
5
votes
3answers
766 views

How to build this grid with less code?

I have the diagonal and both upper and lower triangulars of a grid. ...
4
votes
2answers
73 views

How to keep first observation and delete other observations of each group in unbalanced Panel data

I have a huge panel data. I want to create a new data keeping only first observation of each group. How can I achieve it? For illustrative purpose; ...
2
votes
3answers
163 views

Splitting a list of lists (part2)

This is a follow up from Splitting a list of lists . What would be a nice way to split the list l1 = {1,2,{a,b,c},3,{d,e}} into ...
0
votes
1answer
62 views

Duplicate values n-times [closed]

I already asked how I can take the list {1,2,3} and get {1,1,1,2,2,2,3,3,3} out of it, adding degeneracy to the problem. So far ...
6
votes
6answers
287 views
0
votes
3answers
72 views

Splitting a list of lists

What would be a nice way to split the list list = {1,2,3,{a,b,c},4} into {{1,2,3,a,4},{1,2,3,b,4},{1,2,3,c,4}}
3
votes
3answers
186 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
6answers
105 views
1
vote
1answer
31 views

Generate Degeneracies in List [duplicate]

I have a list with n entries and I would like to duplicate this list p times. In my case because of the Degeneracy of my Eigenvalues. For example I have {3,2,1} and it is five-fold-degenerate so that ...
1
vote
2answers
73 views

How do you apply an algorithm individually to an array with many graphs

I have and array with many graphs to which I want to apply an algorithm (below) to each graph in an array that contains all my graphs. ...
2
votes
2answers
129 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 ...
3
votes
3answers
169 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 ...
2
votes
3answers
149 views

Deleting missing data with CountryData

I need to delete all of the missing entries after executing this line: ...
2
votes
0answers
58 views
8
votes
1answer
213 views

Transformation rule on a list of non-negative integers

I am trying to create a transformation rule that takes a list of non-negative integer values of any length, finds a non-zero entry in the list, adds 1 to all preceding numbers, subtracts 1 from the ...
4
votes
3answers
194 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 ...
0
votes
2answers
89 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 ...
0
votes
1answer
88 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 ...
5
votes
3answers
159 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 ...
1
vote
2answers
46 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: ...
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 ...