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

learn more… | top users | synonyms (5)

4
votes
3answers
236 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
185 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
159 views

Simplify the huge determinant product

I try to get the following determinant product result, ...
0
votes
0answers
31 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
207 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: ...
4
votes
1answer
60 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
128 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
211 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
82 views

How to plot many 3D lines together

Here is a small data sample: ...
10
votes
4answers
344 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
44 views

In a list of Disk, how to efficiently delete Disk which are close to other Disk? [duplicate]

I want to draw pictrue like this: My code is: ...
3
votes
1answer
44 views

Simplifying nested KroneckerProducts

Any suggestion how to bring a nested KroneckerProduct form into just one? I mean some how converting ...
0
votes
2answers
114 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
93 views

How to plot specific lists

Here is a sample of data points: ...
5
votes
3answers
180 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
100 views

3d Table to 2d table

I have generated a Table in 3 dimensions, for two variables x, y. ...
3
votes
2answers
78 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
38 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
303 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
641 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
41 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
116 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
221 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
198 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
618 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
112 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
70 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
87 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
129 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
86 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
70 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
50 views

Applying Mod to a long list of mixed nature

I have a huge list of the form ...
0
votes
4answers
136 views

How can I write the natural numbers less than $n$ that are coprime to $n$? [duplicate]

How can I write the natural numbers less than $n$ that are coprime to $n$?
5
votes
3answers
351 views

Selecting numbers from a list

If I wish to select numbers which are greater than 2 or less than 1, I use the following codes respectively: ...
-2
votes
1answer
88 views

Comparing records in a data set represented as a two level list

I have a data matrix I wanted to compare data inside it with itself. it's an easy task First my Data looks like this: ...
2
votes
2answers
55 views

Implementing BinCounts for alphabetical structures

Is it possible to implement BinCounts for alphabets such that those alphabets which fall into the group {a,b,c,d} can be counted ...
9
votes
4answers
412 views

Looping through 3 million elements of a list to 'Set' values is slow

I am looping through the 3 million elements of a time-series (v1, o1) and corresponding values (v2, o2). v1 contains a uniformly increasing timestamp (e.g. 1 to 3,000,000 in increments of 1) o1 ...
-4
votes
1answer
73 views

How to sort my list? Help [closed]

I have a list={1,2,3,4,5,-6,9,3,12,0,-3}. I want to sort its, as way {even,odd,even,odd,....}. Moreover in crescent way for even and odd numbers. So the result ...
2
votes
0answers
120 views

Brownian Bridge - Multiple Paths [closed]

I am attempting to simulate multiple Brownian Bridges on the interval [0, 1]. I have the following snippet: ...
4
votes
2answers
162 views

Modifying the content of a list

If I have a long list of form {{1,2,3,4},{5,6,7,8}, ... {97,98,99,100}} how do I edit/convert it by adding the text as shown below ...
5
votes
1answer
272 views

Generating repeated elements in a list [closed]

Is there a function in mathematica that allows you to generate repeated elements inline within a list. For example, let's say you provided this as input text: {1, 2, 3, 4, Repeat[5,3], 6, 7} ...
0
votes
1answer
52 views

Avoiding misconversion of data with ToExpression function [closed]

I've got a list of data with the following structure which can be easily converted To expresion by some manipulation such as ...
15
votes
3answers
668 views

How to zero (or replace) the diagonal of a square matrix?

Zeroing the diagonal of a square matrix is an operation I need frequently, but somehow I still haven't managed to find an elegant solution that satisfies all these requirements: works with both ...
19
votes
5answers
675 views

How to delete subsets quickly?

I have some data like this: ...
5
votes
3answers
227 views

Simple exercise using the function Cases

I'm having some trouble in the following exercise: Find which elements of the list are prime numbers or divisible by 3. list = Table[i^2 - 6 i - 1, {i, 0, 15}] ...
3
votes
4answers
169 views

Calculating expected value from paired values and weights

I'm very new to Mathematica. I just need a quick solution on how to multiply x with y when a data set is given as ...