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

learn more… | top users | synonyms (5)

2
votes
2answers
185 views
3
votes
5answers
155 views

How do I select strings based on the number they end in?

I have a list of alphanumeric strings, str = {"ANH7134UR1", "ANH7134UL4", "ANH7134UR7", "ANH7134UL17", "ANH7134UR18"}; that I want to assign each string to ...
10
votes
10answers
682 views

Matrix indexed by one number

I'm trying to find a generic way (for arbitrary dimensions) to create a matrix like so a[1] a[2] a[3] a[4] i.e where it is indexed by one number, instead of say ...
5
votes
1answer
93 views

list of all permuations of sublists of a nested list

I've got a certain class of lists with, say, 4 elements, that are lists themselves. E.g. {{1, 2, 3}, {4}, {5, 6}, {7}}. I'd like to find a way to generate a list ...
11
votes
2answers
271 views

How to mesh a region using adaptive cubic elements

Assume a list of {x,y,z} coordinates. The coordinates are arranged in a regular fashion through a fixed raster size (called ...
1
vote
0answers
23 views

How do I add a finite value to one component of a set of vectors [closed]

I have a set of (x,y) values in some *.csv file, when I open them with Mathematica to plot it some of the plots are shifted so I need to add some finite value to one of the components of every vector. ...
8
votes
5answers
293 views

What is the most efficient way to replace items in a list at periodic intervals?

For example, if I want a list of $\phi(n)$ for $1 \leq n \leq 100$ but if $n$ is a multiple of 3 I want to show a 3 instead of $\phi(n)$. I tried ...
21
votes
6answers
2k views

From a list to a list of rules

Starting from these two lists, var = {a, b, c} values = {{1, 2, 3}, {4, 5, 6}, {7, 8 , 9}} how can I generate a list of rules? ...
5
votes
2answers
213 views

Why SetDelayed won't work

I'm trying to do this: Riffle[list = {a, b, c, d, e, f}, tem = RandomInteger[1, Length@list-1]] {a, 0, b, 0, c, 1, d, 0, e, 0, f} But I think this method is ...
1
vote
0answers
42 views

List within a Do loop , i cant get any values [duplicate]

I am having the following problem. I am trying to get some values from solving an equation and apply them into a list but in the output I get nothing but the symbol of the variable... The code is as ...
0
votes
0answers
31 views

Envelope of a given table (or plot)

Is there any way to construct an envelope of a given table (list) or plot? For example, I have plotted (used ListPlot of txt-file) And then I want to plot the envelope (upper or lower) of this plot ...
0
votes
1answer
83 views

How to ListContourPlot a functional eigenvalue spectrum?

We have a (Hermitian) matrix of some finite dimension (n) whose elements are functions of real variables x and y. We wish to plot contours of the spectrum (level sets of the n real eigenvalues) at ...
2
votes
0answers
26 views

Find same list elements of two lists [closed]

Example: I have two 2D lists (each list has no duplicate elements): l1 = {{1, 1}, {2, 2}, {3, 3}, {4, 4}}; l2 = {{1, 1}, {3, 3}, {5, 5}}; How can I create a new ...
6
votes
1answer
75 views

Function that counts number of consecutive elements after iterator in Table command

I have a 1D Table, something like this, that I want to turn into musical notes: ...
7
votes
3answers
159 views

Nonzero element positions of a matrix

Let m={{1, 2, 0}, {4, 0, 9}}; I want to find the position of every nonzero element of the above matrix. The code ...
8
votes
0answers
157 views

Efficient way to flatten or transpose-arrayreshape tensors

I have a tensor of dimensions $(2, 100, 100, 2, 100, 100)$ and I want to reshape it to a form of $(2*100*100,2*100*100)$, e.g. Flatten[A,{{1,5,6},{4,2,3}}]. If I ...
1
vote
1answer
41 views

How to solve from a list

I have this equation: $y(t)=aE^{-bE^{-ct}}$ and I have this list: ...
0
votes
3answers
96 views

How can I extract the x and y values from a coordinate pair? [closed]

I think the question says it all. I have a coordinate pair, {x,y} and I want to extract x and y for use in further calculations. Can't find anything in the docs about this but it seems like it should ...
6
votes
3answers
110 views

Differentiating between zero and “empty” in lists, and adding them?

(Edit: I mean 'differentiate' as in telling the difference between two things, not as in f'(x) ) I have n series of numbers, let's say two for example, with some "empty" spaces between the numbers, ...
2
votes
3answers
83 views

How to get a C4-symmetric (coincides after 90° rotation) matrix via `ImageData` from `Graphics`?

I tried an easy example with Disk centered at {0,0} with radius 1. Obviously, that object is C4-symmetric. Further, ...
3
votes
4answers
118 views

Assign a list of sums to indexed variables

I want to generate a list of sums {a, b, c, d, ..., z} and assign them to a list of variables such that ...
4
votes
2answers
117 views

Arc length parameterization of a list of points?

Suppose I have a curve represented by a list of points in the form $\{\{x_0, y_0\}, \{x_1, y_1\}, ...\}$. How to generate a list of numbers $\{s_0, s_1, ...\}$ where $s_i$ is the distance of ith point ...
4
votes
2answers
54 views

positions satisfying pattern and grouped

I have a list of numbers and I am looking for a way to most efficiently find positions of values that satisfy a certain condition and group those positions that are sequential. To illustrate, a simple ...
3
votes
1answer
67 views

Import Excel sheet into 3D array, 1st row and column as x- and y-axis

It might be simple, but for me, it took several hours working on, but still cannot figure out. Basically, I'd like to create 3 dimensional list data ({x,y,z}) from excel file, so I can plot them ...
3
votes
1answer
61 views

overlap of data

I have two individual Date lists as Date Objects: List 1 = {1 Jan 1991 9 :00 , 3 Jan 1991 11:00 ..etc } List 2 ={ 7 Jan 1991 14:00, 9 Jan 1991 15:00 ..etc} For ...
4
votes
1answer
75 views

Joining table of tuples with table of scalar values [closed]

I have a table of dimension $M \times N \times Q$ of 3-tuples {x,y,z} that represent points, and another table of dimension $M \times N \times Q$ of scalar values. ...
4
votes
1answer
129 views

Insert a symbol include first and last position [closed]

Assume we have a list list = {"a", "b", "c", "d", "e", "f"} Then use this code: StringRiffle[list,"*"] But ...
0
votes
0answers
23 views

Finding the percent difference between elements of a matrix and a list/vector [duplicate]

I have a large matrix of 24 columns, 11 rows, and a vector in the form of a one column, 11 row table. What would be the best method of finding the percent difference between each element of the matrix ...
1
vote
4answers
144 views

Non-rectangular pick of elements of a matrix

How to pick elements of a matrix that are inside a circle centered at the center of the matrix?
0
votes
1answer
80 views

Breaking data sets into series for plotting

I have a generated a data set of a function $\alpha(\lambda_2,\varepsilon):\mathbb{R}_+ \times (0,1) \mapsto (0,1)$. I used mathematica to generate a list by varying $\lambda_2$ and $\varepsilon$; ...
3
votes
1answer
152 views

How can I optimize the search between two lists, one that is changing length?

I'm trying to identify unique arrays by comparing two lists, one which is growing in length. The number of elements in the list grows as 2^n^2, where ...
16
votes
16answers
2k views

Generating a list of numbers that are not multiples of 4

I want to write simple code that will list all numbers from $1$ to $n$ that are not multiples of $4$. And in this case I consider that ...
1
vote
2answers
92 views

How to make some mess points to be more smooth?

Background: The question is derive form this post.I have a another thinking about it.Some points in a suface you can give a certain equation but some points you cannot.So I wanna get a method to ...
3
votes
2answers
99 views

How to gather a list whitout no repeat element to nearest a certain number

Background: The question derive from this question.But some criteria is omited by me.So I try to post a new question for this.If my expression is dimness and you have got it,just tell me or edit my ...
5
votes
2answers
148 views

Multiply list of matrices by list of vectors

I have a list of vectors and a list of matrices for each vector, what i need is to multiply each list of matrices to respective vector. ...
3
votes
2answers
102 views

Find the first n pairs in a list whose difference is the nearest to some number

This is my list: list = {2.6135182051634342, -2.6690957180727297, 0.26060239174734157, -0.4182243295792278}; I wanna gather it every two number,which make ...
4
votes
1answer
64 views

Creating a tensor from matrices

I have 3 nxn matrices that I'd like to combine into a nxnx3 tensor. Basically, I want a new nxn matrix where each element is a 3 tuple of the elements of the other 3 matrices at that same position. ...
16
votes
8answers
3k views

extract values from replacement list

Solve returns a list of replacement rules In: Solve[x + y == 3 && x - y == 6, {x, y}] Out: {{x -> 9/2, y -> -(3/2)}} I am only interested in the ...
2
votes
1answer
60 views

Pairing values with their indexes for MapThread

Several operations require you to map over a list of values and to know the index of each value as you process it. To accomplish this, my current somewhat ugly solution uses MapThread: ...
0
votes
0answers
86 views

How to Extract and Rearrange Elements in Doubly-Nested Lists

Hopefully any easy problem for you guys to help me with! I'm currently having an issue with writing some Mathematica code that will extract the each nth element in each array within a matrix, and then ...
1
vote
1answer
68 views
3
votes
3answers
132 views

Selecting all the elements of different length that contain only numbers

If I have a list of lists with different lengths: {{1, 2, 3}, {1}, {1, 2, 3, 4}, {x}, {1, x}, {2}, {2, 3}} How can I extract all the sub-lists with no symbols: ...
2
votes
3answers
102 views
1
vote
1answer
43 views

list missing numbers [closed]

Let m=[1,2,3,4,5,6,7,8,9,10]; be a set and let s=[ 2,4,5,6,8,9]; be a subset of m. How do list all missing numbers in s from m. For example, the missing numbers in s from 1-->10 are 1,3,7,10. So, ...
1
vote
3answers
85 views

Percent Difference between elements from 2 matrices

If i have a 22 by 25 table of values which depend on n and r, and a list of values that depends on r that is a 22 by 1 matrix, how can I find the percent difference between each element, by row in the ...
1
vote
3answers
66 views

Adding numbers to a list

Say you have the following list of 12 elements X={"x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x"} And I want to turn it into the following sorted ...
0
votes
1answer
22 views

Define nonzero variables Varyx = z_xy from table with dimensions x,y and values z_xy

I'm trying to do the following. I have a table, call it TransTable. To give an example ...