# Tagged Questions

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

3k views

### Simulate MATLAB's meshgrid function

Here is MATLAB's meshgrid. I came up with these implementations in Mathematica: ...
362 views

### How do I create matrices with arbitrary list restrictions?

I want to randomly generate a square matrix of dimension n with entries in the list StartingEntries, and also satisfying that for any such matrix M, the matrix Inverse[IdentityMatrix[n] - M] has ...
211 views

### Preserve information in flattening a nested list

I have a series of lists in the form below: list={ {1,1} , {2,2}, {3,{3,1},{3,2},{31,{31,1},{32,2}}} } Its a nested list which the dimension is changing case to ...
318 views

### Elegant Matrix Combinations

Suppose you have a matrix (mxn), simplified for illustration m= {{a, b, c}, {d, e, f}} And a set of combinations (simplified for illustration purposes but can ...
245 views

### Compute percentages in a list

I have a data file which contains thousands of lines and each line has eight elements. Here is a small sample of the data file ...
1k views

### Looking for a way to insert multiple elements into multiple positions simultaneously in a list

I would like to take the following data: insertValues = {r, x}; insertPositions = {{1}, {5}}; originalList = {a, b, c, d, e, f, g}; and generate output that ...
213 views

### ListPlot under conditions Part II

I have a data file containing several columns and thousands lines of data. Below I present a small portion of it, in order to express my issue: ...
344 views

### Generate Non-Singular Matrix of $n*n$ dimension

I want to create a function that will make an $n*n$ matrix which is non-singular that will always retrieve the same matrix (meaning that the matrix will not be random each time). I tried using the ...
697 views

### Filtering elements from a list that appear only once

I want to be able to select elements from a list that only appear once. I originally had this: Select[Table[Count[list, i], {i, list}], # == 1] But the issue is ...
355 views

### Match a sequence of integers

I would to match a pattern p1 = 0,0,1,0,0 to the elements in listA. The elements are a boolean sequence that may look like this ...
125 views

### Manipulate store values

Is there a way to store the numerical values from a manipulate function in the form of a table? For example, if the function is f[x_] := x^2 - 2x Can one store ...
168 views

### Creating a Table of Items for GIF creation

I want to create a table as shown below so that the steps from the first item to the second item, and the second item to the third item, etc. can be animated. I am not at liberty to post tested ...
153 views

### How can I make check boxes that put elements into a list?

Right now I have a blank list that I am putting in Manipulate[]. I want to be able to choose whether 1,2, or 3 are in this list by setting z1,z2, z3 as True or False: ...
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 ...
1k views

### “Unflattening” a list

Imagine we have a list with some hierarchical structure: list = {{{2,3},{2,4}},{{{3,4}}},{{5,6},{7,8}}}; Which we then flatten to some level in order to process ...
258 views

### How Do I Perform Simple Operations On The Elements of a Table?

I have been using the function HistogramList to generate frequency tables off a data set. The code looks like this: ...
671 views

### Count consecutive occurrences in a list above a certain value

I am trying to tally and sort the number of consecutive occurrences in a list above a certain value. For instance: ...
416 views

### Create continuous function from list

I have a list of data (measured per day) that I want to use as imput for another equation (say f). The problem is that the input I need for f needs to be a continuous function of time. Is it possible ...
878 views

### Make a huge vector in a wise way

I need to construct a vector similar to: v[x_]:={0, 0, x, 0, 0, 2*x, 0, 0, 3*x, ....., 0, 0, n*x}; where n=10^9. How can I ...
502 views

### Underlying Algorithms for List Manipulation Functions

Does anyone know, or know of a link for the underlying algorithms used for list manipulation functions? Specifically: Union with and without the ...
1k views

### Checking for duplicates in sublists

I have a list with contains entries that are length 8 sublists,i.e. L1={{a1,b1,c1,d1,A1,B1,C1,D1},{a2,b2,c2,d2,A2,B2,C2,D2},...} and so on. Now, in my problem two ...
265 views

### Custom Matrix product

I have a list: list1 = {{{a1, a2, a3}, {b1, b2, b3}}, {{c1, c2, c3}, {d1, d2, d3}}}; I want an operation that gives me: Is there a built-in way of doing ...
427 views

### Drawing CountryData groups

I'm sure I'm overlooking something obvious, but I can't draw groups of countries. Here are two countries and two country groups: ...
664 views

### Extracting matrix rows when one of its elements is part of a list (without a loop)

I have a matrix whose rows I want to extract based on whether the elements of one of its columns is a member of another vector (calling it the "comparison vector"). I would like to get better at ...
68 views

### Defining functions in a loop [duplicate]

I have a symbolic solution to a linear system with respect to some variables a[i,j] which depend on a parameter t. sol=Solve[...,Table[a[i,j],{i,0,n},{j,0,n}]] I ...
115 views

### Linear interpolation of a list between periodic anchorpoints

I have a list of the form: list = {1,1,1,2,2,2,3,3,3,4,4,4,7,7,7,19,19,19}; Where we can see that there are an ordered set of integer values that repeat ...
122 views

### How to make a list/matrix out of an expression?

I would like to make a matrix out out of the following expression:  (\Omega^2 (2 d\theta^2 + d\phi^2 - d\phi^2 \cos(2 \theta) \coth(\chi)^2) + (2 d\Omega^2 + (2 d\theta^2 + d\phi^2 - 2 d\chi^2)...
613 views

### select subsets of elements of a list under a certain condition

I am new in Mathematica and am stuck on a simple problem. Please advise: I have the following list: list = { {"1", 1000}, {"2", 800}, {"3", 800} }; I want to ...
159 views

### List manipulation, replace a value [duplicate]

I have the following list: ...
537 views

### Listing matrices up to symmetry

I am interested in the equivalence relation on N x N binary matrices, in which two matrices are equivalent if one can be obtained by rotating/reflecting the other. I would like to obtain a list ...
153 views

### Value for x such that |(x-y)| is minimum

I have a list Y={y1,y2,y3,...,yn} And I would need to find x such that Abs[x-Y[[i]]] for all $y_i$ in $Y$ is minimum. ...
578 views

### Counting the number of operations performed during a calculation

I need to know how can I count the number of operations performed during a calculation of a CompoundExpression. In some of these expressions there are ...
294 views

### Removing coefficients and repeated elements

I got to a problem where as I just can't find the proper Mathematica command. I'm given a list, for example: $\{1,x1,-x1,x2,x5,x3,-x2,-x4\}$ I need this to become $\{1,x1,x2,x3,x4,x5\}$ The ...
184 views

### Computing a mean of median list of points

Given a array of lists with the same number of here N = 10 elements: ...
355 views

### How can I build a GraphicsGrid of fixed size that rearranges the empty plots?

OK, let's make one final attempt; they say the third time is the lucky one! Following @rm-rf 's suggestions, I will try to be as clear as I can. My Mathematica code reads and plots simultaneously ...
1k views

### Finding the midpoints of an ordered list of numbers

Suppose that I have an ordered list of numbers. The numbers in the list may be evenly spaced, but they may not be. Here are two examples, list1 and ...
619 views

### How can I build a GraphicsGrid of arbitrary size?

This is actually a very simple scenario, in order to make simpler this question Part I. Consider the following piece of Mathematica code ...
247 views

### Test whether date is in a certain period

I have one table which contains time periods ("start" and "end") and a "type" for every ...
107 views

### Making two lists which share part of its name, while its name is also an element of the list

I am stalled with the following problem: I want two lists, for example: name={1,2,3} and namec={{1,2,3},{x,y,z},name} The ...
207 views

### Split a list of pairs at points with decreasing first element

I have a list in which the first index is mostly increasing, but dips sometimes. I need to split this list in two or more lists in this way: when the first element of a pair is smaller than the ...
538 views

### ListPlot under conditions

I have a data file containing several columns and thousands lines of data. Below I present a small portion of it, in order to express my issue: ...
160 views

### How to simulate a multivariate recursive system from a list

New to mathematica, trying to use Eric Swanson's Pertubation AIM program to solve DSGE models. His code produces a solution as a list or a table. My question is how do I use this list to simulate the ...
1k views

### Find the slope between adjacent points in a list

I have a list of two dimensional points that are ordered by their x-coordinate. I would like to calculate the slope between all adjacent points. I'm familiar with the use of pure functions in Sort ...
255 views

### Correlation with missing data

I have two lists, age and score, that I want to find correlation on for 50 people. For some people, the score is blank. Example data: ...
604 views

This may be a rather strange question. I will try to create a sort of minimal working example. Suppose that I have two lists, list1 and ...
75 views

### List-manipulation Interpolation

For example, I have the following list: AA={{0, 20000.}, {26.6, 19950.}, {53.2, 19950.}, {79.8, 19950.}, {97.1198, 18644.1}, {102.681, 16452.3}} Another ...
65 views

### How to create a ListPlot containing two lists? [duplicate]

I'm trying to plot a set of points where one list corresponds to the X values another list corresponds to the Y values. I have ...
365 views

### Building conditional lists with Manipulate

I'm trying to select elements of a list that satisfy some criteria using Manipulate[]. Given 2 lists: ...