# Tagged Questions

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

807 views

### Convert coefficients of polynomials into a matrix

I have several sets of 5 polynomials of the form: ...
71 views

### How can I use list processing functions on data in a file?

How might I work with the following functions on a list, if the list is a disk based file? Partition[] DeleteDuplicates[] Split[] SortBy[] The file is too ...
97 views

### How to generate a list from an iterator and some arbitrary function

Suppose I'd like to generate a table of integers: Table[i, {i, 10}] Great; now suppose I want only the integers that are even ...
383 views

### Colors associated to parts of a 3D distribution of points

Suppose we have a long list of random points (in Cartesian coordinates) in 3D space. coords := ...; Until now, I was associating colors in a radial way, from the ...
1k views

### How to apply a function to a list of tuples

trialList = {{0, 24.701}, {1, 24.69}, {2, 24.733}}; f[x_] := x + 1; I would like to apply the function f to only the second ...
237 views

### How to extract the bin width from a Histogram made with an automatic binning method?

I am using the Scott binning method with Histogram and Histogram3D to plot some data. How could I find out the bin width chosen ...
514 views

### How to pass a list of arguments into HoldAll

I have a list of arguments (which in reality is lengthy): arguments = {a, b, c} arguments2 = {a_, b_, c_} f[Sequence@@arguments2] := a + b + c Note: It seems ...
436 views

### Faster way to convert triangle list to edge list with no duplicates

I have a list of triangles returned by a Delaunay triangulator, in the following format: ...
454 views

### How to punch a hole in some 3D distribution of points

Suppose we have a long list of 3D Cartesian coordinates, defining a distribution of random points in 3D space. How could we remove all the points inside a sphere of radius ...
206 views

### Position with Except returns first item {0} and last item {}. Why?

Here is a simple list: l={1, 0, 2, 1, 0, 1, 0, 1, 2, 0, 2, 0, 1, 0, 1, 0, 0} To get the position of non-zero elements I use ...
458 views

### DeleteDuplicates[] does not work as expected on floating point values

Here is my simple example, and in this case function DeleteDuplicates does not work as expected. I want to FindRoot of my ...
2k views

### Replace very small numbers by zero in the output of a list

I have a long nested list, but many elements are numbers of order 10^-18 or less, e.g. ...
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 ...
354 views

### Syntax for integrating over limits specified by a Table

I wish to use NIntegrate to compute multidimensional integrals. However, I don't want to manually input the limits for the dimensions. I want to store the ...
205 views

### How to only work on sublists with non-zero (or positive) values

i have a large compositional dataset which contains non-zero and zero values. here is a sample: ...
789 views

### Remove elements at certain positions from all sub-lists?

Consider a big list where all the inner lists length's are the same list = {{x1, y1, z1, t1}, {x2, y2, z2, t2}, {x3, y3, z3, t3}, ...}; elementNo = {4, 3, 2}; ...
892 views

### Select elements of list within a date range

I have a list which consists of elements each of which has a date in DateList format, a number and a flag (Y/N). e.g. ...
2k views

### Pretty way to group elements at odd and even positions

How to make a function that splits list elements by odd and even positions? Shortest implementation wins. I myself came up with: ...
73 views

### PrependTo fails on a Table of Evaluated funtions

My task is something like this: PrependTo[Evaluate[Table[{x, Sin[x]}, {x, 0.1, 2 \[Pi], 0.1}], {0., 1.}]] where I tried also skipping the ...
264 views

### Ordering function with recognition of duplicates

Fairly often I have a need to get the Ordering of an expression but with recognition of duplicates. For example: ...
3k views

### How to efficiently find positions of duplicates?

Is there an efficient way to find the positions of the duplicates in a list? I would like the positions grouped according to duplicated elements. For instance, given ...
2k views

### For loop with steps other than 1

I would like to do a For loop with a jump 2*Pi instead of 1. For[j = 0, j <= nmax, (incr = 2 Pi), ...] Actually what I want to do is ...
1k views

### What is Mathematica's equivalent to MATLAB's filter function?

