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

learn more… | top users | synonyms (5)

1
vote
1answer
71 views

Plot column using some list as x values? [closed]

I've got a mathematica notebook that uses RK4 to successively approximate solutions to a vector valued DE. The output is a nested list similar to: ...
0
votes
1answer
43 views

Multiplying columns with factor [duplicate]

If I have a matrix matrix=Table[RandomInteger[],{i,3},{j,3}] And I multiply it with vector={1,3,5} All three rows change ...
0
votes
0answers
47 views

How can I implement arrays which begin with index 0 [duplicate]

I would like to work with arrays (lists) whose first element has index 0 like arrays in C or Python. I cannot use Part[] since ...
3
votes
1answer
55 views

How does levelspec work inside Position?

Please, can you explain the following feature of levelspec inside Position ? This code test=Range[5]; Position[test,x_/;x>2] as expected, gives ...
7
votes
5answers
513 views

How to extract points from a closed curve

OK, let's create a simple closed curve C0 = ContourPlot[x^2/4 + y^2/9 == 1, {x, -5, 5}, {y, -5, 5}]; and let's plot the corresponding points ...
6
votes
3answers
239 views

Reversing components in a list

Suppose I have the following list: Tl={{a, 3, b}, {c, 6, d}, {e, 9, f}, {g, 5, h}} I really want to reverse specific elements of this list such that I get the ...
5
votes
1answer
103 views

How to get a new list by exchanging some elements?

Let's begin with a simple example. Now, we have a list, list0=Range[4]; k1 and k2 are some elements of the list0. If |k1-k2|==2, then the elements k1 and k2 can ...
4
votes
2answers
99 views

Import Data different column length

Lets assume, i have this data.txt file. s1/km t1/h s2/km t2/h 20 1 40 1 40 2 80 2 60 3 I define myself a function ...
2
votes
2answers
64 views

Converting imported data into a list of pairs [closed]

I have data imported like this: ...
0
votes
1answer
88 views

Turning table into association for Classify

I have the following sample data for 20 users. I know their sex, and the response for three yes/no questions. I am trying to building a classifier to guess their response to the third question, based ...
3
votes
2answers
180 views

Consecutive identical integer members of a list

Can you help me to find and count sub-sequences of consecutive, identical integer members of a long list (at least 1000 members)? By sub-sequences I mean runs like ...
5
votes
2answers
74 views

Select from a list using another list of limits

Given a list of values list1 = {2.4, 3.4, 5.9, 1.2, 9.5, 7.5} and a another list containing theoretical maximum values ...
2
votes
1answer
89 views

How does this code work to substract a set A from a set B?

In an answer to a question (as given here: code), the proposed function was to to subtract a set B from a Set A: ...
3
votes
2answers
83 views

How can I filter a permutation list depending of a pattern? [closed]

I've created a permutation list Grid[Permutations[{a, e, q, r, t, u}], Frame -> All] and only want to see rows where the 5th element is a "t". I tried to do ...
4
votes
3answers
231 views

Will the “for” loop not have an effect on something I'm looping over?

My title is probably worded horribly, let me explain what I mean. So I essentially have a list of lists, and I want to go through and mark which list indices have a certain property. This is how I ...
-1
votes
3answers
104 views

What would be a good way to implement index notation?

So I need to calculate a 3x3 rotation operator (basically a matrix). I have an index-notation expression, and I was wondering if with pre-calculated theta, K1, K2, and K3, could Mathematica compute ...
1
vote
1answer
149 views

Simplify the huge determinant product

I try to get the following determinant product result, ...
0
votes
0answers
30 views

What is a proper transaction from nested rules to nested associations? [duplicate]

Considering a list of rules {A -> {A1-> B}} what will be the correct way to come to <|A -> <|A1-> B|>|>? ...
15
votes
2answers
205 views

Why does Part return empty list for non-existing elements in ;; specification?

When using the ;; specification Part will return empty list for first index above a list dimensions. For example: ...
3
votes
1answer
49 views

Assign zeros to large list of indexed variables

I have a big list of the form list={P[1,1],..,P[i,j]} and would like to assign 0 to each of them, but ...
3
votes
1answer
125 views

Programming a MaxMin Linear Optimization

I want to program a function for a two-player game. Basically it's like this: . Each player has an array of options, and the result of the game is based on both players choices. So heres my most ...
6
votes
3answers
203 views

Formatting price data

I am import some data from a CSV file. I want to replace the ":" and "-" so I can graph it with ListLinePlot or DateListPlot. ...
0
votes
1answer
80 views

How to plot many 3D lines together

Here is a small data sample: ...
10
votes
4answers
314 views

Element-wise test on List elements

This question could sound pretty silly but I can't find a way to apply element -wise tests to a list. For example if I digit ...
0
votes
0answers
41 views
3
votes
1answer
41 views

