# Tagged Questions

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

849 views

### Combining two lists of different dimensions into a list of all combinations of points?

I have two ranges of values, one from 0 to 20 and the other from 0 to ...
642 views

### How to remove duplicates from set of machine precision 2D points?

I have a set of 2D points with machine precision coordinates. I need to remove all duplicates. Performance is important. This is the most obvious fast solution: ...
503 views

### Generating a matrix using sublists A and B n times

I want to write a function that generates a square matrix from sublists. My sublists are a = Range[0, x, 0.5]; b = Range[0.25, x + 0.25, 0.5]; Suppose x=2, then I ...
378 views

### Fill out blanks with a upcoming number in a list?

I have a bunch of arrays looking like this: {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ...
684 views

### Find list position and mapping list

Sorry, my English is not very good. I have two lists: ...
591 views

### Finding all sublists or substrings of a given list/string

Given a list or string, how do I get a list of all (contiguous) sublists/substrings? The order is not important. Example for lists: ...
2k views

### Alternatives to While Loops?

I am using Mathematica to run a probabilistic simulation. Essentially, I have a list of members of a population (they only have one, numerical, attribute, so it's just implemented as a list of ...
2k views

### ListPlot multiple datasets over same x-values

Is there a better way to enter my data into a list plot? ...
771 views

### Subsets of a list

Consider the following demand of products for the next four months. data={1,20,3,40}; I could produce the whole demand in the first months, leading to the ...
1k views

### Building a continued fraction

I've completed a problem that involves approximating $e$ by a continued fraction: $$\frac{N_1}{D_1+\frac{N_2}{D_2+\frac{N_3}{\ddots+\frac{N_k}{D_k}}}}$$ with the $N_i$ being the list ...
376 views

### Complement on pre-sorted lists

Is there any way to instruct Complement to skip the sorting part? If the answer is no (likely), the next question would be: how can I remove from a sorted list ...
252 views

### Removing background from peak function

Let's say I have a a very large list of data in the format {{n,f[n]}} so something like {{1,600},{2,700},{3,1100}...} and if this data is plotted, then it will look like a sum of Gaussian functions+a ...
139 views

### Comparison Operation for Nested Matrices

I have a nested matrix n as bellow ...
337 views

### How can I use Max[] in a function that is passed a list not find the max of the list

For most functions in Mathematica, passing them a list will call the function on each element of the list. For example: ...
319 views

### Threading behavior of SameQ vs Equals

I ran into a bug in my code today based on an errant assumption. Namely, I thought that: ...
876 views

### NIntegrate receiving a function with NumericQ which returns a list

Can some one please explain why ...
291 views

### Integrating a list of functions

For the purpose of this minimal example, let's say we have a list of functions, like this: f[y_?NumericQ] := {NIntegrate[z*y, {z, 0, 1}], a y} I want to ...
277 views

### Deleting missing data with CountryData

I need to delete all of the missing entries after executing this line: ...
382 views

### Re-arranging / selecting of a data table very slow in For loop [duplicate]

My task is quite simple; I have a table of data like M = {{1,2}, {1,3}, {3,4}, {5,1}, {6,9}, {6,8}, {6,1}}; so the table is sorted with respect to the first ...
167 views

### How to ReplaceAll independent of depth?

I have a big list which in principle can be described as this more compact list : ...
2k views

### Why do Mathematica list indices start at 1? [closed]

In most programming languages, container indices start at 0. This is not random or hardware-related; for example Dijkstra's article explains why zero-based indices make sense. What are the reasons ...
873 views

752 views

### How to find the distance of two lists?

I have two lists as the followings: ab = {1, -1, -1, -1, 1, 1}; ac = {1, -1, -1, 1, 1, 1}; How I can find the difference (more precisely, the edit distance) ...
370 views

### What is the best way to flatten a linked list with lists as values?

By following the advice on this site I have ended up with a linked list like the following: acc = {{1, 2}, {{2, 3}, {{3, 4}, {{4, 5}, {{5, 6}, {}}}}}}; This was ...
805 views

### Modifying a List in a function in place [duplicate]

An example will be most specific: func[list_, column_] := list[[All, column]] = Map[#*2 &, list[[All, column]]]; This throws errors. I want to avoid doing ...