The MATLAB code filter(0.5,[1, -0.5], [1:10]) is equivalent to Rest@FoldList[(#1 + #2)/2. &, 0, Range[10]] I don't ...
350 views

### Replace a specified portion of an array with elements from another smaller array

This may be a trivial question, but I have been at it for a couple of hours and I have not made much progress. I have a 10 x 10 array (T) that I have used to generate an 8 x 8 array (Q). I want to ...
297 views

### Extracting information from list

I have a huge list that looks like this: ...
516 views

### Dropping n consecutive terms from a list periodically

Suppose I have the following list lis = Range[100]; and I want to remove n consecutive terms periodically from the list. For example suppose I want to drop terms ...
1k views

### How make f[{x,y}] evaluate as f[x,y]? [duplicate]

I frequently encounter the situation where I have a function of two real variables defined, e.g.: f[x_, y_] := 9 - x^2 - y^2 But then I need to feed into ...
1k views

### Extract function arguments

Is there a way to extract the arguments of a function? Consider the following example: I have this sum ...
202 views

### How to construct pairs in a list?

I have an expression like this, input = x[1] x[2]^3 x[5]^2; Fist step, we can get a list from the input expression, ...
556 views

### Select rows from table by keys

I am looking for a way to iteratively select all sublists with the same ID (my 1st column, residual columns are AbsoluteTime entries). First, I obtained the list of ...
44 views

### Correspondence between eigenvectors and eigenvalues [duplicate]

Let us say I have a matrix h (2x2). Now, I want to get the eigenvectors and eigenvalues of my matrix h: ...
748 views

### Separating positive and negative numbers into two arrays

$c$ is a vector with real numbers.I want to separate the positive ones and the negative ones into two vectors: $a$ and $b$. I have the following problem: When I do: ...
3k views

### How can I make the Cartesian product of a list with itself? [duplicate]

I'm trying to build the table {{1, 1}, {1, 2}, {2, 1}, {2, 2}} given the list {1, 2} I can do it like this ...
2k views

### Finding a best fit curve and plotting it [closed]

I have a list as shown below: m01 = {{250, 0.083121}, {200, 0.0888446}, {150, 0.0992422}, {100, 0.121567}, {50, 0.186825}} I'm new to Mathematica, and would like ...
145 views

### Collecting roots of different equations and create a list

I solve two equations and have two solutions one by each equation. I want to create list of these roots. Could anyone please help me? Appreciate it. m02R150 = FindRoot[P1 == 0, {E1, 0.07, 0.1}] ...
399 views

### How to remove some elements in a list based on a rule?

I want to deal with the following list. mylist = Table[cof[i] exp[i], {i, 1, n}]; (*n is very larege *) exp[ ] is a function ...
352 views

### Extracting data from a table under conditions

I have a very large table with two columns. Let's say the name of first column is E and the name of the second is P. How can I get the E values when P = 0.
95 views

### Calibrating Precision in calculations

As the title says, I encounter an irritating problem which has to do with the accuracy or the precision used in the calculations. To be more specific, I have the following code: ...
683 views

### A Faster way to combine two Lists of different structures into one of a different structure [duplicate]

I have the following two lists (each containing over 500,000 elements). Here is a sample: ...
147 views

### Transferring a list from one notebook to another [duplicate]

I have Mathematica code split into two notebooks. The first part is supposed to run and output a list of numbers into a text file, using Export. The second part ...
155 views

### How can I get a single solution to a set of inequality constraints?

I have a set of constraints to which I require integer solutions. However, instead of needing all possible integer solutions (as obtained by using ...
424 views

### Problem with creating a large list of tuples

This is a follow-up question from Sum of Multinomial Coefficients I have thought about the meaning of the formula I mentioned and, with help, I implemented the following code: ...
938 views

### Merging two Lists

I have two tables. One is given by T1 = Table[{x, y, 0.}, {x, 0, V},{y, 0, V}] and from a calculation I have the second, a list of points {x, y, z} ...
214 views

### How to 'merge' a list like FromDigits, but with a mixture of numbers and symbols?

How do I go from {C,4,G,5,S,7} to C4G5S7
361 views

### Mapping over the last level of a list, or equivalent operations

I would like to style each element of my list using Style. But when I try ...
1k views

### How can I Flatten this List with Inner List of Lists?

Given the following List ...
3k views

### Get the coordinates from ContourPlot and RegionPlot

How do I get the coordinates from a contour plot I've done in Mathematica? For example, I have a two-variable function f[x, y], for which I can make a contour plot: ...
122 views

### How to separate a vector into two vectors, one having the first half of my original vector and the other having the second half

I have a set of n vectors with an even length. Let us make an easy example with 3 vectors of length=4: ...