Simplifying nested KroneckerProducts

Any suggestion how to bring a nested KroneckerProduct form into just one? I mean some how converting ...
0
votes
2answers
93 views

How to create a mirror-symmetrical list

My data file can be found here: data data = Import["mnl.out", "Table"]; First we remove the headers ...
3
votes
2answers
88 views

How to plot specific lists

Here is a sample of data points: ...
5
votes
3answers
164 views

How to replace an element in a list with an element in another list with matching indices

I have a list like this l = {1 + 2*s, 2 + 3*s, 4 + 1*s}, and I have calculated s = {1, 2, 3}. I need to replace ...
1
vote
2answers
80 views

3d Table to 2d table

I have generated a Table in 3 dimensions, for two variables x, y. ...
3
votes
2answers
70 views

(Again) eliminate curly brackets from PopupMenu?

How can I display the items in a PopupMenu , which is fed by a list, without the curly brackets? The sample code is: ...
1
vote
2answers
32 views

“Nonatomic expression” error when identifying certain positions in a list [duplicate]

Please can anyone help ? I have a list of sets, and I am trying to find the positions in that list of those sets which are subsets of a given set. (Here I am ignoring the distinction between lists and ...
12
votes
2answers
256 views

Efficient conversion between two partition representations

I have a list of distinct expressions. We can represent a partitioning of list in two ways: As a list of sublists ...
11
votes
4answers
629 views

In a list of points, how to efficiently delete points which are close to other points?

Consider a list of points: pts = Partition[RandomReal[1, 10000], 2]; ListPlot[pts] I'd like to delete points so that the minimum distance between two points is ...
0
votes
0answers
39 views

How to create a color ListPlot [duplicate]

Assume that I've got a list L={{1, 2, 0.1}, {2, 4, 0.2}, {3, 5, 0.3}} I want to show this list like where first point (from the left side) has a additional ...
2
votes
1answer
85 views

Efficient creation of lists from other lists

Given the following lists: v1 = {a, c, e}; v2 = {b, d, f}; how does one efficiently create the following "combination lists"? ...
4
votes
2answers
111 views

Sorting and keeping the main format of list numbers [duplicate]

I have a list with these elements: list={1/2 (1 + Sqrt[5]), 1, 1, 1/2 (1 - Sqrt[5]), 0}; I want to sort them with ...
8
votes
1answer
220 views

Why `Drop` and `Take` do not support a operator form

Since Mathematica 10 introduced the operator form, I have been a big fan of it. Whenever I use some buit-in functions, I first look up whether they support operator form. To me, it was quite ...
6
votes
4answers
172 views

Using the DeleteCases function

What is the most efficient method for deleting a row of empty list elements? For example, here is a list with one row of empty list elements: ...
15
votes
5answers
573 views

Add a vector to a list of vectors

What is the syntax to add v1 to each vector in v2? I know it has to be simple, but I really have searched and not found it. ...
2
votes
1answer
94 views

Fourier of List

I have such a problem. I try to evaluate and plot the spectrum of large list, and this is what I get: ...
1
vote
2answers
66 views

Add elements to the maximum values of a list

Hi i have a list of n elements and i want to know the 30 maxim values of list without changing his order. And suppose that i have a second list with n elements and i want to add this elements to the ...
2
votes
0answers
43 views

Why doesn't Position work? [duplicate]

I have defined a list ...
1
vote
1answer
67 views

Efficient method to set Matrix values based on position [closed]

I have a matrix, a list of positions, and a vector. I want a new matrix with the values of the vector inserted into the original matrix based upon the list of positions. For example: ...
-1
votes
1answer
37 views

Reading numbers [duplicate]

I need to convert base 10 number say a in base 2 say b and want that, from now b must be read as a base 10 number. In general, I need to convert base 10 number say a in base n say b and want that, ...
4
votes
1answer
76 views

random distribution vectors on cube edges

How can I put randomly eight vectors with length b into eight edges of a cube with side of a and specify them with their ...
6
votes
1answer
123 views

functional way to identify & summarize repeated elements in List?

I have a List, for example (assume it's always ordered like this one): myList = {6, 6, 8, 10, 14} I would like to get a result like this: ...
2
votes
2answers
85 views

Creating pairs and specifying a name for them

I have a list as list={-3/4, -3/4, 3/4, 3/4, -1/4, -1/4, -1/4, -1/4, -1/4, -1/4, 1/4, 1/4, 1/4, 1/4, 1/4, 1/4} I want to create pairs with an added ...
2
votes
1answer
66 views

Having trouble modifying entry in a list

Hi, I am trying to create a small repository by entering three things as a list of string, namely the asp, sequence and description. The trouble that I am facing is that while I am manually ...
1
vote
1answer
49 views

Applying Mod to a long list of mixed nature

I have a huge list of the form ...